Rotating MySQL Slow Logs Safely

4 Responses to Rotating MySQL Slow Logs Safely

  1. April 18, 2013 @9:01 am

    Hello, since this is a cross-post, I thought that it would be useful to make a coss-comment :D

    One important thing to check is if you are using persistent-connections.

    The global variable long_query_time is checked when the connection is created, so if you are using a connection pool or persistent connections this will not be useful because it will not affect to the connections that were already opened.

    There is a Percona Server feature to solve this issue.

    You can set the “slow_query_log_use_global_control” in 5.5 or “use_global_log_slow_control” in 5.1 in 1 and the server will use the global variable long_query_time instead the local one.

    PS 5.1 http://www.percona.com/doc/percona-server/5.1/diagnostics/slow_extended.html#use_global_log_slow_control
    PS 5.5 http://www.percona.com/doc/percona-server/5.5/diagnostics/slow_extended_55.html#slow_query_log_use_global_control

    Martin

    @martinarrietac

    • Kyle O
      April 18, 2013 @10:20 am

      Thanks, Martin. Indeed, we use slow_query_log_use_global_control=long_query_time,log_slow_filter,log_slow_rate_limit,log_slow_verbosity in our configs. I should have mentioned that!

  2. April 18, 2013 @9:52 pm

    It seem’s that the cross posted url has change to http://www.mysqlperformanceblog.com/2013/04/18/rotating-mysql-slow-logs-safely/

    (notice the day change and the end / character)

    • Kyle O
      April 19, 2013 @11:51 am

      Thanks. I updated the link.

Leave a Reply

Your email address will not be published. Please enter your name, email, and a comment.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Scroll to top