Buy Percona ServicesBuy Now!

MySQL Replication and Slow Queries

 | March 28, 2007 |  Posted In: Insight for DBAs


I just filed a bug regarding slow queries executed by replication thread are not being logged to the slow query log.

This is not a big deal but it is ugly little gotcha which I think few people know about. It is especially bad if you’re using tools to analyze slow query log to find what queries take up the most resources on your server – in certain configurations replication load itself may be very significant contributor.

But even if you do not, as I wrote in the bug report it is quite handy to have this information our where as query times on master and slave can be different in a lot of circumstances.

One more thing to consider – slow replication queries also identify replication lag, ie if you have query which ran 10 seconds on the slave and your replication is well loaded, this means at some point in time your replication lag was at least 10 seconds.

Peter Zaitsev

Peter managed the High Performance Group within MySQL until 2006, when he founded Percona. Peter has a Master's Degree in Computer Science and is an expert in database kernels, computer hardware, and application scaling.


Comments are closed