Commit 213772f9 authored by Sergei Petrunia's avatar Sergei Petrunia

Revert the commit with MDEV-28926: Add time spent on query optimizer to JSON ANALYZE

It will go into 10.11.

Author: Luis Eduardo Oliveira Lizardo <108760288+mariadb-LuisLizardo@users.noreply.github.com>
Date:   Mon Jul 18 17:48:01 2022 +0200

    MDEV-28926 Add time spent on query optimizer to JSON ANALYZE (#2193)

    * Add query optimizer timer to ANALYZE FORMAT=JSON

    * Adapt tests and results

    * Change logic to always close the writer after printing query blocks
parent 2ccdfba8
......@@ -5,9 +5,6 @@ INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
analyze format=json select * from t0 where a<3;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -41,9 +38,6 @@ analyze format=json
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -91,9 +85,6 @@ analyze format=json
select * from t0, t1 where t1.a=t0.a and t1.b<4;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -144,9 +135,6 @@ analyze format=json
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -193,9 +181,6 @@ analyze format=json
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -251,9 +236,6 @@ insert into t2 values (0),(1);
analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -312,9 +294,6 @@ NULL
analyze format=json select * from test.t1 where t1.a<5;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -355,9 +334,6 @@ analyze format=json
update t1 set b=pk;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......@@ -376,9 +352,6 @@ analyze format=json
select * from t1 where pk < 10 and b > 4;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -410,9 +383,6 @@ analyze format=json
delete from t1 where pk < 10 and b > 4;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......@@ -456,9 +426,6 @@ select * from t1, t2 where (t2.key1 between t1.lb1 and t1.rb1) and
(t2.key3=t1.c1 OR t2.key4=t1.c2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -518,9 +485,6 @@ INSERT INTO t1 select * from t0;
analyze format=json (select * from t1 tbl1 where a<5) union (select * from t1 tbl2 where a in (2,3));
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -597,9 +561,6 @@ insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
analyze format=json select a, max(b) as TOP from t2 group by a having TOP > a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -637,9 +598,6 @@ ANALYZE
analyze format=json select a, max(b) as TOP from t2 group by a having 1<>2;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -676,9 +634,6 @@ ANALYZE
analyze format=json select a, max(b) as TOP from t2 group by a having 1=2;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -690,9 +645,6 @@ ANALYZE
analyze format=json select a, max(b) as TOP from t2 group by a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -736,9 +688,6 @@ INSERT INTO t2 VALUES (3),(4);
ANALYZE FORMAT=JSON SELECT STRAIGHT_JOIN * FROM t1, t2 WHERE b IN ( SELECT a FROM t1 );
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -822,9 +771,6 @@ WHERE f3 IN ( 1, 2 )
GROUP BY sq ORDER BY gc;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -942,9 +888,6 @@ create table t2 as select * from t1;
analyze format=json select a, (select t2.b from t2 where t2.a<t1.a order by t2.c limit 1) from t1 where t1.a<0;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -35,9 +35,6 @@ analyze format=json
update t2 set b=b+1 order by b limit 5;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......@@ -92,9 +89,6 @@ analyze format=json
update t2 set a=a+1 where a<10;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......@@ -143,9 +137,6 @@ analyze format=json
delete from t2 order by b limit 5;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......@@ -217,9 +208,6 @@ analyze format=json
select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -320,9 +308,6 @@ analyze format=json
select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -391,9 +376,6 @@ analyze format=json
select MAX(b) from t2 where mod(a,2)=0 group by c;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -454,9 +436,6 @@ analyze format=json
select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -521,9 +500,6 @@ where t5.a=t6.a and t6.b > 0 and t5.a <= 5
group by t5.a order by sum limit 1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -659,9 +635,6 @@ analyze format=json
select col1 f1, col2 f2, col1 f3 from t2 group by f1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -2455,9 +2455,6 @@ select counter+1 from src where counter<10
) select * from src;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -3864,9 +3861,6 @@ where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2'
select a2 from cte);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -4126,9 +4120,6 @@ select t1.* from t1, r_cte as r where t1.c = r.a )
select 0 as b FROM dual union all select b FROM r_cte as t;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -4294,9 +4285,6 @@ select 0 as b FROM dual union all select b FROM r_cte as t)
select * from t1 as tt;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -19643,9 +19643,6 @@ CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4);
ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -72,9 +72,6 @@ EXPLAIN
ANALYZE format=json (select a,b from t1) except (select c,d from t2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<except1,2>",
......@@ -134,9 +131,6 @@ ANALYZE
ANALYZE format=json select * from ((select a,b from t1) except (select c,d from t2)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -342,9 +336,6 @@ EXPLAIN
ANALYZE format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<except1,2>",
......@@ -443,9 +434,6 @@ ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except
(select c,d,g,h from t2,t4)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -115,9 +115,6 @@ Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2
ANALYZE format=json select * from ((select a,b from t1) except all (select c,d from t2)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -199,9 +196,6 @@ ANALYZE
ANALYZE format=json select * from ((select a from t1) except all (select c from t2)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -469,9 +463,6 @@ EXPLAIN
ANALYZE format=json (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<except1,2>",
......@@ -569,9 +560,6 @@ ANALYZE
ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -1148,9 +1148,6 @@ EXPLAIN
analyze format=json select count(distinct b) from t1 group by a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1449,9 +1446,6 @@ analyze format=json
select * from t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -1503,9 +1497,6 @@ analyze format=json
select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1585,9 +1576,6 @@ analyze format=json
select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1676,9 +1664,6 @@ analyze format=json
select distinct t1.a from t1 join t2 on t2.pk=t1.a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1785,9 +1770,6 @@ analyze format=json
select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -329,7 +329,6 @@ explain
select * from t1;
explain format=json
select * from t1;
--source include/analyze-format.inc
analyze format=json
select * from t1;
drop table t1;
......
......@@ -29,9 +29,6 @@ EXPLAIN
analyze format=json select * from t1 where a in (2,3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -58,9 +55,6 @@ ANALYZE
analyze format=json update t1 set a=a+10 where a in (2,3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......@@ -82,9 +76,6 @@ ANALYZE
analyze format=json delete from t1 where a in (20,30,40);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_total_time_ms": "REPLACED",
......
......@@ -102,9 +102,6 @@ EXPLAIN
ANALYZE format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<intersect1,2,3>",
......@@ -187,9 +184,6 @@ ANALYZE
ANALYZE format=json select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -394,9 +388,6 @@ EXPLAIN
ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<intersect1,2>",
......@@ -475,9 +466,6 @@ ANALYZE
ANALYZE format=json select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -114,9 +114,6 @@ EXPLAIN
ANALYZE format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<intersect1,2,3>",
......@@ -199,9 +196,6 @@ ANALYZE
ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -425,9 +419,6 @@ EXPLAIN
ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<intersect1,2>",
......@@ -506,9 +497,6 @@ ANALYZE
ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -3396,9 +3396,6 @@ INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -3753,9 +3750,6 @@ insert into t1 select seq, seq, seq from seq_1_to_100;
ANALYZE FORMAT=JSON select * from t1 order by a,b,c;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -3919,9 +3913,6 @@ analyze format=json
select a, substr(b, @save_max_sort_length+1) from t1 order by b desc;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -3968,9 +3959,6 @@ insert into t1 values ('def', 4, 4) , ('efg', 5, 5), ('fgh', 6, 6);
ANALYZE FORMAT=JSON select a, b, c from t1 order by a, b;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -4023,9 +4011,6 @@ Warning 1292 Truncated incorrect max_sort_length value: '5'
ANALYZE FORMAT=JSON select a, b, c from t1 order by a, b;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -4092,9 +4077,6 @@ a b
analyze format=json select * from t1 order by a;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -4274,9 +4256,6 @@ ANALYZE FORMAT=JSON
SELECT (SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a) FROM t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -89,9 +89,6 @@ FROM t3
GROUP BY x;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -253,9 +250,6 @@ FROM t3
GROUP BY x;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -415,9 +409,6 @@ set sort_buffer_size= 2097152;
ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -471,9 +462,6 @@ set sort_buffer_size= 1097152;
ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -113,9 +113,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
l_quantity > 45;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -259,9 +256,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
l_quantity > 45;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -425,9 +419,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -570,9 +561,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -725,9 +713,6 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -896,9 +881,6 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1045,9 +1027,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1216,9 +1195,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1392,9 +1368,6 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND
o_totalprice BETWEEN 200000 AND 250000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1529,9 +1502,6 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND
o_totalprice BETWEEN 200000 AND 250000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1672,9 +1642,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1810,9 +1777,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1956,9 +1920,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -2104,9 +2065,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -116,9 +116,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
l_quantity > 45;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -262,9 +259,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
l_quantity > 45;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -421,9 +415,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -556,9 +547,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -704,9 +692,6 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -863,9 +848,6 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1005,9 +987,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1166,9 +1145,6 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
o_totalprice between 200000 and 230000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1343,9 +1319,6 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND
o_totalprice BETWEEN 200000 AND 250000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1480,9 +1453,6 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND
o_totalprice BETWEEN 200000 AND 250000;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1623,9 +1593,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1761,9 +1728,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1907,9 +1871,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -2055,9 +2016,6 @@ o_totalprice BETWEEN 200000 AND 220000 AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -3094,9 +3052,6 @@ fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -400,9 +400,6 @@ ANALYZE format=json
SELECT 1 FROM t1 GROUP BY convert_tz('1969-12-31 22:00:00',a,'+10:00');
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -39,9 +39,6 @@ show analyze format=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -72,9 +69,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -106,9 +100,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -147,9 +138,6 @@ show analyze FORMAT= json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -216,9 +204,6 @@ show analyze format=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -286,9 +271,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -358,9 +340,6 @@ show analyze FORMAT=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -436,9 +415,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -496,9 +472,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -562,9 +535,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"nested_loop": [
......@@ -624,9 +594,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -688,9 +655,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -773,9 +737,6 @@ show analyze FORMAT=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -816,9 +777,6 @@ show analyze FORMAT=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -871,9 +829,6 @@ show analyze FORMAT=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -914,9 +869,6 @@ show analyze FORMAT=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -969,9 +921,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1021,9 +970,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1074,9 +1020,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1141,9 +1084,6 @@ show analyze format=JSON for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1200,9 +1140,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -1249,9 +1186,6 @@ show analyze format=json for $thr2;
SHOW ANALYZE
{
"r_query_time_in_progress_ms": "REPLACED",
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -2917,9 +2917,6 @@ SELECT DISTINCT
FROM t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -44,9 +44,6 @@ analyze format=json
select a, (select d from t2 where b=c) from t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......@@ -101,9 +98,6 @@ analyze format=json
select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -1667,9 +1667,6 @@ analyze format=json
values (1,2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -1716,9 +1713,6 @@ union
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1753,9 +1747,6 @@ union
select 1,2;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1790,9 +1781,6 @@ union
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1840,9 +1828,6 @@ union
values (1,2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2,3>",
......@@ -1909,9 +1894,6 @@ union all
select 1,2;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -1942,9 +1924,6 @@ union
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1979,9 +1958,6 @@ union all
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -2024,9 +2000,6 @@ union all
values (1,2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......
......@@ -932,7 +932,6 @@ values (1,2);
analyze
values (1,2);
--source include/analyze-format.inc
analyze format=json
values (1,2);
......@@ -953,19 +952,16 @@ values (5,6)
union
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
select 1,2
union
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
values (1,2),(3,4)
union
select 1,2;
--source include/analyze-format.inc
analyze format=json
values (5,6)
union
......@@ -978,7 +974,6 @@ values (3,4)
union
values (1,2);
--source include/analyze-format.inc
analyze format=json
select 1,2
union
......@@ -1003,19 +998,16 @@ values (1,2)
union all
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
values (1,2),(3,4)
union all
select 1,2;
--source include/analyze-format.inc
analyze format=json
select 1,2
union
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
values (1,2)
union all
......@@ -1028,7 +1020,6 @@ values (3,4)
union all
values (1,2);
--source include/analyze-format.inc
analyze format=json
select 1,2
union all
......
......@@ -3822,9 +3822,6 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -1665,9 +1665,6 @@ analyze format=json
values (1,2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -1714,9 +1711,6 @@ union
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1751,9 +1745,6 @@ union
select 1,2;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1788,9 +1779,6 @@ union
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1838,9 +1826,6 @@ union
values (1,2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2,3>",
......@@ -1907,9 +1892,6 @@ union all
select 1,2;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -1940,9 +1922,6 @@ union
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"table_name": "<union1,2>",
......@@ -1977,9 +1956,6 @@ union all
values (1,2),(3,4);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......@@ -2022,9 +1998,6 @@ union all
values (1,2);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"union_result": {
"query_specifications": [
......
......@@ -934,7 +934,6 @@ values (1,2);
analyze
values (1,2);
--source include/analyze-format.inc
analyze format=json
values (1,2);
......@@ -955,19 +954,16 @@ values (5,6)
union
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
select 1,2
union
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
values (1,2),(3,4)
union
select 1,2;
--source include/analyze-format.inc
analyze format=json
values (5,6)
union
......@@ -980,7 +976,6 @@ values (3,4)
union
values (1,2);
--source include/analyze-format.inc
analyze format=json
select 1,2
union
......@@ -1005,19 +1000,16 @@ values (1,2)
union all
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
values (1,2),(3,4)
union all
select 1,2;
--source include/analyze-format.inc
analyze format=json
select 1,2
union
values (1,2),(3,4);
--source include/analyze-format.inc
analyze format=json
values (1,2)
union all
......@@ -1030,7 +1022,6 @@ values (3,4)
union all
values (1,2);
--source include/analyze-format.inc
analyze format=json
select 1,2
union all
......
......@@ -3828,9 +3828,6 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -117,9 +117,6 @@ ANALYZE FORMAT=JSON
SELECT id FROM federated.t1 WHERE id < 5;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"table": {
......@@ -226,9 +223,6 @@ FROM federated.t2 GROUP BY name)) t
WHERE federated.t3.name=t.name;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"r_loops": 1,
......
......@@ -44,10 +44,9 @@ static void append_item_to_str(String *out, Item *item, bool no_tmp_tbl);
Explain_query::Explain_query(THD *thd_arg, MEM_ROOT *root) :
mem_root(root), upd_del_plan(nullptr), insert_plan(nullptr),
unions(root), selects(root), stmt_thd(thd_arg), apc_enabled(false),
unions(root), selects(root), stmt_thd(thd_arg), apc_enabled(false),
operations(0)
{
optimization_time_tracker.start_tracking(stmt_thd);
}
static void print_json_array(Json_writer *writer,
......@@ -155,8 +154,6 @@ void Explain_query::add_upd_del_plan(Explain_update *upd_del_plan_arg)
void Explain_query::query_plan_ready()
{
optimization_time_tracker.stop_tracking(stmt_thd);
if (!apc_enabled)
stmt_thd->apc_target.enable();
apc_enabled= true;
......@@ -259,80 +256,44 @@ int Explain_query::print_explain_json(select_result_sink *output,
#endif
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 we are printing ANALYZE FORMAT=JSON output, take into account that
query's temporary tables have already been freed. See sql_explain.h,
sql_explain.h:ExplainDataStructureLifetime for details.
*/
if (is_analyze)
{
if (query_time_in_progress_ms > 0){
writer.add_member("r_query_time_in_progress_ms").
add_ull(query_time_in_progress_ms);
}
print_query_optimization_json(&writer);
is_show_cmd = true;
}
bool plan_found = print_query_blocks_json(&writer, is_analyze, is_show_cmd);
writer.end_object();
if( plan_found )
{
send_explain_json_to_output(&writer, output);
}
return 0;
}
is_show_cmd= true;
void Explain_query::print_query_optimization_json(Json_writer *writer)
{
if (optimization_time_tracker.has_timed_statistics())
{
// if more timers are added, move the query_optimization member
// outside the if statement
writer->add_member("query_optimization").start_object();
writer->add_member("r_total_time_ms").
add_double(optimization_time_tracker.get_time_ms());
writer->end_object();
}
}
bool Explain_query::print_query_blocks_json(Json_writer *writer,
const bool is_analyze,
const bool is_show_cmd)
{
if (upd_del_plan)
upd_del_plan->print_explain_json(this, writer, is_analyze, is_show_cmd);
upd_del_plan->print_explain_json(this, &writer, is_analyze, is_show_cmd);
else if (insert_plan)
insert_plan->print_explain_json(this, writer, is_analyze, is_show_cmd);
insert_plan->print_explain_json(this, &writer, is_analyze, is_show_cmd);
else
{
/* Start printing from root node with id=1 */
/* Start printing from node with id=1 */
Explain_node *node= get_node(1);
if (!node)
return false; /* No query plan */
node->print_explain_json(this, writer, is_analyze, is_show_cmd);
return 1; /* No query plan */
node->print_explain_json(this, &writer, is_analyze, is_show_cmd);
}
return true;
}
writer.end_object();
void Explain_query::send_explain_json_to_output(Json_writer *writer,
select_result_sink *output)
{
CHARSET_INFO *cs= system_charset_info;
List<Item> item_list;
const String *buf= writer->output.get_string();
const String *buf= writer.output.get_string();
THD *thd= output->thd;
item_list.push_back(new (thd->mem_root)
Item_string(thd, buf->ptr(), buf->length(), cs),
thd->mem_root);
output->send_data(item_list);
}
return 0;
}
bool print_explain_for_slow_log(LEX *lex, THD *thd, String *str)
{
......
......@@ -512,10 +512,6 @@ class Explain_query : public Sql_alloc
Explain_update *get_upd_del_plan() { return upd_del_plan; }
private:
bool print_query_blocks_json(Json_writer *writer, const bool is_analyze, const bool is_show_cmd);
void print_query_optimization_json(Json_writer *writer);
void send_explain_json_to_output(Json_writer *writer, select_result_sink *output);
/* Explain_delete inherits from Explain_update */
Explain_update *upd_del_plan;
......@@ -537,8 +533,6 @@ class Explain_query : public Sql_alloc
#ifndef DBUG_OFF
bool can_print_json= false;
#endif
Exec_time_tracker optimization_time_tracker;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment