Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.3.7, 10.4.2, 10.1.37, 10.2.21
-
None
Description
As per the manual,
Slow_queries
Description: Number of queries which took longer than long_query_time to run. The slow query log does not need to be active for this to be recorded.
https://mariadb.com/kb/en/library/server-status-variables/#slow_queries
But in real scenario, we have to active slow query log otherwise, it will not be recoded.
MariaDB [test]> select @@long_query_time, @@slow_query_log;
|
+-------------------+------------------+
|
| @@long_query_time | @@slow_query_log |
|
+-------------------+------------------+
|
| 10.000000 | 0 |
|
+-------------------+------------------+
|
1 row in set (0.029 sec)
|
|
MariaDB [test]> show global status like 'slow_queries';
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Slow_queries | 0 |
|
+---------------+-------+
|
1 row in set (0.005 sec)
|
|
MariaDB [test]> set global long_query_time=0.1;
|
Query OK, 0 rows affected (0.027 sec)
|
|
MariaDB [test]> \r
|
Connection id: 10
|
Current database: test
|
|
MariaDB [test]> select sleep(1) from mysql.user limit 2;
|
+----------+
|
| sleep(1) |
|
+----------+
|
| 0 |
|
| 0 |
|
+----------+
|
2 rows in set (2.079 sec)
|
|
MariaDB [test]> show global status like 'slow_queries';
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Slow_queries | 0 |
|
+---------------+-------+
|
1 row in set (0.005 sec)
|
|
MariaDB [test]> set global slow_query_log=ON;
|
Query OK, 0 rows affected (0.038 sec)
|
|
MariaDB [test]> \r
|
Connection id: 11
|
Current database: test
|
|
MariaDB [test]> select @@long_query_time, @@slow_query_log;
|
+-------------------+------------------+
|
| @@long_query_time | @@slow_query_log |
|
+-------------------+------------------+
|
| 0.100000 | 1 |
|
+-------------------+------------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [test]> select sleep(1) from mysql.user limit 2;
|
+----------+
|
| sleep(1) |
|
+----------+
|
| 0 |
|
| 0 |
|
+----------+
|
2 rows in set (1.996 sec)
|
|
MariaDB [test]> show global status like 'slow_queries';
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Slow_queries | 1 |
|
+---------------+-------+
|
1 row in set (0.005 sec)
|
Attachments
Issue Links
- relates to
-
MDEV-18892 Regression in slow log and admin statements
- Closed
-
MDEV-18907 Slow log: RENAME TABLE is not "admin", while ALTER TABLE..RENAME is
- Closed