Slow query log improvements

Bug #1093956 reported by Keyur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Triaged
Wishlist
Unassigned
5.5
Triaged
Wishlist
Unassigned

Bug Description

We recently encountered an issue with a particular type of query was not using the right index and resulted in doing a filesort-on-disk. The query itself was fast (taking < 100ms) but there were many processes were running these with different parameters. Soon the bottleneck became write IO and the server stalled. The server had long_query_time as 1s.

We realized there's currently no way to gain visibility into queries doing tmp/filesort based disk IO.

The attached patch helps solve that by adding a new variable "log_slow_override" with similar values as "log_slow_filter". It will log statements to the slow query log that match certain execution plans irrespective of what long_query_time is. It also guesstimate the size of the filesort disk-file and adds it to the log file.

The patch also fixes a couple of other bugs:
1) The enum enum_log_slow_filter (SLOG_F_QC_NO, etc.) is unnecessary and checking against them in sql_parse.cc is wrong. Sys_var_set parses the values of the variable "log_slow_filter" into powers of 2 automatically and one should check against QPLAN_* to see if a particular flag is enabled.
2) The char* array log_slow_filter_name is off by one when compared to the values in QPLAN_*. It was missing "qc".

Revision history for this message
Keyur (keyurdg) wrote :
Revision history for this message
Keyur (keyurdg) wrote :

The patch is based off of Percona-Server-5.5.27-rel28.1

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Keyur -

Thanks for your contribution. For the couple of other bugs that you mention, please follow bug 1030783, we are fixing them there.

tags: added: slow-extended
tags: added: contribution
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2396

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.