# Seeing replica lag

**URL:** <https://forums.percona.com/t/seeing-replica-lag/14283>\
**Category:** MySQL & MariaDB\
**Created:** [February 7, 2022, 6:12pm UTC](https://forums.percona.com/t/seeing-replica-lag/14283 "2022-02-07T18:12:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![devaraj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/devaraj/32/5798_2.png) [@devaraj](https://forums.percona.com/u/devaraj)\
**Post date:** [February 7, 2022, 6:12pm UTC](https://forums.percona.com/t/seeing-replica-lag/14283/1 "2022-02-07T18:12:43Z")

</div>

Hi Team,

I have observed while checking the replica lag, my replica is running with 19482sec lag and in show processlist i can see below the replica user was active form the same time i,e 19482sec it is same as my replica lag

Is there any relation b/w this?

±-------±-------------±--------------------±--------±------------±--------±--------------------------------------------------------------±-----------------------------------------------------------------------------------------------------+  
| Id | User | Host | db | Command | Time | State | Info |  
±-------±-------------±--------------------±--------±------------±--------±--------------------------------------------------------------±-----------------------------------------------------------------------------------------------------+  
| 23308 | system user | | NULL | Connect | 4833169 | Waiting for master to send event | NULL |  
| 23309 | system user | | wallet4 | Connect | 19482 | update | insert into table |  
|  
| 206947 | database1 | 172.31.22.134:54466 | NULL | Binlog Dump | 5470 | Master has sent all binlog to slave; waiting for more updates | NULL | |  
±-------±-------------±--------------------±--------±------------±--------±--------------------------------------------------------------±-----------------------------------------------------------------------------------------------------+

---

<div class="post-metadata">

**Author:** ![Michael\_Coburn](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/michael_coburn/32/18_2.png) [@Michael\_Coburn](https://forums.percona.com/u/Michael_Coburn)\
**Post date:** [February 7, 2022, 7:14pm UTC](https://forums.percona.com/t/seeing-replica-lag/14283/2 "2022-02-07T19:14:24Z")

</div>

Hi @devaraj , thanks for posting to the Percona forums!

Replica lag is generally evaluated from `SHOW REPLICA STATUS\G` and looking at the `Seconds_behind` variable. This indicates “how many seconds ago this statement executed on the Primary”

You may consider changing to `binlog_format=ROW` in order to apply replica events more quickly.  
[https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar\_binlog\_format](https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_format)

---

<div class="post-metadata">

**Author:** ![devaraj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/devaraj/32/5798_2.png) [@devaraj](https://forums.percona.com/u/devaraj)\
**Post date:** [February 8, 2022, 4:35am UTC](https://forums.percona.com/t/seeing-replica-lag/14283/3 "2022-02-08T04:35:20Z")

</div>

Hi @Michael_Coburn

Thanks for the reply, binlog\_format is row on master and by seeing SHOW REPLICA STATUS\G i can see the replica lag is 19482 sec, but one thing im not understanding here from show processlist on replica show the thread active from same number of time is there any realation between the thread and the replica lag

---

<div class="post-metadata">

**Author:** ![Iori\_yagami](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/iori_yagami/32/6316_2.png) [@Iori\_yagami](https://forums.percona.com/u/Iori_yagami)\
**Post date:** [April 15, 2022, 1:08am UTC](https://forums.percona.com/t/seeing-replica-lag/14283/4 "2022-04-15T01:08:37Z")

</div>

Hi, well not, they are different types but SQL thread Is causing the replication lag, improving your SQL queries AND checking what Is the reason of this stuck. You could check if there are missing constraints on your tables
