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
-
Activity
Field | Original Value | New Value |
---|---|---|
Affects Version/s | 10.1.37 [ 23204 ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Component/s | Configuration [ 13904 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Assignee | Sergei Golubchik [ serg ] |
Assignee | Sergei Golubchik [ serg ] | Sergey Vojtovich [ svoj ] |
Assignee | Sergey Vojtovich [ svoj ] | Alexander Barkov [ bar ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Fix Version/s | 10.4 [ 22408 ] |
Affects Version/s | 10.4.2 [ 23229 ] |
Priority | Critical [ 2 ] | Blocker [ 1 ] |
Fix Version/s | 10.4 [ 22408 ] |
Priority | Blocker [ 1 ] | Critical [ 2 ] |
Fix Version/s | 10.1.39 [ 23305 ] | |
Fix Version/s | 10.2.23 [ 23307 ] | |
Fix Version/s | 10.3.14 [ 23216 ] | |
Fix Version/s | 10.4.4 [ 23310 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.3 [ 22126 ] |
issue.field.resolutiondate | 2019-03-04 11:48:08.0 | 2019-03-04 11:48:08.188 |
Resolution | Fixed [ 1 ] | |
Status | Confirmed [ 10101 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Stalled [ 10000 ] |
issue.field.resolutiondate | 2019-03-06 13:10:45.0 | 2019-03-06 13:10:45.225 |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Stalled [ 10000 ] |
issue.field.resolutiondate | 2019-03-06 19:46:30.0 | 2019-03-06 19:46:30.894 |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Link |
This issue relates to |
Link |
This issue relates to |
Workflow | MariaDB v3 [ 91964 ] | MariaDB v4 [ 155566 ] |
Zendesk Related Tickets | 113021 |
The difference was introduced by this commit:
commit e2b2bde358f434d945e9730acfbc6eedeb9ab8a2
Author: Monty
Date: Sun Aug 3 15:26:47 2014 +0300
Made sql_log_slow a session variable
mysqldump:
- Added --log-queries to allow one to disable logging for the dump
sql/log_event.cc:
- Removed setting of enable_slow_log as it's not required anymore.
sql/sql_parse.cc:
- Set enable_slow_log to value of thd->variables.sql_log_slow as this will speed up tests if slow log is disabled.
- opt_log_slow_admin_statements can now only disable slow log, not enable it.
sql/sql_explain.cc:
- Minor cleanup
Other things:
- Added sql_log_slow to system variables.
- Changed opt_slow_log to global_system_variables.sql_log_slow in all files
- Updated tests to reflect changes
If we want to keep it this way, documentation needs to be updated.