I want to log a query with comments to a slow query log

Asked by parkjanghee

I want to log a query with comments to a slow query log.
I tested it but a query with comments did not log to a slow query log.

1. server information

Server version: 5.7.18-16-log Percona Server (GPL)

2. my.cnf

mysql> show global variables like '%slow%';
+-----------------------------------+-------------------------------+
| Variable_name | Value |
+-----------------------------------+-------------------------------+
| log_slow_admin_statements | OFF |
| log_slow_filter | |
| log_slow_rate_limit | 1 |
| log_slow_rate_type | session |
| log_slow_slave_statements | OFF |
| log_slow_sp_statements | ON |
| log_slow_verbosity | |
| max_slowlog_files | 0 |
| max_slowlog_size | 0 |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_log_always_write_time | 10.000000 |
| slow_query_log_file | /var/lib/mysql/mysql_slow.log |
| slow_query_log_use_global_control | |
+-----------------------------------+-------------------------------+
14 rows in set (0.01 sec)

mysql> show global variables like '%long_query%';
+-----------------+----------+
| Variable_name | Value |
+-----------------+----------+
| long_query_time | 0.000000 |
+-----------------+----------+
1 row in set (0.00 sec)

3. a query with comments

mysql> /* query comment */
mysql> select
    -> count(*) as aaaaa /* query comment */
    -> from testdb.sbtest1;
+-------+
| aaaaa |
+-------+
| 0 |
+-------+
1 row in set (0.00 sec)

mysql>
mysql>
mysql> select /* query comment */
    -> count(*) as bbbbb /* query comment */
    -> from testdb.sbtest2;
+-------+
| bbbbb |
+-------+
| 0 |
+-------+
1 row in set (0.01 sec)

4. slow query log (I can not see the comment)

# Time: 2017-08-23T18:39:34.867176+09:00
# User@Host: admin[admin] @ localhost [] Id: 6
# Schema: Last_errno: 0 Killed: 0
# Query_time: 0.004092 Lock_time: 0.003252 Rows_sent: 1 Rows_examined: 0 Rows_affected: 0
# Bytes_sent: 53
SET timestamp=1503481174;
select
    count(*) as aaaaa
from testdb.sbtest1;
# Time: 2017-08-23T18:39:34.870822+09:00
# User@Host: admin[admin] @ localhost [] Id: 6
# Schema: Last_errno: 0 Killed: 0
# Query_time: 0.001084 Lock_time: 0.000898 Rows_sent: 1 Rows_examined: 0 Rows_affected: 0
# Bytes_sent: 53
SET timestamp=1503481174;
select
    count(*) as bbbbb
from testdb.sbtest2;

Question information

Language:
English Edit question
Status:
Expired
For:
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.