慢查询参数
slow log 输出示例
# Time: 2024-08-08T22:39:12.804253+08:00 #查询结束时间戳
# User@Host: root[root] @ localhost [] Id: 83
# Query_time: 2.331306 Lock_time: 0.000003 Rows_sent: 9762500 Rows_examined: 6250
SET timestamp=1723127950;
select * from huge_table a,huge_table b where a.id<>b.id;
测试slow log记录时间戳
[root@localhost] [test]> select now();
+---------------------+
| now() |
+---------------------+
| 2024-08-11 17:17:45 |
+---------------------+
1 row in set (0.00 sec)
[root@localhost] [test]> select sleep(5);
+----------+
| sleep(5) |
+----------+
| 0 |
+----------+
1 row in set (5.01 sec)
[root@localhost] [test]> select now();
+---------------------+
| now() |
+---------------------+
| 2024-08-11 17:17:50 |
+---------------------+
1 row in set (0.00 sec)
===# Time: 2024-08-11T17:17:50.183134+08:00 #查询结束时间
# User@Host: root[root] @ localhost [] Id: 3732
# Query_time: 5.000437 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 1 #查询时间
SET timestamp=1723367865;
select sleep(5);