On 28 Oct 2011, at 10:03, 王科选 wrote:
> According to <High performance mysql>,
> seconds_behinds_master is inaccurate, so I just skipped how it works...
> If you want to measure slave lag, follow that book's suggestion:
> One good solution is a heartbeat record,which is a timestamp that you update once
> persecond on the master.To calculate the lag,you can simply subtract the heartbeat from
> the current timestamp on the slave.
This assumes updates and inserts happen at the same speed on the master and slave. If your
assumption is not true (e.g., slaves with SSD disks; or with different indexes than the
master; or with locked tables because of long-running-queries), this will be as precise as
seconds-behind-master, no more than a lousy estimate.
Luis Motta Campos
is a DBA, Foodie, and Photographer