# How to check frequency of redo log switching?

**URL:** <https://forums.percona.com/t/how-to-check-frequency-of-redo-log-switching/14626>\
**Category:** Percona Distribution for MySQL\
**Created:** [March 4, 2022, 2:12pm UTC](https://forums.percona.com/t/how-to-check-frequency-of-redo-log-switching/14626 "2022-03-04T14:12:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [March 4, 2022, 2:12pm UTC](https://forums.percona.com/t/how-to-check-frequency-of-redo-log-switching/14626/1 "2022-03-04T14:12:00Z")

</div>

Sorry for this basic question but I can’t seem to find a table that will show me the frequency of redo log switching. How do I know when a log switched?  
In oracle there is a v$log\_history table which has the times when a log switched.  
I don’t see anything in the errorlog either when logs switch.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [March 4, 2022, 3:28pm UTC](https://forums.percona.com/t/how-to-check-frequency-of-redo-log-switching/14626/2 "2022-03-04T15:28:45Z")

</div>

I know that you know MySQL is not Oracle, thus a behavior you see in Oracle will not always be in MySQL. My initial question is “why do you need to know this?” What are you looking for with this metric?

In MySQL, InnoDB specifically, there are by default only 2 redo logs which are used consecutively then wrapped around back to the beginning of the first log. Is that “switching”?

It doesn’t matter how often you ‘switch’ back to the beginning. What matters is ‘when you do wrap around, are there transactions that have not been flushed to tablespace?’ That’s the killer metric for performance. If there are txns that have not been flushed, that means your redo logs are too small to handle your transaction volume.

Here are some metrics you can follow:

- [`Innodb_log_waits`](https://dev.mysql.com/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_log_waits)The number of times that the [log buffer](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_log_buffer) was too small and a [wait](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_wait) was required for it to be [flushed](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_flush) before continuing.
- [`Innodb_log_write_requests`](https://dev.mysql.com/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_log_write_requests)The number of write requests for the `InnoDB` [redo log](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_redo_log).
- [`Innodb_log_writes`](https://dev.mysql.com/doc/refman/8.0/en/server-status-variables.html#statvar_Innodb_log_writes)The number of physical writes to the `InnoDB` [redo log](https://dev.mysql.com/doc/refman/8.0/en/glossary.html#glos_redo_log) file.

---

<div class="post-metadata">

**Author:** ![ipcmlr](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@ipcmlr](https://forums.percona.com/u/ipcmlr)\
**Post date:** [March 4, 2022, 3:32pm UTC](https://forums.percona.com/t/how-to-check-frequency-of-redo-log-switching/14626/3 "2022-03-04T15:32:06Z")

</div>

Thanks Matthew! That answers my issue.  
log waits and log writes will be enough for me to check if we are experiencing an abnormal bump in activity.  
Thanks again.
