From: Luis Motta Campos Date: October 28 2011 8:17am Subject: Re: how to understand seconds_behind_master List-Archive: http://lists.mysql.com/mysql/226195 Message-Id: MIME-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 28 Oct 2011, at 10:03, =E7=8E=8B=E7=A7=91=E9=80=89 wrote: > According to , >=20 > 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. Cheers. -- Luis Motta Campos is a DBA, Foodie, and Photographer