Not the answer you need?
Register and ask your own question!

When is bin-logs expired by expire_log_days?

sigurdursigurdur EntrantInactive User Role Beginner
I have Percona 5.5.25 server running with binlogging, no slaves, and a high change rate (~100GB binlogs/day, 1 to 6 GB/hour varying through the day).

The server is configured with expire_log_days=2 and max_binlog_size=1G.

I expected to see old binlogs be removed more or less in sync with new binlogs being created, but it seems the expiry happens only around four times a day, but not in strictly regular intervals. See the attached graph showing disk usage for the directory containing the binlogs.

Is this a bug or feature, or an artifact of something in my Mysql server that I fail to see? I see that I can work around this by implementing expiry through external cronbased purging, but it would be nice to keep the log handeling interal in Mysql.

kind regards,


  • mirfanmirfan Database Administrator Inactive User Role Beginner
    expire_log_days takes into effect in two situations.

    1) During server startup if expire_log_days reached to it's value.
    2) During log flush if expire_log_days reached to it's value.

    So, when log flushes it expires logs older than 48 hours as you set expire_log_days=2, check here for details
  • sigurdursigurdur Entrant Inactive User Role Beginner
    The next question then is when are logs flushed?

    I know the binlog is flushed when it reaches max_binlog_size, which happens 1 to 6 times an hour on this system. But the flush that expires logs seems to happen only around four times a day, and not at the regualr intervals.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.