Bug #55323 | add an option to limit the write rate to slow query log | ||
---|---|---|---|
Submitted: | 16 Jul 2010 16:12 | Modified: | 13 Dec 2011 19:20 |
Reporter: | Axel Schwenke | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Logging | Severity: | S4 (Feature request) |
Version: | OS: | Any | |
Assigned to: | Geir Høydalsvik | CPU Architecture: | Any |
[16 Jul 2010 16:12]
Axel Schwenke
[26 Jul 2010 11:27]
Simon Mudd
I would think that initially having a simple rate limit (which is by default 0, not limited) which shows the first x queries not using indexes per unit time would be good. The peak values seems probably an unnecessary extra knob. Also the limit is probably best set as a rate per minute as a per second limit is possibly not going to be useful unless the value can take non-integer numbers. The log_queries_not_using_indexes can really make the slowlog file size grow extremely quickly on busy servers, and most of the useful information can be obtained by the selected queries. What might be helpful if this is applied is to count the number of queries and total executed seconds, and total rows read in the queries and print these missing numbers out prior to the next "valid" slow log entry. This means that at least some idea of how much data is missing and how slow these queries are will be kept even if the queries themselves are not. If this is the typical output for a single query: # Query_time: 0.005764 Lock_time: 0.000129 Rows_sent: 0 Rows_examined: 20802 then add a not shown list as follows: # Not shown (due to rate limiting): Queries: 999 Query_time: 3.5764 Lock_time: 2.0129 Rows_sent: 100 Rows_examined: 223080
[13 Dec 2011 19:20]
Paul DuBois
Noted in 5.6.5 changelog. If the log_queries_not_using_indexes system variable is enabled, slow queries that do no use indexes are written to the slow query log. In this case, it is now possible to put a logging rate limit on these queries by setting the new log_throttle_queries_not_using_indexes system variable, so that the slow query log does not grow too quickly. By default, this variable is 0, which means there is no limit. Positive values impose a per-minute limit on logging of queries that do not use indexes. The first such query opens a 60-second window within which queries up to the given limit are logged. Additional queries within that window are suppressed. When the window ends, a summary is logged that indicates the number of suppressed queries and the aggregate time spent in them. The next 60-second window begins when the next query that does not use indexes is logged.