MySQL 4.1.1以降なら、SHOW SLAVE STATUSでSeconds_Behind_Masterというのが見られるそうで、これが遅延秒数の指標として使えるっぽい。
This field is an indication of how “late” the slave is:
- When the slave SQL thread is actively running (processing updates), this field is the number of seconds that have elapsed since the timestamp of the most recent event on the master executed by that thread.
- When the SQL thread has caught up to the slave I/O thread and goes idle waiting for more events from the I/O thread, this field is zero.
In essence, this field measures the time difference in seconds between the slave SQL thread and the slave I/O thread.
If the network connection between master and slave is fast, the slave I/O thread is very close to the master, so this field is a good approximation of how late the slave SQL thread is compared to the master. If the network is slow, this is not a good approximation; the slave SQL thread may quite often be caught up with the slow-reading slave I/O thread, so Seconds_Behind_Master often shows a value of 0, even if the I/O thread is late compared to the master. In other words, this column is useful only for fast networks.MySQL :: MySQL 8.0 Reference Manual :: 22.214.171.124 SHOW SLAVE STATUS Syntax