2.1.15 慢日志相关命令

慢日志相关的命令:

2.1.15.1 查询慢查询日志的开启状态

mysql> show @@slow_query_log;
+------------------+
| @@slow_query_log |
+------------------+
| 0                |
+------------------+
1 row in set (0.00 sec)

2.1.15.2 开启慢查询日志

mysql> enable @@slow_query_log;
Query OK, 1 row affected (0.09 sec)
enable slow_query_log success

2.1.15.3 关闭慢查询日志

mysql> disable @@slow_query_log;
Query OK, 1 row affected (0.03 sec)
disable slow_query_log success

2.1.15.4 查看慢查询日志统计阈值

mysql> show @@slow_query.time;
+-------------------+
| @@slow_query.time |
+-------------------+
| 100               |
+-------------------+
1 row in set (0.00 sec)

2.1.15.5 修改慢查询日志统计阈值

mysql> reload @@slow_query.time=200;
Query OK, 1 row affected (0.10 sec)
reload @@slow_query.time success

mysql> show @@slow_query.time;
+-------------------+
| @@slow_query.time |
+-------------------+
| 200               |
+-------------------+
1 row in set (0.00 sec)

2.1.15.6 查看慢查询日志刷盘周期

mysql> show @@slow_query.flushperiod;
+--------------------------+
| @@slow_query.flushperiod |
+--------------------------+
| 1                        |
+--------------------------+
1 row in set (0.00 sec)

2.1.15.7 修改慢查询日志刷盘周期

mysql> reload @@slow_query.flushperiod=2;
Query OK, 1 row affected (0.05 sec)
reload @@slow_query.flushPeriod success

mysql> show @@slow_query.flushperiod;
+--------------------------+
| @@slow_query.flushperiod |
+--------------------------+
| 2                        |
+--------------------------+
1 row in set (0.00 sec)

2.1.15.8 查看慢查询日志刷盘条数阈值

mysql> show @@slow_query.flushsize;
+------------------------+
| @@slow_query.flushsize |
+------------------------+
| 1000                   |
+------------------------+
1 row in set (0.01 sec)

2.1.15.9 修改慢查询日志刷盘条数阈值

mysql> reload @@slow_query.flushsize=1100;
Query OK, 1 row affected (0.03 sec)
reload @@slow_query.flushSize success

mysql> show @@slow_query.flushsize;
+------------------------+
| @@slow_query.flushsize |
+------------------------+
| 1100                   |
+------------------------+
1 row in set (0.00 sec)

results matching ""

    No results matching ""