Skip to main content
1 of 2
user avatar
user avatar

MySQL group replication - how to find queries causing replication lag?

How can we determine which queries are causing a set of MySQL servers running Group Replication to have replication lag?

We have a MySQL Group Replication cluster with 9 servers, and we are currently experiencing replication lag (i.e high values in performance_schema.replication_group_member_stats.COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE for several servers).

We noticed that neither slow queries nor frequent queries are necessarily correlated with lag across servers. We have also noticed that some specific joins we had in our application were causing lag spikes and, once we removed them, the lag reduced. This is, however, not the case for all joins.

Is there a tool or a methodology we can use to find the queries causing the lag?