slow_query_log missing queries

Bug #1712782 reported by Jonathan Hartley
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Incomplete
Undecided
Muhammad Irfan

Bug Description

Trying to get ALL queries in a small period logged, general log does not have enough info
So using
SET GLOBAL log_output='TABLE';
SET GLOBAL slow_query_log=0;
SET GLOBAL general_log=0;
TRUNCATE TABLE mysql.slow_log;
TRUNCATE TABLE mysql.general_log;
SET GLOBAL long_query_time=0;
SET GLOBAL slow_query_log=1;
SET GLOBAL general_log=1;
SELECT SLEEP(120);
SET GLOBAL slow_query_log=0;
SET GLOBAL general_log=0;

Then using
SELECT (
SELECT COUNT(*) FROM slow_log WHERE lcase(sql_text) LIKE '%update%'
) slow,
(
SELECT COUNT(*) FROM general_log WHERE lcase(argument) LIKE '%update%'
) general;

You get different results, the slow log has alot less queries in than the general log even if you limit the query times to exclude the beginning and end of the period

Revision history for this message
Jonathan Hartley (jon.hartley) wrote :

mysql> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 5.6.32-78.0-log |
+-----------------+
1 row in set (0.00 sec)

Revision history for this message
Jonathan Hartley (jon.hartley) wrote :

Current settings

| log_slow_admin_statements | OFF |
| log_slow_filter | |
| log_slow_rate_limit | 1 |
| log_slow_rate_type | session |
| log_slow_slave_statements | ON |
| log_slow_sp_statements | ON |
| log_slow_verbosity | |
| log_throttle_queries_not_using_indexes | 0 |

Revision history for this message
Jonathan Hartley (jon.hartley) wrote :

mysql> show variables like 'min%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| min_examined_row_limit | 0 |
+------------------------+-------+

Revision history for this message
Sveta Smirnova (svetasmirnova) wrote :

Thank you for the report.

You have option

| log_slow_admin_statements | OFF |

Could you please turn it ON, try again and if issue still repeatable provide example of queries which were not logged?

Changed in percona-server:
assignee: nobody → Sveta Smirnova (svetasmirnova)
assignee: Sveta Smirnova (svetasmirnova) → nobody
status: New → Incomplete
Revision history for this message
Jonathan Hartley (jon.hartley) wrote :

SET GLOBAL log_output='TABLE';
SET GLOBAL slow_query_log=0;
SET GLOBAL general_log=0;
TRUNCATE TABLE mysql.slow_log;
TRUNCATE TABLE mysql.general_log;
SET GLOBAL long_query_time=0;
SET GLOBAL log_slow_rate_type = 'query';
SET GLOBAL slow_query_log=1;
SET GLOBAL general_log=1;
SET GLOBAL log_slow_admin_statements = 1;
SELECT SLEEP(120);
SET GLOBAL slow_query_log=0;
SET GLOBAL general_log=0;

SELECT (
SELECT COUNT(*) FROM slow_log WHERE lcase(sql_text) LIKE '%update%'
) slow,
(
SELECT COUNT(*) FROM general_log WHERE lcase(argument) LIKE '%update%'
) general;
mysql> SELECT (
    -> SELECT COUNT(*) FROM slow_log WHERE lcase(sql_text) LIKE '%update%'
    -> ) slow,
    -> (
    -> SELECT COUNT(*) FROM general_log WHERE lcase(argument) LIKE '%update%'
    -> ) general;
+------+---------+
| slow | general |
+------+---------+
| 645 | 923 |
+------+---------+
1 row in set (0.88 sec)

Revision history for this message
Jonathan Hartley (jon.hartley) wrote :

Queries missing are all of the same format, very simple primary key single row updates
e.g.
UPDATE tevoc SET `ev_oc_id` = '60750331',`ev_mkt_id` = '9675871',...... WHERE ev_oc_id = '60750331'

Changed in percona-server:
assignee: nobody → Muhammad Irfan (muhammad-irfan)
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-3735

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.