diff options
author | Oleg Smirnov <olernov@gmail.com> | 2022-02-16 13:03:46 +0700 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2022-04-29 10:48:25 +0300 |
commit | a0475cb9ca2b98d5c95f021e6d8c57dcba238397 (patch) | |
tree | 4da540e0f95e2e65628597cee8bfdb4bee0de3c5 | |
parent | d1a1ad4c28f3e608901406d13db96e1ec1672458 (diff) | |
download | mariadb-git-a0475cb9ca2b98d5c95f021e6d8c57dcba238397.tar.gz |
MDEV-27021 Add explicit indication of SHOW EXPLAIN/ANALYZE.
1. Add explicit indication that the output is produced by
SHOW EXPLAIN/ANALYZE FORMAT=JSON command.
2. Remove useless "r_total_time_ms" field from SHOW ANALYZE FORMAT=JSON
output when there is no timed statistics gathered.
3. Add "r_query_time_in_progress_ms" to the output of SHOW ANALYZE FORMAT=JSON.
65 files changed, 207 insertions, 187 deletions
diff --git a/mysql-test/include/analyze-format.inc b/mysql-test/include/analyze-format.inc index 7e18524e44e..7d1c48f3e6f 100644 --- a/mysql-test/include/analyze-format.inc +++ b/mysql-test/include/analyze-format.inc @@ -1,3 +1,3 @@ # The time on ANALYSE FORMAT=JSON is rather variable ---replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms)": )[^, \n]*/\1"REPLACED"/ +--replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms|r_query_time_in_progress_ms)": )[^, \n]*/\1"REPLACED"/ diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index b5820e64c2a..684db62d770 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1715,7 +1715,7 @@ performance-schema-max-socket-classes 10 performance-schema-max-socket-instances -1 performance-schema-max-sql-text-length 1024 performance-schema-max-stage-classes 160 -performance-schema-max-statement-classes 221 +performance-schema-max-statement-classes 222 performance-schema-max-statement-stack 10 performance-schema-max-table-handles -1 performance-schema-max-table-instances -1 diff --git a/mysql-test/main/show_analyze.result b/mysql-test/main/show_analyze.result index 8c37876fa50..e307edcccf8 100644 --- a/mysql-test/main/show_analyze.result +++ b/mysql-test/main/show_analyze.result @@ -31,7 +31,7 @@ select count(*) from t1 where c < 500; connection default; show analyze for $thr2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 59.38 50.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 50.00 50.00 Using where Warnings: Note 1003 select count(*) from t1 where c < 500 connection con1; @@ -41,7 +41,7 @@ select max(c) from t1 where c < 10; connection default; show analyze for $thr2; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.16 10.00 Using where +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where Warnings: Note 1003 select max(c) from t1 where c < 10 connection con1; diff --git a/mysql-test/main/show_analyze_json.result b/mysql-test/main/show_analyze_json.result index b49fe8c9971..574fe73f20c 100644 --- a/mysql-test/main/show_analyze_json.result +++ b/mysql-test/main/show_analyze_json.result @@ -36,12 +36,12 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select count(*) from t1 where c < 500; connection default; show analyze format=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -50,7 +50,7 @@ ANALYZE "r_loops": 1, "rows": 1000, "r_rows": 1000, - "filtered": 59.375, + "filtered": 50, "r_filtered": 50, "attached_condition": "t1.c < 500" } @@ -66,12 +66,12 @@ count(*) select max(c) from t1 where c < 10; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -80,7 +80,7 @@ ANALYZE "r_loops": 1, "rows": 1000, "r_rows": 1000, - "filtered": 10.15625, + "filtered": 10, "r_filtered": 10, "attached_condition": "t1.c < 10" } @@ -97,8 +97,9 @@ max(c) analyze select max(c) from t1 where a < 10; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, @@ -131,11 +132,12 @@ SET debug_dbug=@old_debug; # UNION, select, first branch set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9; +select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9; connection default; show analyze FORMAT= json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "union_result": { "table_name": "<union1,2>", @@ -147,11 +149,10 @@ ANALYZE "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { - "table_name": "A", + "table_name": "a", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -171,7 +172,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "B", + "table_name": "b", "access_type": "ALL", "r_loops": 0, "rows": 10, @@ -189,7 +190,7 @@ ANALYZE } } Warnings: -Note 1003 select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9 +Note 1003 select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9 connection con1; max(a) 5 @@ -197,11 +198,12 @@ max(a) # UNION, select, second branch set @show_explain_probe_select_id=2; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9; +select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9; connection default; show analyze format=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "union_result": { "table_name": "<union1,2>", @@ -213,11 +215,10 @@ ANALYZE "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { - "table_name": "A", + "table_name": "a", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -235,11 +236,10 @@ ANALYZE "select_id": 2, "operation": "UNION", "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { - "table_name": "B", + "table_name": "b", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -257,7 +257,7 @@ ANALYZE } } Warnings: -Note 1003 select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9 +Note 1003 select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9 connection con1; max(a) 5 @@ -265,11 +265,12 @@ max(a) # UNION, analyze, first branch set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9; +analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "union_result": { "table_name": "<union1,2>", @@ -285,7 +286,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "A", + "table_name": "a", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -307,7 +308,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "B", + "table_name": "b", "access_type": "ALL", "r_loops": 0, "rows": 10, @@ -325,19 +326,20 @@ ANALYZE } } Warnings: -Note 1003 analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9 +Note 1003 analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9 connection con1; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION b ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL # UNION, analyze, second branch set @show_explain_probe_select_id=2; -analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9; +analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9; connection default; show analyze FORMAT=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "union_result": { "table_name": "<union1,2>", @@ -353,7 +355,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "A", + "table_name": "a", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -377,7 +379,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "B", + "table_name": "b", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -397,29 +399,29 @@ ANALYZE } } Warnings: -Note 1003 analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9 +Note 1003 analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9 connection con1; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION b ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL SET debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -select a, (select max(a) from t0 B where a>6) from t0 A where a<2; +select a, (select max(a) from t0 b where a>6) from t0 a where a<2; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { - "table_name": "A", + "table_name": "a", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -435,11 +437,10 @@ ANALYZE "query_block": { "select_id": 2, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { - "table_name": "B", + "table_name": "b", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -456,20 +457,21 @@ ANALYZE } } Warnings: -Note 1003 select a, (select max(a) from t0 B where a>6) from t0 A where a<2 +Note 1003 select a, (select max(a) from t0 b where a>6) from t0 a where a<2 connection con1; -a (select max(a) from t0 B where a>6) +a (select max(a) from t0 b where a>6) 0 9 1 9 SET debug_dbug=@old_debug; # Uncorrelated subquery, analyze set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2; +analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, @@ -477,7 +479,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "A", + "table_name": "a", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -499,7 +501,7 @@ ANALYZE "nested_loop": [ { "table": { - "table_name": "B", + "table_name": "b", "access_type": "ALL", "r_loops": 1, "rows": 10, @@ -518,11 +520,11 @@ ANALYZE } } Warnings: -Note 1003 analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2 +Note 1003 analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2 connection con1; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where SET debug_dbug=@old_debug; # correlated subquery, select, before execution start set @show_explain_probe_select_id=1; @@ -530,8 +532,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "nested_loop": [ @@ -588,12 +591,12 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -616,7 +619,6 @@ ANALYZE "query_block": { "select_id": 2, "r_loops": 2, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -650,8 +652,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, @@ -731,11 +734,11 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show analyze FORMAT=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, - "r_total_time_ms": "REPLACED", "table": { "update": 1, "table_name": "t2", @@ -771,11 +774,11 @@ ANALYZE Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 show analyze FORMAT=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, - "r_total_time_ms": "REPLACED", "table": { "update": 1, "table_name": "t2", @@ -790,7 +793,6 @@ ANALYZE "query_block": { "select_id": 2, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -824,11 +826,11 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show analyze FORMAT=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, - "r_total_time_ms": "REPLACED", "table": { "delete": 1, "table_name": "t2", @@ -864,11 +866,11 @@ ANALYZE Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 show analyze FORMAT=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, - "r_total_time_ms": "REPLACED", "table": { "delete": 1, "table_name": "t2", @@ -883,7 +885,6 @@ ANALYZE "query_block": { "select_id": 2, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -917,12 +918,12 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -966,12 +967,12 @@ ANALYZE Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -993,7 +994,6 @@ ANALYZE "query_block": { "select_id": 2, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -1017,12 +1017,12 @@ ANALYZE Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -1044,7 +1044,6 @@ ANALYZE "query_block": { "select_id": 2, "r_loops": 2, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "table": { @@ -1082,12 +1081,12 @@ set @show_explain_probe_select_id=1; select * from t0 order by a; connection default; show analyze format=JSON for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "nested_loop": [ { "read_sorted_file": { @@ -1138,12 +1137,12 @@ set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "temporary_table": { "nested_loop": [ { @@ -1184,12 +1183,12 @@ set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show analyze format=json for $thr2; -ANALYZE +SHOW ANALYZE { + "r_query_time_in_progress_ms": "REPLACED", "query_block": { "select_id": 1, "r_loops": 1, - "r_total_time_ms": "REPLACED", "temporary_table": { "nested_loop": [ { diff --git a/mysql-test/main/show_analyze_json.test b/mysql-test/main/show_analyze_json.test index 8c483364e24..bd12247ae16 100644 --- a/mysql-test/main/show_analyze_json.test +++ b/mysql-test/main/show_analyze_json.test @@ -125,7 +125,7 @@ SET debug_dbug=@old_debug; --echo # UNION, select, first branch set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -send select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9; +send select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9; connection default; --source include/wait_condition.inc --source include/analyze-format.inc @@ -137,7 +137,7 @@ reap; --echo # UNION, select, second branch set @show_explain_probe_select_id=2; # <--- Second branch SET debug_dbug='+d,show_explain_probe_join_exec_end'; -send select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9; +send select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9; connection default; --source include/wait_condition.inc --source include/analyze-format.inc @@ -149,7 +149,7 @@ reap; --echo # UNION, analyze, first branch set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -send analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9; +send analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9; connection default; --source include/wait_condition.inc --source include/analyze-format.inc @@ -160,7 +160,7 @@ reap; --echo # UNION, analyze, second branch set @show_explain_probe_select_id=2; -send analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9; +send analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9; connection default; --source include/wait_condition.inc --source include/analyze-format.inc @@ -173,7 +173,7 @@ SET debug_dbug=@old_debug; --echo # Uncorrelated subquery, select set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -send select a, (select max(a) from t0 B where a>6) from t0 A where a<2; +send select a, (select max(a) from t0 b where a>6) from t0 a where a<2; connection default; --source include/wait_condition.inc --source include/analyze-format.inc @@ -186,7 +186,7 @@ SET debug_dbug=@old_debug; --echo # Uncorrelated subquery, analyze set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_end'; -send analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2; +send analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2; connection default; --source include/wait_condition.inc --source include/analyze-format.inc @@ -365,4 +365,4 @@ drop table t0,t1; --echo # End connection default; disconnect con1; -set debug_sync='RESET';
\ No newline at end of file +set debug_sync='RESET'; diff --git a/mysql-test/main/show_explain.result b/mysql-test/main/show_explain.result index 3a40f14dca5..345fa928601 100644 --- a/mysql-test/main/show_explain.result +++ b/mysql-test/main/show_explain.result @@ -43,11 +43,6 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 999 Using where; Using index Warnings: Note 1003 select count(*) from t1 where a < 100000 -explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 999 Using where; Using index -Warnings: -Note 1003 select count(*) from t1 where a < 100000 connection con1; count(*) 1000 diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test index 612a875536b..36654e7bd9e 100644 --- a/mysql-test/main/show_explain.test +++ b/mysql-test/main/show_explain.test @@ -109,7 +109,6 @@ send select count(*) from t1 where a < 100000; connection default; --source include/wait_condition.inc evalp show explain for $thr2; -evalp explain for connection $thr2; connection con1; reap; diff --git a/mysql-test/main/show_explain_json.result b/mysql-test/main/show_explain_json.result index 7440c9d1341..191b41cea01 100644 --- a/mysql-test/main/show_explain_json.result +++ b/mysql-test/main/show_explain_json.result @@ -43,7 +43,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select count(*) from t1 where a < 100000; connection default; show explain FORMAT=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -73,7 +73,7 @@ count(*) select max(c) from t1 where a < 10; connection default; explain FORMAT=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -102,7 +102,7 @@ max(c) select max(c) from t1 where a < 10; connection default; explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -134,7 +134,7 @@ set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on'; explain select max(c) from t1 where a < 10; connection default; show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -165,7 +165,7 @@ id select_type table type possible_keys key key_len ref rows Extra explain select max(c) from t1 where a < 10; connection default; explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -200,7 +200,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; connection default; show explain format = JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "union_result": { @@ -256,7 +256,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; connection default; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "union_result": { @@ -374,7 +374,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -423,7 +423,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -472,7 +472,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -537,7 +537,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -571,7 +571,7 @@ EXPLAIN Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -613,7 +613,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -647,7 +647,7 @@ EXPLAIN Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -692,7 +692,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -726,7 +726,7 @@ EXPLAIN Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -771,7 +771,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -805,7 +805,7 @@ EXPLAIN Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -850,7 +850,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -889,7 +889,7 @@ EXPLAIN Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -928,7 +928,7 @@ EXPLAIN Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -982,7 +982,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -1021,7 +1021,7 @@ EXPLAIN Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -1060,7 +1060,7 @@ EXPLAIN Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 explain format=JSON for connection $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -1116,7 +1116,7 @@ set @show_explain_probe_select_id=1; select * from t0 order by a; connection default; show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -1165,7 +1165,7 @@ set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -1211,7 +1211,7 @@ set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show explain format=json for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, @@ -1260,7 +1260,7 @@ select * from t0 where length('ãû') = a; connection default; set names utf8; show explain format=JSON for $thr2; -EXPLAIN +SHOW EXPLAIN { "query_block": { "select_id": 1, diff --git a/mysql-test/suite/galera/r/MDEV-22458.result b/mysql-test/suite/galera/r/MDEV-22458.result index d1f9d94bd1c..7c853735641 100644 --- a/mysql-test/suite/galera/r/MDEV-22458.result +++ b/mysql-test/suite/galera/r/MDEV-22458.result @@ -4,7 +4,7 @@ CREATE TABLE t1 (a INT); connect con1,localhost,root,,test; INSERT INTO t1 VALUES (1),(2),(3),(4); SHOW EXPLAIN FOR $con1; -ERROR HY000: Target is not running an EXPLAINable command +ERROR HY000: Target is not executing an operation with a query plan connection con1; INSERT INTO t1 VALUES (5),(6),(7),(8); DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/max_program_zero.result b/mysql-test/suite/perfschema/r/max_program_zero.result index f236f149a77..5435efb34ae 100644 --- a/mysql-test/suite/perfschema/r/max_program_zero.result +++ b/mysql-test/suite/perfschema/r/max_program_zero.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 1 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result index 4224c3e520d..9489c1049e5 100644 --- a/mysql-test/suite/perfschema/r/ortho_iter.result +++ b/mysql-test/suite/perfschema/r/ortho_iter.result @@ -255,7 +255,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result index ab0d18e3227..94cc2b33b49 100644 --- a/mysql-test/suite/perfschema/r/privilege_table_io.result +++ b/mysql-test/suite/perfschema/r/privilege_table_io.result @@ -57,7 +57,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result index fda05bf6df5..bfc49fd3480 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result index 7db242f237f..e9f20398467 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result index 31ddb4eb3cd..ffb45f4f55f 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result index 2a2d42f4d51..e271d5a10e6 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result index 2115c747755..833da22583e 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result index 25b8a7b9c1f..e3ff0f514a7 100644 --- a/mysql-test/suite/perfschema/r/start_server_innodb.result +++ b/mysql-test/suite/perfschema/r/start_server_innodb.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_low_index.result b/mysql-test/suite/perfschema/r/start_server_low_index.result index b34f86da89f..ffdf9d65b87 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_index.result +++ b/mysql-test/suite/perfschema/r/start_server_low_index.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result index e8bf9f48da8..dbb404f6129 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result +++ b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result index 021ff9f9e3d..f92b0e6bec6 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_account.result +++ b/mysql-test/suite/perfschema/r/start_server_no_account.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index 0a7f1c601ef..fefad55c209 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index de4ff2f5a72..0c2f65f6ac9 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index 997220d3169..c3f06b53425 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index de81943afe8..fd39807d567 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result index ce156302b22..43111c5ec40 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_host.result +++ b/mysql-test/suite/perfschema/r/start_server_no_host.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_index.result b/mysql-test/suite/perfschema/r/start_server_no_index.result index d46095841c2..15d1184bcbe 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_index.result +++ b/mysql-test/suite/perfschema/r/start_server_no_index.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mdl.result b/mysql-test/suite/perfschema/r/start_server_no_mdl.result index c1f7e656dc6..b8de90453ce 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mdl.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result index 94c8a7da85a..60066264c90 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index e44307fdbe6..3353b46bbcb 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index 6647def50c1..d41da361733 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result index 9b5ad931858..4919de6bb6c 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result +++ b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index fdd3fe48bf3..02a119bdc68 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index 09faadaa4ce..ead01ce2d0e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result index 2d93be52186..a99f1c0f9be 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result index e9eff67712f..7c148889412 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result index f5b00a114dd..dec0680c511 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 0 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result index d1b3e14d349..20adf1a9f64 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 0 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result index 136c54885bf..044f9475041 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 0 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result index 3e2d7acf4ec..350f2c6637d 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result index 5db6987834b..d2d7063c32f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result index 69a69986a72..8bcb3c56a00 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result index 2f68483cfae..2a2bf5d3f7c 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result index 3d131f1a2e0..ec6e40acc00 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 0 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result index 95f8f226c41..b3f1e4cbcf2 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result index b54d6c762e1..baf9f761358 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index 9182677d8b8..cd204f3d811 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index ff90c471599..d083484cd7c 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result index 4535bcd02ed..f5a12e5473d 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result index f3eefb98a43..76ae9d5fa4e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result index 9ca79837845..4bd472a22a9 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_user.result +++ b/mysql-test/suite/perfschema/r/start_server_no_user.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result index ee22d5b5bed..f59b156ce1e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result index adbad8d166f..cc70572c7ef 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index 022f7d1096e..a53d591938c 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index 25b8a7b9c1f..e3ff0f514a7 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/start_server_variables.result b/mysql-test/suite/perfschema/r/start_server_variables.result index 65d3a7b55b5..7d1d1e05375 100644 --- a/mysql-test/suite/perfschema/r/start_server_variables.result +++ b/mysql-test/suite/perfschema/r/start_server_variables.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 10 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result index 264778c06e4..05ec7b0b2b5 100644 --- a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result +++ b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result @@ -135,7 +135,7 @@ performance_schema_max_socket_classes 10 performance_schema_max_socket_instances 1000 performance_schema_max_sql_text_length 1024 performance_schema_max_stage_classes 160 -performance_schema_max_statement_classes 221 +performance_schema_max_statement_classes 222 performance_schema_max_statement_stack 2 performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc index 60a08c86bf7..734ca1f8abb 100644 --- a/sql/sql_analyze_stmt.cc +++ b/sql/sql_analyze_stmt.cc @@ -33,7 +33,7 @@ void Filesort_tracker::print_json_members(Json_writer *writer) else writer->add_member("r_loops").add_ll(get_r_loops()); - if (get_r_loops() && time_tracker.timed) + if (time_tracker.has_timed_statistics()) { writer->add_member("r_total_time_ms"). add_double(time_tracker.get_time_ms()); diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h index 990c79fb9ad..f4d6f6f9dd2 100644 --- a/sql/sql_analyze_stmt.h +++ b/sql/sql_analyze_stmt.h @@ -93,6 +93,8 @@ public: return 1000.0 * static_cast<double>(cycles) / static_cast<double>(sys_timer_info.cycles.frequency); } + + bool has_timed_statistics() const { return cycles > 0; } }; diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index bef60b94249..914b83fc667 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -216,10 +216,14 @@ int Explain_query::print_explain(select_result_sink *output, int Explain_query::print_explain_json(select_result_sink *output, - bool is_analyze) + bool is_analyze, + ulonglong query_time_in_progress_ms) { Json_writer writer; writer.start_object(); + if (is_analyze && query_time_in_progress_ms > 0) + writer.add_member("r_query_time_in_progress_ms"). + add_ull(query_time_in_progress_ms); if (upd_del_plan) upd_del_plan->print_explain_json(this, &writer, is_analyze); @@ -935,7 +939,11 @@ void Explain_select::print_explain_json(Explain_query *query, if (is_analyze && time_tracker.get_loops()) { writer->add_member("r_loops").add_ll(time_tracker.get_loops()); - writer->add_member("r_total_time_ms").add_double(time_tracker.get_time_ms()); + if (time_tracker.has_timed_statistics()) + { + writer->add_member("r_total_time_ms"). + add_double(time_tracker.get_time_ms()); + } } if (exec_const_cond) @@ -2359,7 +2367,7 @@ void Explain_update::print_explain_json(Explain_query *query, writer->add_member("select_id").add_ll(1); /* This is the total time it took to do the UPDATE/DELETE */ - if (is_analyze && command_tracker.get_loops()) + if (is_analyze && command_tracker.has_timed_statistics()) { writer->add_member("r_total_time_ms"). add_double(command_tracker.get_time_ms()); @@ -2506,7 +2514,7 @@ void Explain_update::print_explain_json(Explain_query *query, writer->add_member("r_filtered").add_double(r_filtered); } - if (table_tracker.get_loops()) + if (table_tracker.has_timed_statistics()) { writer->add_member("r_total_time_ms"). add_double(table_tracker.get_time_ms()); diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 94d0f667cf9..f908e2e4221 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -478,7 +478,8 @@ public: /* Return tabular EXPLAIN output as a text string */ bool print_explain_str(THD *thd, String *out_str, bool is_analyze); - int print_explain_json(select_result_sink *output, bool is_analyze); + int print_explain_json(select_result_sink *output, bool is_analyze, + ulonglong query_time_in_progress_ms= 0); /* If true, at least part of EXPLAIN can be printed */ bool have_query_plan() { return insert_plan || upd_del_plan|| get_node(1) != NULL; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index d027fafe39c..3da7b656c02 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -5827,9 +5827,20 @@ int LEX::print_explain(select_result_sink *output, uint8 explain_flags, if (explain && explain->have_query_plan()) { if (is_json_format) - res= explain->print_explain_json(output, is_analyze); + { + auto now= microsecond_interval_timer(); + auto start_time= thd->start_utime; + auto query_time_in_progress_ms= 0ULL; + if (likely(now > start_time)) + query_time_in_progress_ms= + (now - start_time) / (HRTIME_RESOLUTION / 1000); + res= explain->print_explain_json(output, is_analyze, + query_time_in_progress_ms); + } else + { res= explain->print_explain(output, explain_flags, is_analyze); + } *printed_anything= true; } else diff --git a/sql/sql_lex.h b/sql/sql_lex.h index ca8d22fd23a..a6e7546d38c 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3795,14 +3795,9 @@ public: bool save_prep_leaf_tables(); int print_explain(select_result_sink *output, uint8 explain_flags, -<<<<<<< HEAD - bool is_analyze, bool *printed_anything); - bool restore_set_statement_var(); -======= bool is_analyze, bool is_json_format, bool *printed_anything); - void restore_set_statement_var(); ->>>>>>> 54281b6e74e... MDEV-10000 Add EXPLAIN [FORMAT=JSON] FOR CONNECTION syntax support + bool restore_set_statement_var(); void init_last_field(Column_definition *field, const LEX_CSTRING *name); bool last_field_generated_always_as_row_start_or_end(Lex_ident *p, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8746d442fe8..41e26c85077 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9672,7 +9672,7 @@ ST_FIELD_INFO show_explain_tabular_fields_info[]= ST_FIELD_INFO show_explain_json_fields_info[]= { - Column("EXPLAIN", Longtext(MAX_FIELD_VARCHARLENGTH), NOT_NULL, "EXPLAIN"), + Column("EXPLAIN", Longtext(MAX_FIELD_VARCHARLENGTH), NOT_NULL, "SHOW EXPLAIN"), CEnd() }; @@ -9701,7 +9701,7 @@ ST_FIELD_INFO show_analyze_tabular_fields_info[]= ST_FIELD_INFO show_analyze_json_fields_info[]= { - Column("EXPLAIN", Longtext(MAX_FIELD_VARCHARLENGTH), NOT_NULL, "ANALYZE"), + Column("ANALYZE", Longtext(MAX_FIELD_VARCHARLENGTH), NOT_NULL, "SHOW ANALYZE"), CEnd()}; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8f4f7ccefc3..b86f49e7f2e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -14134,6 +14134,16 @@ explain_for_connection: */ describe_command opt_format_json FOR_SYM CONNECTION_SYM expr { + LEX *lex=Lex; + lex->wild=0; + lex->ident= null_clex_str; + if (Lex->main_select_push()) + MYSQL_YYABORT; + mysql_init_select(lex); + lex->current_select->parsing_place= SELECT_LIST; + lex->create_info.init(); + Select->parsing_place= NO_MATTER; + Lex->pop_select(); //main select Lex->sql_command= SQLCOM_SHOW_EXPLAIN; if (unlikely(prepare_schema_table(thd, Lex, 0, Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR))) |