I want to log a query with comments to a slow query log
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_
| log_slow_filter | |
| log_slow_rate_limit | 1 |
| log_slow_rate_type | session |
| log_slow_
| log_slow_
| log_slow_verbosity | |
| max_slowlog_files | 0 |
| max_slowlog_size | 0 |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_
| slow_query_log_file | /var/lib/
| slow_query_
+------
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-
# 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=
select
count(*) as aaaaa
from testdb.sbtest1;
# Time: 2017-08-
# 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=
select
count(*) as bbbbb
from testdb.sbtest2;
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: