Commit ffe0beca authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-30032: EXPLAIN FORMAT=JSON output: print costs

Basic printout for join and table execution costs.
parent 657868f5
# The time on ANALYSE FORMAT=JSON is rather variable # 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|r_query_time_in_progress_ms|r_unpack_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|r_unpack_time_ms|cost)": )[^, \n]*/\1"REPLACED"/
--replace_regex /("(filtered|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|r_unpack_time_ms|cost)": )[^, \n]*/\1"REPLACED"/
--replace_regex /("(cost|filtered)": )[^, \n]*/\1"REPLACED"/
--replace_regex /("(cost)": )[^, \n]*/\1"COST_REPLACED"/
This diff is collapsed.
...@@ -154,6 +154,7 @@ drop table t0, t1; ...@@ -154,6 +154,7 @@ drop table t0, t1;
--echo # --echo #
--echo # MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING --echo # MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
--source include/explain-no-costs.inc
--echo # --echo #
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3); insert into t0 values (0),(1),(2),(3);
......
...@@ -182,6 +182,7 @@ EXPLAIN ...@@ -182,6 +182,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t2.b", "sort_key": "t2.b",
"temporary_table": { "temporary_table": {
...@@ -191,6 +192,7 @@ EXPLAIN ...@@ -191,6 +192,7 @@ EXPLAIN
"table_name": "t0", "table_name": "t0",
"access_type": "ALL", "access_type": "ALL",
"rows": 10, "rows": 10,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t0.a is not null" "attached_condition": "t0.a is not null"
} }
...@@ -205,6 +207,7 @@ EXPLAIN ...@@ -205,6 +207,7 @@ EXPLAIN
"used_key_parts": ["a"], "used_key_parts": ["a"],
"ref": ["test.t0.a"], "ref": ["test.t0.a"],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -222,6 +225,7 @@ ANALYZE ...@@ -222,6 +225,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"filesort": { "filesort": {
...@@ -241,6 +245,7 @@ ANALYZE ...@@ -241,6 +245,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 10, "rows": 10,
"r_rows": 10, "r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -260,6 +265,7 @@ ANALYZE ...@@ -260,6 +265,7 @@ ANALYZE
"r_loops": 10, "r_loops": 10,
"rows": 1, "rows": 1,
"r_rows": 0.4, "r_rows": 0.4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -285,6 +291,7 @@ EXPLAIN ...@@ -285,6 +291,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"read_sorted_file": { "read_sorted_file": {
...@@ -294,6 +301,7 @@ EXPLAIN ...@@ -294,6 +301,7 @@ EXPLAIN
"table_name": "t0", "table_name": "t0",
"access_type": "ALL", "access_type": "ALL",
"rows": 10, "rows": 10,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t0.a is not null" "attached_condition": "t0.a is not null"
} }
...@@ -310,6 +318,7 @@ EXPLAIN ...@@ -310,6 +318,7 @@ EXPLAIN
"used_key_parts": ["a"], "used_key_parts": ["a"],
"ref": ["test.t0.a"], "ref": ["test.t0.a"],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -325,6 +334,7 @@ ANALYZE ...@@ -325,6 +334,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -345,6 +355,7 @@ ANALYZE ...@@ -345,6 +355,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 10, "rows": 10,
"r_rows": 10, "r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -366,6 +377,7 @@ ANALYZE ...@@ -366,6 +377,7 @@ ANALYZE
"r_loops": 10, "r_loops": 10,
"rows": 1, "rows": 1,
"r_rows": 0.4, "r_rows": 0.4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -396,6 +408,7 @@ ANALYZE ...@@ -396,6 +408,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"filesort": { "filesort": {
...@@ -415,6 +428,7 @@ ANALYZE ...@@ -415,6 +428,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 1000, "rows": 1000,
"r_rows": 1000, "r_rows": 1000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -459,6 +473,7 @@ ANALYZE ...@@ -459,6 +473,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"duplicate_removal": { "duplicate_removal": {
...@@ -471,6 +486,7 @@ ANALYZE ...@@ -471,6 +486,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 10, "rows": 10,
"r_rows": 10, "r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -485,6 +501,7 @@ ANALYZE ...@@ -485,6 +501,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 10, "rows": 10,
"r_rows": 10, "r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -527,6 +544,7 @@ ANALYZE ...@@ -527,6 +544,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"filesort": { "filesort": {
...@@ -555,6 +573,7 @@ ANALYZE ...@@ -555,6 +573,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 5, "rows": 5,
"r_rows": 5, "r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -570,6 +589,7 @@ ANALYZE ...@@ -570,6 +589,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 7, "rows": 7,
"r_rows": 7, "r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -598,6 +618,7 @@ EXPLAIN ...@@ -598,6 +618,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "count(distinct t5.b)", "sort_key": "count(distinct t5.b)",
"temporary_table": { "temporary_table": {
...@@ -610,6 +631,7 @@ EXPLAIN ...@@ -610,6 +631,7 @@ EXPLAIN
"table_name": "t6", "table_name": "t6",
"access_type": "ALL", "access_type": "ALL",
"rows": 5, "rows": 5,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t6.b > 0 and t6.a <= 5" "attached_condition": "t6.b > 0 and t6.a <= 5"
} }
...@@ -620,6 +642,7 @@ EXPLAIN ...@@ -620,6 +642,7 @@ EXPLAIN
"table_name": "t5", "table_name": "t5",
"access_type": "ALL", "access_type": "ALL",
"rows": 7, "rows": 7,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
}, },
"buffer_type": "flat", "buffer_type": "flat",
...@@ -666,6 +689,7 @@ ANALYZE ...@@ -666,6 +689,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -679,6 +703,7 @@ ANALYZE ...@@ -679,6 +703,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 7, "rows": 7,
"r_rows": 20, "r_rows": 20,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
......
...@@ -21,6 +21,7 @@ insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B; ...@@ -21,6 +21,7 @@ insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
--echo # --echo #
explain explain
update t2 set b=b+1 order by b limit 5; update t2 set b=b+1 order by b limit 5;
--source include/explain-no-costs.inc
explain format=json explain format=json
update t2 set b=b+1 order by b limit 5; update t2 set b=b+1 order by b limit 5;
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -32,6 +33,7 @@ update t2 set b=b+1 order by b limit 5; ...@@ -32,6 +33,7 @@ update t2 set b=b+1 order by b limit 5;
--echo # --echo #
explain explain
update t2 set a=a+1 where a<10; update t2 set a=a+1 where a<10;
--source include/explain-no-costs.inc
explain format=json explain format=json
update t2 set a=a+1 where a<10; update t2 set a=a+1 where a<10;
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -43,6 +45,7 @@ update t2 set a=a+1 where a<10; ...@@ -43,6 +45,7 @@ update t2 set a=a+1 where a<10;
--echo # --echo #
explain explain
delete from t2 order by b limit 5; delete from t2 order by b limit 5;
--source include/explain-no-costs.inc
explain format=json explain format=json
delete from t2 order by b limit 5; delete from t2 order by b limit 5;
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -54,6 +57,7 @@ delete from t2 order by b limit 5; ...@@ -54,6 +57,7 @@ delete from t2 order by b limit 5;
--echo # --echo #
explain explain
select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
--source include/explain-no-costs.inc
explain format=json explain format=json
select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -66,6 +70,7 @@ select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; ...@@ -66,6 +70,7 @@ select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
--echo # --echo #
explain explain
select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
--source include/explain-no-costs.inc
explain format=json explain format=json
select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -143,6 +148,7 @@ select count(distinct t5.b) as sum from t5, t6 ...@@ -143,6 +148,7 @@ select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= 5 where t5.a=t6.a and t6.b > 0 and t5.a <= 5
group by t5.a order by sum limit 1; group by t5.a order by sum limit 1;
--source include/explain-no-costs.inc
explain format=json explain format=json
select count(distinct t5.b) as sum from t5, t6 select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= 5 where t5.a=t6.a and t6.b > 0 and t5.a <= 5
......
...@@ -261,6 +261,7 @@ EXPLAIN ...@@ -261,6 +261,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"read_sorted_file": { "read_sorted_file": {
...@@ -270,6 +271,7 @@ EXPLAIN ...@@ -270,6 +271,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 3, "rows": 3,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -291,6 +293,7 @@ EXPLAIN ...@@ -291,6 +293,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"read_sorted_file": { "read_sorted_file": {
...@@ -300,6 +303,7 @@ EXPLAIN ...@@ -300,6 +303,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 3, "rows": 3,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -329,12 +333,14 @@ EXPLAIN ...@@ -329,12 +333,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 3, "rows": 3,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.a = 20" "attached_condition": "t1.a = 20"
} }
...@@ -346,12 +352,14 @@ EXPLAIN ...@@ -346,12 +352,14 @@ EXPLAIN
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "UNION", "operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 3, "rows": 3,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -383,12 +391,14 @@ EXPLAIN ...@@ -383,12 +391,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 3, "rows": 3,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.a = 20" "attached_condition": "t1.a = 20"
} }
...@@ -400,12 +410,14 @@ EXPLAIN ...@@ -400,12 +410,14 @@ EXPLAIN
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "UNION", "operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 3, "rows": 3,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -445,6 +457,7 @@ EXPLAIN ...@@ -445,6 +457,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"read_sorted_file": { "read_sorted_file": {
...@@ -454,6 +467,7 @@ EXPLAIN ...@@ -454,6 +467,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 5, "rows": 5,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -466,12 +480,14 @@ EXPLAIN ...@@ -466,12 +480,14 @@ EXPLAIN
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "UNION", "operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 5, "rows": 5,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.pk > 4" "attached_condition": "t1.pk > 4"
} }
......
...@@ -117,24 +117,28 @@ let $q1= ...@@ -117,24 +117,28 @@ let $q1=
select a from t1 order by a desc limit 1; select a from t1 order by a desc limit 1;
eval $q1; eval $q1;
eval explain extended $q1; eval explain extended $q1;
--source include/explain-no-costs.inc
eval explain format=json $q1; eval explain format=json $q1;
let $q2= let $q2=
(select a from t1 order by a desc) limit 1; (select a from t1 order by a desc) limit 1;
eval $q2; eval $q2;
eval explain extended $q2; eval explain extended $q2;
--source include/explain-no-costs.inc
eval explain format=json $q2; eval explain format=json $q2;
let $q1= let $q1=
(select a from t1 where a=20 union select a from t1) order by a desc limit 1; (select a from t1 where a=20 union select a from t1) order by a desc limit 1;
eval $q1; eval $q1;
eval explain extended $q1; eval explain extended $q1;
--source include/explain-no-costs.inc
eval explain format=json $q1; eval explain format=json $q1;
let $q2= let $q2=
((select a from t1 where a=20 union select a from t1) order by a desc) limit 1; ((select a from t1 where a=20 union select a from t1) order by a desc) limit 1;
eval $q2; eval $q2;
eval explain extended $q2; eval explain extended $q2;
--source include/explain-no-costs.inc
eval explain format=json $q2; eval explain format=json $q2;
drop table t1; drop table t1;
...@@ -150,6 +154,7 @@ let $q= ...@@ -150,6 +154,7 @@ let $q=
((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4); ((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4);
eval $q; eval $q;
eval explain extended $q; eval explain extended $q;
--source include/explain-no-costs.inc
eval explain format=json $q; eval explain format=json $q;
drop table t1; drop table t1;
......
This diff is collapsed.
...@@ -1110,6 +1110,7 @@ as ...@@ -1110,6 +1110,7 @@ as
) )
select ancestors.name, ancestors.dob from ancestors; select ancestors.name, ancestors.dob from ancestors;
--source include/explain-no-costs.inc
explain FORMAT=JSON explain FORMAT=JSON
with recursive with recursive
prev_gen prev_gen
...@@ -1139,6 +1140,7 @@ as ...@@ -1139,6 +1140,7 @@ as
select ancestors.name, ancestors.dob from ancestors; select ancestors.name, ancestors.dob from ancestors;
--echo # --echo #
--source include/explain-no-costs.inc
explain format=json explain format=json
with recursive with recursive
ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
...@@ -1343,6 +1345,7 @@ drop table folks; ...@@ -1343,6 +1345,7 @@ drop table folks;
create table t1(a int); create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
--source include/explain-no-costs.inc
explain format=json explain format=json
with recursive t as (select a from t1 union select a+10 from t where a < 1000) with recursive t as (select a from t1 union select a+10 from t where a < 1000)
select * from t; select * from t;
......
This diff is collapsed.
...@@ -381,12 +381,14 @@ EXPLAIN ...@@ -381,12 +381,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t2", "table_name": "t2",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t2.f2 in (2,3) and t2.f2 is not null" "attached_condition": "t2.f2 in (2,3) and t2.f2 is not null"
} }
...@@ -401,10 +403,12 @@ EXPLAIN ...@@ -401,10 +403,12 @@ EXPLAIN
"used_key_parts": ["f1"], "used_key_parts": ["f1"],
"ref": ["test.t2.f2"], "ref": ["test.t2.f2"],
"rows": 2, "rows": 2,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -414,6 +418,7 @@ EXPLAIN ...@@ -414,6 +418,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 in (2,3)" "attached_condition": "t1.f1 in (2,3)"
} }
...@@ -485,16 +490,19 @@ EXPLAIN ...@@ -485,16 +490,19 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "<derived2>", "table_name": "<derived2>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "tt.f1", "sort_key": "tt.f1",
"temporary_table": { "temporary_table": {
...@@ -504,11 +512,13 @@ EXPLAIN ...@@ -504,11 +512,13 @@ EXPLAIN
"table_name": "<derived3>", "table_name": "<derived3>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "tt.f1 > 2", "attached_condition": "tt.f1 > 2",
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -518,6 +528,7 @@ EXPLAIN ...@@ -518,6 +528,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2" "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
} }
...@@ -566,17 +577,20 @@ EXPLAIN ...@@ -566,17 +577,20 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "<derived3>", "table_name": "<derived3>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null", "attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null",
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -586,6 +600,7 @@ EXPLAIN ...@@ -586,6 +600,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2" "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
} }
...@@ -607,10 +622,12 @@ EXPLAIN ...@@ -607,10 +622,12 @@ EXPLAIN
"used_key_parts": ["f1"], "used_key_parts": ["f1"],
"ref": ["tt.f1"], "ref": ["tt.f1"],
"rows": 2, "rows": 2,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 5, "select_id": 5,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -620,6 +637,7 @@ EXPLAIN ...@@ -620,6 +637,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2" "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
} }
...@@ -707,17 +725,20 @@ EXPLAIN ...@@ -707,17 +725,20 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "<derived2>", "table_name": "<derived2>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "x.f1 is not null", "attached_condition": "x.f1 is not null",
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "tt.f1", "sort_key": "tt.f1",
"temporary_table": { "temporary_table": {
...@@ -727,11 +748,13 @@ EXPLAIN ...@@ -727,11 +748,13 @@ EXPLAIN
"table_name": "<derived3>", "table_name": "<derived3>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "tt.f1 > 2", "attached_condition": "tt.f1 > 2",
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -741,6 +764,7 @@ EXPLAIN ...@@ -741,6 +764,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2" "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
} }
...@@ -769,10 +793,12 @@ EXPLAIN ...@@ -769,10 +793,12 @@ EXPLAIN
"used_key_parts": ["f1"], "used_key_parts": ["f1"],
"ref": ["x.f1"], "ref": ["x.f1"],
"rows": 2, "rows": 2,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 4, "select_id": 4,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "tt.f1", "sort_key": "tt.f1",
"temporary_table": { "temporary_table": {
...@@ -782,11 +808,13 @@ EXPLAIN ...@@ -782,11 +808,13 @@ EXPLAIN
"table_name": "<derived5>", "table_name": "<derived5>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "tt.f1 > 2", "attached_condition": "tt.f1 > 2",
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 5, "select_id": 5,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -796,6 +824,7 @@ EXPLAIN ...@@ -796,6 +824,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2" "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
} }
...@@ -853,17 +882,20 @@ EXPLAIN ...@@ -853,17 +882,20 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "<derived3>", "table_name": "<derived3>",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "v1.f1 < 7", "attached_condition": "v1.f1 < 7",
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -873,6 +905,7 @@ EXPLAIN ...@@ -873,6 +905,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7" "attached_condition": "t1.f1 < 7"
} }
...@@ -939,12 +972,14 @@ EXPLAIN ...@@ -939,12 +972,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t2", "table_name": "t2",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null" "attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null"
} }
...@@ -959,10 +994,12 @@ EXPLAIN ...@@ -959,10 +994,12 @@ EXPLAIN
"used_key_parts": ["f1"], "used_key_parts": ["f1"],
"ref": ["test.t2.f2"], "ref": ["test.t2.f2"],
"rows": 2, "rows": 2,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"materialized": { "materialized": {
"query_block": { "query_block": {
"select_id": 5, "select_id": 5,
"cost": "COST_REPLACED",
"filesort": { "filesort": {
"sort_key": "t1.f1", "sort_key": "t1.f1",
"temporary_table": { "temporary_table": {
...@@ -972,6 +1009,7 @@ EXPLAIN ...@@ -972,6 +1009,7 @@ EXPLAIN
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 11, "rows": 11,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 in (2,3)" "attached_condition": "t1.f1 < 7 and t1.f1 in (2,3)"
} }
......
...@@ -118,6 +118,7 @@ select * from t1 join v2 on f1=f2; ...@@ -118,6 +118,7 @@ select * from t1 join v2 on f1=f2;
show status like 'Handler_read%'; show status like 'Handler_read%';
explain extended select * from v1 join v4 on f1=f2; explain extended select * from v1 join v4 on f1=f2;
--source include/explain-no-costs.inc
explain format=json select * from v1 join v4 on f1=f2; explain format=json select * from v1 join v4 on f1=f2;
select * from v1 join v4 on f1=f2; select * from v1 join v4 on f1=f2;
...@@ -142,6 +143,7 @@ select * from (select * from ...@@ -142,6 +143,7 @@ select * from (select * from
--echo materialized derived in materialized derived --echo materialized derived in materialized derived
explain extended select * from (select * from explain extended select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz; (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
--source include/explain-no-costs.inc
explain format=json select * from (select * from explain format=json select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz; (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
select * from (select * from select * from (select * from
...@@ -153,6 +155,7 @@ explain extended select * from ...@@ -153,6 +155,7 @@ explain extended select * from
join join
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
on x.f1 = z.f1; on x.f1 = z.f1;
--source include/explain-no-costs.inc
explain format=json select * from explain format=json select * from
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x
join join
...@@ -194,6 +197,7 @@ join ...@@ -194,6 +197,7 @@ join
(select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
on x.f1 = z.f1; on x.f1 = z.f1;
--source include/explain-no-costs.inc
explain format=json select * from explain format=json select * from
(select * from (select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x
...@@ -218,6 +222,7 @@ select * from (select * from v4 group by 1) tt; ...@@ -218,6 +222,7 @@ select * from (select * from v4 group by 1) tt;
--echo materialized view in merged derived --echo materialized view in merged derived
explain extended explain extended
select * from ( select * from v1 where f1 < 7) tt; select * from ( select * from v1 where f1 < 7) tt;
--source include/explain-no-costs.inc
explain format=json explain format=json
select * from ( select * from v1 where f1 < 7) tt; select * from ( select * from v1 where f1 < 7) tt;
select * from ( select * from v1 where f1 < 7) tt; select * from ( select * from v1 where f1 < 7) tt;
...@@ -234,6 +239,7 @@ select * from (select * from v7 group by 1) tt; ...@@ -234,6 +239,7 @@ select * from (select * from v7 group by 1) tt;
--echo join of above two --echo join of above two
explain extended select * from v6 join v7 on f2=f1; explain extended select * from v6 join v7 on f2=f1;
--source include/explain-no-costs.inc
explain format=json select * from v6 join v7 on f2=f1; explain format=json select * from v6 join v7 on f2=f1;
select * from v6 join v7 on f2=f1; select * from v6 join v7 on f2=f1;
......
...@@ -37,12 +37,14 @@ EXPLAIN ...@@ -37,12 +37,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -53,12 +55,14 @@ EXPLAIN ...@@ -53,12 +55,14 @@ EXPLAIN
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "EXCEPT", "operation": "EXCEPT",
"cost": "REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t2", "table_name": "t2",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -85,6 +89,7 @@ ANALYZE ...@@ -85,6 +89,7 @@ ANALYZE
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -95,6 +100,7 @@ ANALYZE ...@@ -95,6 +100,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -108,6 +114,7 @@ ANALYZE ...@@ -108,6 +114,7 @@ ANALYZE
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "EXCEPT", "operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -118,6 +125,7 @@ ANALYZE ...@@ -118,6 +125,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -139,6 +147,7 @@ ANALYZE ...@@ -139,6 +147,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -149,6 +158,7 @@ ANALYZE ...@@ -149,6 +158,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 1, "r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -164,6 +174,7 @@ ANALYZE ...@@ -164,6 +174,7 @@ ANALYZE
{ {
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -174,6 +185,7 @@ ANALYZE ...@@ -174,6 +185,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -187,6 +199,7 @@ ANALYZE ...@@ -187,6 +199,7 @@ ANALYZE
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
"operation": "EXCEPT", "operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -197,6 +210,7 @@ ANALYZE ...@@ -197,6 +210,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -281,12 +295,14 @@ EXPLAIN ...@@ -281,12 +295,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "REPLACED",
"filtered": 100 "filtered": 100
} }
}, },
...@@ -296,6 +312,7 @@ EXPLAIN ...@@ -296,6 +312,7 @@ EXPLAIN
"table_name": "t3", "table_name": "t3",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "REPLACED",
"filtered": 100 "filtered": 100
}, },
"buffer_type": "flat", "buffer_type": "flat",
...@@ -310,12 +327,14 @@ EXPLAIN ...@@ -310,12 +327,14 @@ EXPLAIN
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "EXCEPT", "operation": "EXCEPT",
"cost": "REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t2", "table_name": "t2",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "REPLACED",
"filtered": 100 "filtered": 100
} }
}, },
...@@ -325,6 +344,7 @@ EXPLAIN ...@@ -325,6 +344,7 @@ EXPLAIN
"table_name": "t4", "table_name": "t4",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "REPLACED",
"filtered": 100 "filtered": 100
}, },
"buffer_type": "flat", "buffer_type": "flat",
...@@ -355,6 +375,7 @@ ANALYZE ...@@ -355,6 +375,7 @@ ANALYZE
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -365,6 +386,7 @@ ANALYZE ...@@ -365,6 +386,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -379,6 +401,7 @@ ANALYZE ...@@ -379,6 +401,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -398,6 +421,7 @@ ANALYZE ...@@ -398,6 +421,7 @@ ANALYZE
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"operation": "EXCEPT", "operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -408,6 +432,7 @@ ANALYZE ...@@ -408,6 +432,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -422,6 +447,7 @@ ANALYZE ...@@ -422,6 +447,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -450,6 +476,7 @@ ANALYZE ...@@ -450,6 +476,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -460,6 +487,7 @@ ANALYZE ...@@ -460,6 +487,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 4, "rows": 4,
"r_rows": 3, "r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -475,6 +503,7 @@ ANALYZE ...@@ -475,6 +503,7 @@ ANALYZE
{ {
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -485,6 +514,7 @@ ANALYZE ...@@ -485,6 +514,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -499,6 +529,7 @@ ANALYZE ...@@ -499,6 +529,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -518,6 +549,7 @@ ANALYZE ...@@ -518,6 +549,7 @@ ANALYZE
"query_block": { "query_block": {
"select_id": 3, "select_id": 3,
"operation": "EXCEPT", "operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -528,6 +560,7 @@ ANALYZE ...@@ -528,6 +560,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
...@@ -542,6 +575,7 @@ ANALYZE ...@@ -542,6 +575,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 2, "rows": 2,
"r_rows": 2, "r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
......
...@@ -11,6 +11,7 @@ insert into t2 values (2,2),(3,3); ...@@ -11,6 +11,7 @@ insert into t2 values (2,2),(3,3);
EXPLAIN (select a,b from t1) except (select c,d from t2); EXPLAIN (select a,b from t1) except (select c,d from t2);
EXPLAIN extended (select a,b from t1) except (select c,d from t2); EXPLAIN extended (select a,b from t1) except (select c,d from t2);
EXPLAIN extended select * from ((select a,b from t1) except (select c,d from t2)) a; EXPLAIN extended select * from ((select a,b from t1) except (select c,d from t2)) a;
--source include/analyze-format.inc
EXPLAIN format=json (select a,b from t1) except (select c,d from t2); EXPLAIN format=json (select a,b from t1) except (select c,d from t2);
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -43,6 +44,7 @@ insert into t4 values (4,4),(7,7); ...@@ -43,6 +44,7 @@ insert into t4 values (4,4),(7,7);
EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a; EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a;
--source include/analyze-format.inc
EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
--source include/analyze-format.inc --source include/analyze-format.inc
......
This diff is collapsed.
...@@ -16,6 +16,7 @@ select * from t1 except all select * from t1 union all select * from t1 union al ...@@ -16,6 +16,7 @@ select * from t1 except all select * from t1 union all select * from t1 union al
select * from (select * from t1 except all select * from t2) q1 except all select * from (select * from t1 except all select * from t2) q2; select * from (select * from t1 except all select * from t2) q1 except all select * from (select * from t1 except all select * from t2) q2;
EXPLAIN select * from t1 except all select * from t2; EXPLAIN select * from t1 except all select * from t2;
--source include/explain-no-costs.inc
EXPLAIN format=json select * from t1 except all select * from t2; EXPLAIN format=json select * from t1 except all select * from t2;
EXPLAIN extended (select * from t1) except all (select * from t2); EXPLAIN extended (select * from t1) except all (select * from t2);
EXPLAIN extended select * from ((select * from t1) except all (select * from t2)) a; EXPLAIN extended select * from ((select * from t1) except all (select * from t2)) a;
...@@ -53,6 +54,7 @@ select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4 ...@@ -53,6 +54,7 @@ select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4
EXPLAIN (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4); EXPLAIN (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
EXPLAIN select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; EXPLAIN select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
--source include/explain-no-costs.inc
EXPLAIN format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; EXPLAIN format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t;
--source include/analyze-format.inc --source include/analyze-format.inc
...@@ -96,4 +98,4 @@ INSERT INTO t VALUES (1),(2); ...@@ -96,4 +98,4 @@ INSERT INTO t VALUES (1),(2);
SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT ALL SELECT 3 ); SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT ALL SELECT 3 );
drop table t; drop table t;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -12,6 +12,7 @@ EXPLAIN ...@@ -12,6 +12,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
...@@ -19,6 +20,7 @@ EXPLAIN ...@@ -19,6 +20,7 @@ EXPLAIN
"partitions": ["p0"], "partitions": ["p0"],
"access_type": "ALL", "access_type": "ALL",
"rows": 10, "rows": 10,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "t1.a in (2,3,4)" "attached_condition": "t1.a in (2,3,4)"
} }
...@@ -34,6 +36,7 @@ ANALYZE ...@@ -34,6 +36,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -45,6 +48,7 @@ ANALYZE ...@@ -45,6 +48,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 10, "rows": 10,
"r_rows": 10, "r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
......
...@@ -7,6 +7,7 @@ create table t1 ( ...@@ -7,6 +7,7 @@ create table t1 (
) partition by key(a); ) partition by key(a);
insert into t1 select a from t2; insert into t1 select a from t2;
explain partitions select * from t1 where a in (2,3,4); explain partitions select * from t1 where a in (2,3,4);
--source include/explain-no-costs.inc
explain format=json select * from t1 where a in (2,3,4); explain format=json select * from t1 where a in (2,3,4);
--source include/analyze-format.inc --source include/analyze-format.inc
analyze format=json select * from t1 where a in (2,3,4); analyze format=json select * from t1 where a in (2,3,4);
......
...@@ -16,12 +16,14 @@ EXPLAIN ...@@ -16,12 +16,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
"access_type": "ALL", "access_type": "ALL",
"rows": 2, "rows": 2,
"cost": "COST_REPLACED",
"filtered": 100 "filtered": 100
} }
} }
...@@ -30,12 +32,14 @@ EXPLAIN ...@@ -30,12 +32,14 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 2, "select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
"table_name": "tbl_alias1", "table_name": "tbl_alias1",
"access_type": "ALL", "access_type": "ALL",
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null" "attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null"
} }
...@@ -53,6 +57,7 @@ EXPLAIN ...@@ -53,6 +57,7 @@ EXPLAIN
"test.tbl_alias1.column_name_1" "test.tbl_alias1.column_name_1"
], ],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2" "attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2"
} }
......
...@@ -20,6 +20,7 @@ INSERT INTO t2 VALUES (3,'United States'); ...@@ -20,6 +20,7 @@ INSERT INTO t2 VALUES (3,'United States');
CREATE TABLE t3 (b INT, c VARCHAR(3), PRIMARY KEY (c,b)) ENGINE=InnoDB; CREATE TABLE t3 (b INT, c VARCHAR(3), PRIMARY KEY (c,b)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (4,'USA'),(5,'CAN'); INSERT INTO t3 VALUES (4,'USA'),(5,'CAN');
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE 0 < ALL ( EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE 0 < ALL (
SELECT tbl_alias1.column_name_1 FROM t2 AS tbl_alias1, t3 AS tbl_alias2 SELECT tbl_alias1.column_name_1 FROM t2 AS tbl_alias1, t3 AS tbl_alias2
WHERE tbl_alias2.b = tbl_alias1.column_name_1 AND tbl_alias2.c = tbl_alias1.column_name_2 WHERE tbl_alias2.b = tbl_alias1.column_name_1 AND tbl_alias2.c = tbl_alias1.column_name_2
......
...@@ -447,6 +447,7 @@ ANALYZE ...@@ -447,6 +447,7 @@ ANALYZE
}, },
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "REPLACED",
"r_loops": 1, "r_loops": 1,
"r_total_time_ms": "REPLACED", "r_total_time_ms": "REPLACED",
"nested_loop": [ "nested_loop": [
...@@ -467,6 +468,7 @@ ANALYZE ...@@ -467,6 +468,7 @@ ANALYZE
"r_loops": 1, "r_loops": 1,
"rows": 8, "rows": 8,
"r_rows": 8, "r_rows": 8,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED", "r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED", "r_other_time_ms": "REPLACED",
"filtered": 100, "filtered": 100,
......
This diff is collapsed.
This diff is collapsed.
...@@ -42,6 +42,7 @@ WHERE t1.c<25 AND ...@@ -42,6 +42,7 @@ WHERE t1.c<25 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND formula : pushing into HAVING --echo # extracted AND formula : pushing into HAVING
...@@ -60,6 +61,7 @@ WHERE t1.c>55 AND t1.b<4 AND ...@@ -60,6 +61,7 @@ WHERE t1.c>55 AND t1.b<4 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted OR formula : pushing into HAVING --echo # extracted OR formula : pushing into HAVING
...@@ -78,6 +80,7 @@ WHERE (t1.c>60 OR t1.c<25) AND ...@@ -78,6 +80,7 @@ WHERE (t1.c>60 OR t1.c<25) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND-OR formula : pushing into HAVING --echo # extracted AND-OR formula : pushing into HAVING
...@@ -96,6 +99,7 @@ WHERE ((t1.c>60 OR t1.c<25) AND t1.b>2) AND ...@@ -96,6 +99,7 @@ WHERE ((t1.c>60 OR t1.c<25) AND t1.b>2) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into HAVING --echo # conjunctive subformula : pushing into HAVING
...@@ -114,6 +118,7 @@ WHERE ((t1.a<2 OR t1.d>3) AND t1.b>1) AND ...@@ -114,6 +118,7 @@ WHERE ((t1.a<2 OR t1.d>3) AND t1.b>1) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # using view IN subquery defINition : pushing into HAVING --echo # using view IN subquery defINition : pushing into HAVING
...@@ -132,6 +137,7 @@ WHERE t1.c>20 AND ...@@ -132,6 +137,7 @@ WHERE t1.c>20 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equality : pushing into WHERE --echo # using equality : pushing into WHERE
...@@ -150,6 +156,7 @@ WHERE t1.c>20 AND t1.c=v1_y AND ...@@ -150,6 +156,7 @@ WHERE t1.c>20 AND t1.c=v1_y AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE
...@@ -168,6 +175,7 @@ WHERE t1.a<2 AND ...@@ -168,6 +175,7 @@ WHERE t1.a<2 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND formula : pushing into WHERE --echo # extracted AND formula : pushing into WHERE
...@@ -186,6 +194,7 @@ WHERE t1.a>2 AND t1.a<5 AND ...@@ -186,6 +194,7 @@ WHERE t1.a>2 AND t1.a<5 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted OR formula : pushing into WHERE --echo # extracted OR formula : pushing into WHERE
...@@ -204,6 +213,7 @@ WHERE (t1.a<2 OR t1.a>=4) AND ...@@ -204,6 +213,7 @@ WHERE (t1.a<2 OR t1.a>=4) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND-OR formula : pushing into WHERE --echo # extracted AND-OR formula : pushing into WHERE
...@@ -222,6 +232,7 @@ WHERE ((t1.a<2 OR t1.a=5) AND t1.b>3) AND ...@@ -222,6 +232,7 @@ WHERE ((t1.a<2 OR t1.a=5) AND t1.b>3) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND-OR formula : pushing into WHERE --echo # extracted AND-OR formula : pushing into WHERE
...@@ -240,6 +251,7 @@ WHERE ((t1.a<2 OR t1.a=5) AND t1.b>3) AND ...@@ -240,6 +251,7 @@ WHERE ((t1.a<2 OR t1.a=5) AND t1.b>3) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE
...@@ -258,6 +270,7 @@ WHERE ((t1.b<3 OR t1.d>2) AND t1.a<2) AND ...@@ -258,6 +270,7 @@ WHERE ((t1.b<3 OR t1.d>2) AND t1.a<2) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equalities : pushing into WHERE --echo # using equalities : pushing into WHERE
...@@ -276,6 +289,7 @@ WHERE t1.d=1 AND t1.a=t1.d AND ...@@ -276,6 +289,7 @@ WHERE t1.d=1 AND t1.a=t1.d AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equality : pushing into WHERE --echo # using equality : pushing into WHERE
...@@ -294,6 +308,7 @@ WHERE t1.d>1 AND t1.a=t1.d AND ...@@ -294,6 +308,7 @@ WHERE t1.d>1 AND t1.a=t1.d AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # using view IN subquery definition : pushing into WHERE --echo # using view IN subquery definition : pushing into WHERE
...@@ -312,6 +327,7 @@ WHERE t1.a<3 AND ...@@ -312,6 +327,7 @@ WHERE t1.a<3 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equality : pushing into WHERE --echo # using equality : pushing into WHERE
...@@ -330,6 +346,7 @@ WHERE t1.a=v1_x AND v1_x<2 AND v1_y>30 AND ...@@ -330,6 +346,7 @@ WHERE t1.a=v1_x AND v1_x<2 AND v1_y>30 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE
...@@ -349,6 +366,7 @@ WHERE ((t1.b<3 OR t1.b=4) AND t1.a<3) AND ...@@ -349,6 +366,7 @@ WHERE ((t1.b<3 OR t1.b=4) AND t1.a<3) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using addition : pushing into HAVING --echo # conjunctive subformula using addition : pushing into HAVING
...@@ -367,6 +385,7 @@ WHERE (t1.a+t1.c>41) AND ...@@ -367,6 +385,7 @@ WHERE (t1.a+t1.c>41) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using substitution : pushing into HAVING --echo # conjunctive subformula using substitution : pushing into HAVING
...@@ -385,6 +404,7 @@ WHERE (t1.c-t1.a<35) AND ...@@ -385,6 +404,7 @@ WHERE (t1.c-t1.a<35) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using multiplication : pushing into HAVING --echo # conjunctive subformula using multiplication : pushing into HAVING
...@@ -403,6 +423,7 @@ WHERE (t1.c*t1.a>100) AND ...@@ -403,6 +423,7 @@ WHERE (t1.c*t1.a>100) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using division : pushing into HAVING --echo # conjunctive subformula using division : pushing into HAVING
...@@ -421,6 +442,7 @@ WHERE (t1.c/t1.a>30) AND ...@@ -421,6 +442,7 @@ WHERE (t1.c/t1.a>30) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using BETWEEN : pushing into HAVING --echo # conjunctive subformula using BETWEEN : pushing into HAVING
...@@ -439,6 +461,7 @@ WHERE (t1.c BETWEEN 50 AND 100) AND ...@@ -439,6 +461,7 @@ WHERE (t1.c BETWEEN 50 AND 100) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using addition : pushing into WHERE --echo # conjunctive subformula using addition : pushing into WHERE
...@@ -457,6 +480,7 @@ WHERE (t1.a+t1.b > 5) AND ...@@ -457,6 +480,7 @@ WHERE (t1.a+t1.b > 5) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using substitution : pushing into WHERE --echo # conjunctive subformula using substitution : pushing into WHERE
...@@ -475,6 +499,7 @@ WHERE (t1.a-t1.b > 0) AND ...@@ -475,6 +499,7 @@ WHERE (t1.a-t1.b > 0) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using multiplication : pushing into WHERE --echo # conjunctive subformula using multiplication : pushing into WHERE
...@@ -493,6 +518,7 @@ WHERE (t1.a*t1.b > 6) AND ...@@ -493,6 +518,7 @@ WHERE (t1.a*t1.b > 6) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using division : pushing into WHERE --echo # conjunctive subformula using division : pushing into WHERE
...@@ -511,6 +537,7 @@ WHERE (t1.b/t1.a > 2) AND ...@@ -511,6 +537,7 @@ WHERE (t1.b/t1.a > 2) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using BETWEEN : pushing into WHERE --echo # conjunctive subformula using BETWEEN : pushing into WHERE
...@@ -529,6 +556,7 @@ WHERE (t1.a BETWEEN 1 AND 3) AND ...@@ -529,6 +556,7 @@ WHERE (t1.a BETWEEN 1 AND 3) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into HAVING of the IN subquery --echo # conjunctive subformula : pushing into HAVING of the IN subquery
...@@ -548,6 +576,7 @@ WHERE t1.c>3 AND ...@@ -548,6 +576,7 @@ WHERE t1.c>3 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE of the IN subquery --echo # conjunctive subformula : pushing into WHERE of the IN subquery
...@@ -568,6 +597,7 @@ WHERE t1.a>1 AND ...@@ -568,6 +597,7 @@ WHERE t1.a>1 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE and HAVING --echo # conjunctive subformula : pushing into WHERE and HAVING
...@@ -589,6 +619,7 @@ WHERE t1.a>1 AND t1.c<100 AND ...@@ -589,6 +619,7 @@ WHERE t1.a>1 AND t1.c<100 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE of the IN subquery --echo # conjunctive subformula : pushing into WHERE of the IN subquery
...@@ -615,6 +646,7 @@ WHERE t1.a>1 AND ...@@ -615,6 +646,7 @@ WHERE t1.a>1 AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into HAVING of the derived table --echo # conjunctive subformula : pushing into HAVING of the derived table
...@@ -640,6 +672,7 @@ WHERE d_tab.a=t3.x AND d_tab.b>2; ...@@ -640,6 +672,7 @@ WHERE d_tab.a=t3.x AND d_tab.b>2;
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE of the derived table --echo # conjunctive subformula : pushing into WHERE of the derived table
...@@ -665,6 +698,7 @@ WHERE d_tab.a=t3.x AND d_tab.a<5; ...@@ -665,6 +698,7 @@ WHERE d_tab.a=t3.x AND d_tab.a<5;
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE and HAVING --echo # conjunctive subformula : pushing into WHERE and HAVING
...@@ -692,6 +726,7 @@ WHERE d_tab.a=t3.x AND d_tab.a<5 AND d_tab.max_c<70; ...@@ -692,6 +726,7 @@ WHERE d_tab.a=t3.x AND d_tab.a<5 AND d_tab.max_c<70;
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE of the derived table --echo # conjunctive subformula : pushing into WHERE of the derived table
...@@ -717,6 +752,7 @@ WHERE d_tab.a=t3.x AND d_tab.a<5; ...@@ -717,6 +752,7 @@ WHERE d_tab.a=t3.x AND d_tab.a<5;
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE
...@@ -735,6 +771,7 @@ WHERE (t1.b>1) AND ...@@ -735,6 +771,7 @@ WHERE (t1.b>1) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE
...@@ -753,6 +790,7 @@ WHERE (t1.b>1) AND ...@@ -753,6 +790,7 @@ WHERE (t1.b>1) AND
EVAL $no_pushdown $query; EVAL $no_pushdown $query;
EVAL $query; EVAL $query;
EVAL EXPLAIN $query; EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query; EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
......
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
drop table t0,t1,t2; drop table t0,t1,t2;
# #
# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff' # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
@@ -769,11 +769,12 @@ @@ -770,11 +770,12 @@
{ {
"table": { "table": {
"table_name": "t1", "table_name": "t1",
...@@ -279,9 +279,9 @@ ...@@ -279,9 +279,9 @@
+ "used_key_parts": ["f2"], + "used_key_parts": ["f2"],
+ "ref": ["const"], + "ref": ["const"],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'", @@ -809,8 +810,8 @@
@@ -806,8 +807,8 @@
"access_type": "range", "access_type": "range",
"possible_keys": ["k1"], "possible_keys": ["k1"],
"key": "k1", "key": "k1",
...@@ -290,5 +290,5 @@ ...@@ -290,5 +290,5 @@
+ "key_length": "3007", + "key_length": "3007",
+ "used_key_parts": ["pk1", "f2"], + "used_key_parts": ["pk1", "f2"],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
...@@ -759,12 +759,13 @@ PRIMARY KEY (pk1,pk2), ...@@ -759,12 +759,13 @@ PRIMARY KEY (pk1,pk2),
KEY(f2) KEY(f2)
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; ) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
explain format= json explain format=json
select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3'; select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3';
EXPLAIN EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
...@@ -775,6 +776,7 @@ EXPLAIN ...@@ -775,6 +776,7 @@ EXPLAIN
"key_length": "3070", "key_length": "3070",
"used_key_parts": ["f2", "pk1"], "used_key_parts": ["f2", "pk1"],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'", "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
"attached_condition": "t1.f1 <= '3'" "attached_condition": "t1.f1 <= '3'"
...@@ -793,12 +795,13 @@ PRIMARY KEY (pk1,pk2), ...@@ -793,12 +795,13 @@ PRIMARY KEY (pk1,pk2),
KEY k1(pk1,f2) KEY k1(pk1,f2)
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; ) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
explain format= json explain format=json
select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3'; select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3';
EXPLAIN EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
...@@ -809,6 +812,7 @@ EXPLAIN ...@@ -809,6 +812,7 @@ EXPLAIN
"key_length": "3011", "key_length": "3011",
"used_key_parts": ["pk1", "f2", "pk2"], "used_key_parts": ["pk1", "f2", "pk2"],
"rows": 1, "rows": 1,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'", "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
"attached_condition": "t1.f1 <= '3'" "attached_condition": "t1.f1 <= '3'"
......
...@@ -614,7 +614,8 @@ CREATE TABLE t1 ( ...@@ -614,7 +614,8 @@ CREATE TABLE t1 (
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; ) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
explain format= json --source include/explain-no-costs.inc
explain format=json
select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3'; select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3';
drop table t1; drop table t1;
...@@ -627,7 +628,8 @@ PRIMARY KEY (pk1,pk2), ...@@ -627,7 +628,8 @@ PRIMARY KEY (pk1,pk2),
KEY k1(pk1,f2) KEY k1(pk1,f2)
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; ) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
explain format= json --source include/explain-no-costs.inc
explain format=json
select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3'; select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3';
drop table t1; drop table t1;
......
This diff is collapsed.
...@@ -23,6 +23,7 @@ insert into t3 values (1,1),(2,2),(5,5); ...@@ -23,6 +23,7 @@ insert into t3 values (1,1),(2,2),(5,5);
EXPLAIN (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); EXPLAIN (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
EXPLAIN extended (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); EXPLAIN extended (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
EXPLAIN extended select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a; EXPLAIN extended select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
--source include/explain-no-costs.inc
EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
--source include/analyze-format.inc --source include/analyze-format.inc
ANALYZE format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); ANALYZE format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
...@@ -43,6 +44,7 @@ EXPLAIN (select a,b from t1) intersect (select c,e from t2,t3); ...@@ -43,6 +44,7 @@ EXPLAIN (select a,b from t1) intersect (select c,e from t2,t3);
EXPLAIN extended (select a,b from t1) intersect (select c,e from t2,t3); EXPLAIN extended (select a,b from t1) intersect (select c,e from t2,t3);
EXPLAIN extended select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a; EXPLAIN extended select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
set @@optimizer_switch='optimize_join_buffer_size=off'; set @@optimizer_switch='optimize_join_buffer_size=off';
--source include/explain-no-costs.inc
EXPLAIN format=json (select a,b from t1) intersect (select c,e from t2,t3); EXPLAIN format=json (select a,b from t1) intersect (select c,e from t2,t3);
--source include/analyze-format.inc --source include/analyze-format.inc
ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3); ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3);
......
This diff is collapsed.
...@@ -22,6 +22,7 @@ insert into t3 values (1,1),(2,2),(5,5),(2,2); ...@@ -22,6 +22,7 @@ insert into t3 values (1,1),(2,2),(5,5),(2,2);
EXPLAIN (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); EXPLAIN (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
EXPLAIN extended (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); EXPLAIN extended (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a; EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
--source include/explain-no-costs.inc
EXPLAIN format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); EXPLAIN format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
--source include/analyze-format.inc --source include/analyze-format.inc
ANALYZE format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); ANALYZE format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3);
...@@ -50,6 +51,7 @@ insert into t3 values (2,2); ...@@ -50,6 +51,7 @@ insert into t3 values (2,2);
EXPLAIN (select a,b from t1) intersect all (select c,e from t2,t3); EXPLAIN (select a,b from t1) intersect all (select c,e from t2,t3);
EXPLAIN extended (select a,b from t1) intersect all (select c,e from t2,t3); EXPLAIN extended (select a,b from t1) intersect all (select c,e from t2,t3);
EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a; EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
--source include/explain-no-costs.inc
EXPLAIN format=json (select a,b from t1) intersect all (select c,e from t2,t3); EXPLAIN format=json (select a,b from t1) intersect all (select c,e from t2,t3);
--source include/analyze-format.inc --source include/analyze-format.inc
ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3); ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3);
...@@ -325,4 +327,4 @@ select * from t2 where a < 5 ...@@ -325,4 +327,4 @@ select * from t2 where a < 5
intersect all intersect all
select * from t3 where a < 5; select * from t3 where a < 5;
drop table t1,t2,t3; drop table t1,t2,t3;
\ No newline at end of file
...@@ -6254,6 +6254,7 @@ EXPLAIN ...@@ -6254,6 +6254,7 @@ EXPLAIN
{ {
"query_block": { "query_block": {
"select_id": 1, "select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [ "nested_loop": [
{ {
"table": { "table": {
...@@ -6264,6 +6265,7 @@ EXPLAIN ...@@ -6264,6 +6265,7 @@ EXPLAIN
"key_length": "4", "key_length": "4",
"used_key_parts": ["a"], "used_key_parts": ["a"],
"rows": 10, "rows": 10,
"cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "a.a <= 10", "attached_condition": "a.a <= 10",
"using_index": true "using_index": true
...@@ -6279,6 +6281,7 @@ EXPLAIN ...@@ -6279,6 +6281,7 @@ EXPLAIN
"key_length": "10", "key_length": "10",
"used_key_parts": ["kp1", "kp2"], "used_key_parts": ["kp1", "kp2"],
"rows": 836, "rows": 836,
"cost": "COST_REPLACED",
"filtered": 9.090909004, "filtered": 9.090909004,
"index_condition": "b.kp2 <= 10", "index_condition": "b.kp2 <= 10",
"attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333" "attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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