Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
SHOW EXPLAIN allows to produce EXPLAIN during the query execution. We are now able to save it in the slow query log.
The user interface is as follows:
"explain" is a new flag in log-slow-verbosity argument:
[mysqld]
|
...
|
log-slow-verbosity=query_plan,explain
|
The output is printed into slow query log like this:
# User@Host: root[root] @ localhost []
|
# Thread_id: 2 Schema: j4 QC_hit: No
|
# Query_time: 0.000629 Lock_time: 0.000202 Rows_sent: 3 Rows_examined: 3
|
# Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
|
# Filesort: No Filesort_on_disk: No Merge_passes: 0
|
## <explain>
|
## id select_type table type possible_keys key key_len ref rows Extra
|
## 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
## </explain>
|
SET timestamp=1381828772;
|
select * from t1 where a between 1 and 3333;
|
Attachments
Issue Links
- is blocked by
-
MDEV-3798 Add EXPLAIN for UPDATE/DELETE (mwl #51)
-
- Closed
-
- relates to
-
MDEV-5045 Server crashes in QPF_query::print_explain with log_slow_verbosity='query_plan,explain'
-
- Closed
-
-
MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log
-
- Closed
-
-
MDEV-5067 Valgrind warnings (Invalid read) in QPF_table_access::print_explain / String::append on a SELECT sq with DISTINCT
-
- Closed
-
-
MDEV-5106 Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT with explain in slow log
-
- Closed
-
-
MDEV-5117 Explain for a query executed as a PS is not written into the slow log
-
- Closed
-
-
MDEV-5118 Explain output for SHOW EXPLAIN in the slow log looks useless
-
- Open
-
-
MDEV-5125 Test sys_vars.log_slow_verbosity_basic fails on 10.0-base-explain-slowquerylog tree
-
- Closed
-
-
MDEV-6388 ANALYZE $stmt output in the slow query log
-
- Closed
-
-
MDEV-406 ANALYZE $stmt
-
- Closed
-
Activity
Assignee | Sergei Petrunia [ psergey ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Description | SHOW EXPLAIN allows to produce EXPLAIN during the query execution. We are now able to save it in the slow query log. |
SHOW EXPLAIN allows to produce EXPLAIN during the query execution. We are now able to save it in the slow query log. The user interface is as follows: "explain" is a new flag in log-slow-verbosity argument: {noformat} [mysqld] ... log-slow-verbosity=query_plan,explain {noformat} The output is printed into slow query log like this: {noformat} # Time: 130920 9:38:04 # User@Host: root[root] @ localhost [] # Thread_id: 2 Schema: test QC_hit: No # Query_time: 0.002969 Lock_time: 0.000941 Rows_sent: 132 Rows_examined: 132 # Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # # id select_type table type possible_keys key key_len ref rows Extra # 1 SIMPLE t0 ALL NULL NULL NULL NULL 1000 # use test; SET timestamp=1379655484; select * from t0 limit 132; {noformat} |
Description |
SHOW EXPLAIN allows to produce EXPLAIN during the query execution. We are now able to save it in the slow query log. The user interface is as follows: "explain" is a new flag in log-slow-verbosity argument: {noformat} [mysqld] ... log-slow-verbosity=query_plan,explain {noformat} The output is printed into slow query log like this: {noformat} # Time: 130920 9:38:04 # User@Host: root[root] @ localhost [] # Thread_id: 2 Schema: test QC_hit: No # Query_time: 0.002969 Lock_time: 0.000941 Rows_sent: 132 Rows_examined: 132 # Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 # # id select_type table type possible_keys key key_len ref rows Extra # 1 SIMPLE t0 ALL NULL NULL NULL NULL 1000 # use test; SET timestamp=1379655484; select * from t0 limit 132; {noformat} |
SHOW EXPLAIN allows to produce EXPLAIN during the query execution. We are now able to save it in the slow query log. The user interface is as follows: "explain" is a new flag in log-slow-verbosity argument: {noformat} [mysqld] ... log-slow-verbosity=query_plan,explain {noformat} The output is printed into slow query log like this: {noformat} # User@Host: root[root] @ localhost [] # Thread_id: 2 Schema: j4 QC_hit: No # Query_time: 0.000629 Lock_time: 0.000202 Rows_sent: 3 Rows_examined: 3 # Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No # Filesort: No Filesort_on_disk: No Merge_passes: 0 ## <explain> ## id select_type table type possible_keys key key_len ref rows Extra ## 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where ## </explain> SET timestamp=1381828772; select * from t1 where a between 1 and 3333; {noformat} |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | defaullt [ 12712 ] | MariaDB v2 [ 44654 ] |
Workflow | MariaDB v2 [ 44654 ] | MariaDB v3 [ 64019 ] |
Workflow | MariaDB v3 [ 64019 ] | MariaDB v4 [ 131953 ] |
Stack trace of where currently "query plan" information is written into the query log:
#0 MYSQL_QUERY_LOG::write
#1 0x00000000008a87b9 in Log_to_file_event_handler::log_slow
#2 0x00000000008a91c5 in LOGGER::slow_log_print
#3 0x00000000008b4b9f in slow_log_print
#4 0x00000000006168d9 in log_slow_statement
#5 0x0000000000616594 in dispatch_command
#6 0x000000000061460f in do_command