1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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

Basic printout for join and table execution costs.
This commit is contained in:
Sergei Petrunia
2022-11-19 21:00:23 +03:00
parent 657868f5e7
commit ffe0beca25
91 changed files with 3441 additions and 18 deletions

View File

@ -1,3 +1,3 @@
# The time on ANALYSE FORMAT=JSON is rather variable
--replace_regex /("(r_total_time_ms|r_table_time_ms|r_other_time_ms|r_buffer_size|r_filling_time_ms|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"/

View File

@ -0,0 +1,2 @@
--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"/

View File

@ -0,0 +1 @@
--replace_regex /("(cost|filtered)": )[^, \n]*/\1"REPLACED"/

View File

@ -0,0 +1 @@
--replace_regex /("(cost)": )[^, \n]*/\1"COST_REPLACED"/

View File

@ -10,6 +10,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -20,6 +21,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -46,6 +48,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -56,6 +59,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -75,6 +79,7 @@ ANALYZE
"r_loops": 0,
"rows": 1,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null
}
@ -96,6 +101,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -106,6 +112,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -125,6 +132,7 @@ ANALYZE
"r_loops": 10,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -149,6 +157,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -159,6 +168,7 @@ ANALYZE
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -174,6 +184,7 @@ ANALYZE
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -199,6 +210,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -209,6 +221,7 @@ ANALYZE
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -224,6 +237,7 @@ ANALYZE
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -258,6 +272,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -268,6 +283,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -287,6 +303,7 @@ ANALYZE
"r_loops": 10,
"rows": 2,
"r_rows": 0.2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -319,6 +336,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -329,6 +347,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -383,6 +402,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -397,6 +417,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -463,6 +484,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -473,6 +495,7 @@ ANALYZE
"r_loops": 1,
"rows": 5,
"r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -499,6 +522,7 @@ ANALYZE
"r_loops": 5,
"rows": 1010,
"r_rows": 203.8,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -533,6 +557,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -543,6 +568,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -557,6 +583,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -567,6 +594,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -604,6 +632,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"having_condition": "TOP > t2.a",
@ -624,6 +653,7 @@ ANALYZE
"r_loops": 1,
"rows": 256,
"r_rows": 256,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -644,6 +674,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -663,6 +694,7 @@ ANALYZE
"r_loops": 1,
"rows": 256,
"r_rows": 256,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -697,6 +729,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -716,6 +749,7 @@ ANALYZE
"r_loops": 1,
"rows": 256,
"r_rows": 256,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -743,6 +777,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -753,6 +788,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -767,6 +803,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -786,6 +823,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -796,6 +834,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -832,6 +871,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -860,6 +900,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -874,6 +915,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -895,6 +937,7 @@ ANALYZE
"r_loops": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -903,6 +946,7 @@ ANALYZE
"r_loops": 0,
"rows": 2,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null
}
@ -915,6 +959,7 @@ ANALYZE
"r_loops": 0,
"rows": 2,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null
},
@ -954,6 +999,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -964,6 +1010,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -979,6 +1026,7 @@ ANALYZE
"r_loops": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -996,6 +1044,7 @@ ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "t2.a < t1.a"

View File

@ -154,6 +154,7 @@ drop table t0, t1;
--echo #
--echo # MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
--source include/explain-no-costs.inc
--echo #
create table t0(a int);
insert into t0 values (0),(1),(2),(3);

View File

@ -182,6 +182,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t2.b",
"temporary_table": {
@ -191,6 +192,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a is not null"
}
@ -205,6 +207,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t0.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -222,6 +225,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -241,6 +245,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -260,6 +265,7 @@ ANALYZE
"r_loops": 10,
"rows": 1,
"r_rows": 0.4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -285,6 +291,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -294,6 +301,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a is not null"
}
@ -310,6 +318,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t0.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -325,6 +334,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -345,6 +355,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -366,6 +377,7 @@ ANALYZE
"r_loops": 10,
"rows": 1,
"r_rows": 0.4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -396,6 +408,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -415,6 +428,7 @@ ANALYZE
"r_loops": 1,
"rows": 1000,
"r_rows": 1000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -459,6 +473,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"duplicate_removal": {
@ -471,6 +486,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -485,6 +501,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -527,6 +544,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -555,6 +573,7 @@ ANALYZE
"r_loops": 1,
"rows": 5,
"r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -570,6 +589,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -598,6 +618,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "count(distinct t5.b)",
"temporary_table": {
@ -610,6 +631,7 @@ EXPLAIN
"table_name": "t6",
"access_type": "ALL",
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t6.b > 0 and t6.a <= 5"
}
@ -620,6 +642,7 @@ EXPLAIN
"table_name": "t5",
"access_type": "ALL",
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -666,6 +689,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -679,6 +703,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 20,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -21,6 +21,7 @@ insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
--echo #
explain
update t2 set b=b+1 order by b limit 5;
--source include/explain-no-costs.inc
explain format=json
update t2 set b=b+1 order by b limit 5;
--source include/analyze-format.inc
@ -32,6 +33,7 @@ update t2 set b=b+1 order by b limit 5;
--echo #
explain
update t2 set a=a+1 where a<10;
--source include/explain-no-costs.inc
explain format=json
update t2 set a=a+1 where a<10;
--source include/analyze-format.inc
@ -43,6 +45,7 @@ update t2 set a=a+1 where a<10;
--echo #
explain
delete from t2 order by b limit 5;
--source include/explain-no-costs.inc
explain format=json
delete from t2 order by b limit 5;
--source include/analyze-format.inc
@ -54,6 +57,7 @@ delete from t2 order by b limit 5;
--echo #
explain
select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
--source include/explain-no-costs.inc
explain format=json
select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
--source include/analyze-format.inc
@ -66,6 +70,7 @@ select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
--echo #
explain
select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
--source include/explain-no-costs.inc
explain format=json
select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
--source include/analyze-format.inc
@ -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
group by t5.a order by sum limit 1;
--source include/explain-no-costs.inc
explain format=json
select count(distinct t5.b) as sum from t5, t6
where t5.a=t6.a and t6.b > 0 and t5.a <= 5

View File

@ -261,6 +261,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -270,6 +271,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -291,6 +293,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -300,6 +303,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -329,12 +333,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a = 20"
}
@ -346,12 +352,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -383,12 +391,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a = 20"
}
@ -400,12 +410,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -445,6 +457,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -454,6 +467,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -466,12 +480,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.pk > 4"
}

View File

@ -117,24 +117,28 @@ let $q1=
select a from t1 order by a desc limit 1;
eval $q1;
eval explain extended $q1;
--source include/explain-no-costs.inc
eval explain format=json $q1;
let $q2=
(select a from t1 order by a desc) limit 1;
eval $q2;
eval explain extended $q2;
--source include/explain-no-costs.inc
eval explain format=json $q2;
let $q1=
(select a from t1 where a=20 union select a from t1) order by a desc limit 1;
eval $q1;
eval explain extended $q1;
--source include/explain-no-costs.inc
eval explain format=json $q1;
let $q2=
((select a from t1 where a=20 union select a from t1) order by a desc) limit 1;
eval $q2;
eval explain extended $q2;
--source include/explain-no-costs.inc
eval explain format=json $q2;
drop table t1;
@ -150,6 +154,7 @@ let $q=
((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4);
eval $q;
eval explain extended $q;
--source include/explain-no-costs.inc
eval explain format=json $q;
drop table t1;

View File

@ -1339,12 +1339,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived4>",
"access_type": "ALL",
"rows": 24,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -1355,12 +1357,14 @@ EXPLAIN
{
"query_block": {
"select_id": 4,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "folks",
"access_type": "ALL",
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "folks.`name` = 'Me2'"
}
@ -1372,12 +1376,14 @@ EXPLAIN
"query_block": {
"select_id": 6,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "prev_gen.`id` < 345",
"materialized": {
@ -1389,12 +1395,14 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "folks",
"access_type": "ALL",
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "folks.`name` = 'Me'"
}
@ -1406,6 +1414,7 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1413,6 +1422,7 @@ EXPLAIN
"access_type": "ALL",
"possible_keys": ["PRIMARY"],
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -1422,6 +1432,7 @@ EXPLAIN
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -1446,12 +1457,14 @@ EXPLAIN
"query_block": {
"select_id": 5,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived4>",
"access_type": "ALL",
"rows": 24,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "ancestors.`id` < 234"
}
@ -1499,12 +1512,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -1515,12 +1530,14 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "v",
"access_type": "ALL",
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "v.`name` = 'Me' and v.father is not null and v.mother is not null"
}
@ -1535,6 +1552,7 @@ EXPLAIN
"used_key_parts": ["id"],
"ref": ["test.v.father"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -1548,6 +1566,7 @@ EXPLAIN
"used_key_parts": ["id"],
"ref": ["test.v.mother"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1558,12 +1577,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived4>",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "a.father is not null and a.mother is not null"
}
@ -1578,6 +1599,7 @@ EXPLAIN
"used_key_parts": ["id"],
"ref": ["a.father"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -1591,6 +1613,7 @@ EXPLAIN
"used_key_parts": ["id"],
"ref": ["a.mother"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1824,12 +1847,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -1840,12 +1865,14 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1856,12 +1883,14 @@ EXPLAIN
"query_block": {
"select_id": 3,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t.a < 1000"
}
@ -2460,6 +2489,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2470,6 +2500,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -2494,6 +2525,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 10,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2504,6 +2536,7 @@ ANALYZE
"r_loops": 10,
"rows": 2,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3869,6 +3902,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -3879,6 +3913,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3898,6 +3933,7 @@ ANALYZE
"r_loops": 3,
"rows": 1,
"r_rows": 0.333333333,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3941,6 +3977,7 @@ ANALYZE
"query_block": {
"select_id": 4,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -3952,6 +3989,7 @@ ANALYZE
"r_loops": 1,
"rows": 14,
"r_rows": 14,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3971,6 +4009,7 @@ ANALYZE
"r_loops": 14,
"rows": 1,
"r_rows": 0.071428571,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4145,6 +4184,7 @@ ANALYZE
"query_block": {
"select_id": 4,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4155,6 +4195,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4170,6 +4211,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4180,6 +4222,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4193,6 +4236,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4203,6 +4247,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4222,6 +4267,7 @@ ANALYZE
"r_loops": 4,
"rows": 2,
"r_rows": 0.5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4300,6 +4346,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4310,6 +4357,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -1110,6 +1110,7 @@ as
)
select ancestors.name, ancestors.dob from ancestors;
--source include/explain-no-costs.inc
explain FORMAT=JSON
with recursive
prev_gen
@ -1139,6 +1140,7 @@ as
select ancestors.name, ancestors.dob from ancestors;
--echo #
--source include/explain-no-costs.inc
explain format=json
with recursive
ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
@ -1343,6 +1345,7 @@ drop table folks;
create table t1(a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
--source include/explain-no-costs.inc
explain format=json
with recursive t as (select a from t1 union select a+10 from t where a < 1000)
select * from t;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -381,12 +381,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.f2 in (2,3) and t2.f2 is not null"
}
@ -401,10 +403,12 @@ EXPLAIN
"used_key_parts": ["f1"],
"ref": ["test.t2.f2"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -414,6 +418,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 in (2,3)"
}
@ -485,16 +490,19 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "tt.f1",
"temporary_table": {
@ -504,11 +512,13 @@ EXPLAIN
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tt.f1 > 2",
"materialized": {
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -518,6 +528,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2"
}
@ -566,17 +577,20 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null",
"materialized": {
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -586,6 +600,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
}
@ -607,10 +622,12 @@ EXPLAIN
"used_key_parts": ["f1"],
"ref": ["tt.f1"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 5,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -620,6 +637,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
}
@ -707,17 +725,20 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "x.f1 is not null",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "tt.f1",
"temporary_table": {
@ -727,11 +748,13 @@ EXPLAIN
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tt.f1 > 2",
"materialized": {
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -741,6 +764,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2"
}
@ -769,10 +793,12 @@ EXPLAIN
"used_key_parts": ["f1"],
"ref": ["x.f1"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 4,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "tt.f1",
"temporary_table": {
@ -782,11 +808,13 @@ EXPLAIN
"table_name": "<derived5>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tt.f1 > 2",
"materialized": {
"query_block": {
"select_id": 5,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -796,6 +824,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 > 2"
}
@ -853,17 +882,20 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "v1.f1 < 7",
"materialized": {
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -873,6 +905,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7"
}
@ -939,12 +972,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null"
}
@ -959,10 +994,12 @@ EXPLAIN
"used_key_parts": ["f1"],
"ref": ["test.t2.f2"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 5,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.f1",
"temporary_table": {
@ -972,6 +1009,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f1 < 7 and t1.f1 in (2,3)"
}

View File

@ -118,6 +118,7 @@ select * from t1 join v2 on f1=f2;
show status like 'Handler_read%';
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;
select * from v1 join v4 on f1=f2;
@ -142,6 +143,7 @@ select * from (select * from
--echo materialized derived in materialized derived
explain extended select * from (select * from
(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
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
select * from (select * from
@ -153,6 +155,7 @@ explain extended select * from
join
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
on x.f1 = z.f1;
--source include/explain-no-costs.inc
explain format=json select * from
(select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x
join
@ -194,6 +197,7 @@ join
(select * from
(select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
on x.f1 = z.f1;
--source include/explain-no-costs.inc
explain format=json select * from
(select * from
(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;
--echo materialized view in merged derived
explain extended
select * from ( select * from v1 where f1 < 7) tt;
--source include/explain-no-costs.inc
explain format=json
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;
--echo join of above two
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;
select * from v6 join v7 on f2=f1;

View File

@ -37,12 +37,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "REPLACED",
"filtered": 100
}
}
@ -53,12 +55,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"cost": "REPLACED",
"filtered": 100
}
}
@ -85,6 +89,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -95,6 +100,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -108,6 +114,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -118,6 +125,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -139,6 +147,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -149,6 +158,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -164,6 +174,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -174,6 +185,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -187,6 +199,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -197,6 +210,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -281,12 +295,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "REPLACED",
"filtered": 100
}
},
@ -296,6 +312,7 @@ EXPLAIN
"table_name": "t3",
"access_type": "ALL",
"rows": 2,
"cost": "REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -310,12 +327,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"cost": "REPLACED",
"filtered": 100
}
},
@ -325,6 +344,7 @@ EXPLAIN
"table_name": "t4",
"access_type": "ALL",
"rows": 2,
"cost": "REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -355,6 +375,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -365,6 +386,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -379,6 +401,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -398,6 +421,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -408,6 +432,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -422,6 +447,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -450,6 +476,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -460,6 +487,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -475,6 +503,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -485,6 +514,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -499,6 +529,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -518,6 +549,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -528,6 +560,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -542,6 +575,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -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 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;
--source include/analyze-format.inc
EXPLAIN format=json (select a,b from t1) except (select c,d from t2);
--source include/analyze-format.inc
@ -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 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);
--source include/analyze-format.inc

View File

@ -65,12 +65,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -81,12 +83,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -120,6 +124,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -130,6 +135,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -145,6 +151,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -155,6 +162,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -168,6 +176,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -178,6 +187,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -204,6 +214,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -214,6 +225,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -229,6 +241,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -239,6 +252,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -252,6 +266,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -262,6 +277,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -387,12 +403,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 9,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -403,12 +421,14 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -418,6 +438,7 @@ EXPLAIN
"table_name": "t3",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -432,12 +453,14 @@ EXPLAIN
"query_block": {
"select_id": 3,
"operation": "EXCEPT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -447,6 +470,7 @@ EXPLAIN
"table_name": "t4",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -482,6 +506,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -492,6 +517,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -506,6 +532,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -525,6 +552,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -535,6 +563,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -549,6 +578,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -576,6 +606,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -586,6 +617,7 @@ ANALYZE
"r_loops": 1,
"rows": 9,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -601,6 +633,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -611,6 +644,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -625,6 +659,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -644,6 +679,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "EXCEPT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -654,6 +690,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -668,6 +705,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -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;
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 extended (select * from t1) except all (select * from t2);
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
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 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;
--source include/analyze-format.inc

View File

@ -6,12 +6,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -33,12 +35,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a < 3"
}
@ -59,12 +63,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a is not null"
}
@ -79,6 +85,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t0.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -93,6 +100,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -103,6 +111,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a1"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t2.a1 < 5"
}
@ -115,6 +124,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -139,6 +149,7 @@ EXPLAIN
]
},
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a1 = 1 or t2.b1 = 2"
}
@ -151,6 +162,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -175,6 +187,7 @@ EXPLAIN
]
},
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a1 = 1 or t2.b1 = 2 and t2.b2 = 3"
}
@ -188,6 +201,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -212,6 +226,7 @@ EXPLAIN
]
},
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a1 = 1 and t2.a2 = 1 or t2.b1 = 2 and t2.b2 = 1"
}
@ -225,12 +240,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a is not null"
}
@ -245,6 +262,7 @@ EXPLAIN
"used_key_parts": ["b1", "b2"],
"ref": ["test.t0.a", "const"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -266,12 +284,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "A",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -282,12 +302,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "B",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -307,12 +329,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "A",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -323,12 +347,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "B",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -349,12 +375,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -365,12 +393,14 @@ EXPLAIN
"state": "uninitialized",
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = t0.a"
}
@ -389,12 +419,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a > (subquery#2) or t0.a < 3"
}
@ -406,12 +438,14 @@ EXPLAIN
"state": "uninitialized",
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = t0.a"
}
@ -435,12 +469,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tbl1",
"access_type": "ALL",
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl1.b < 3"
}
@ -451,6 +487,7 @@ EXPLAIN
"table_name": "tbl2",
"access_type": "ALL",
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl2.b < 5"
},
@ -538,12 +575,14 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -566,17 +605,20 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl.cnt > 0",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"having_condition": "cnt > 0",
"filesort": {
"sort_key": "t1.a",
@ -587,6 +629,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -607,12 +650,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tbl2",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl2.a is not null"
}
@ -627,11 +672,13 @@ EXPLAIN
"used_key_parts": ["cnt"],
"ref": ["test.tbl2.a"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl1.cnt = tbl2.a",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
@ -641,6 +688,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -663,12 +711,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a is not null"
}
@ -683,11 +733,13 @@ EXPLAIN
"used_key_parts": ["max(a)"],
"ref": ["test.t1.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"temporary_table": {
"nested_loop": [
{
@ -695,6 +747,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -718,12 +771,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -752,6 +807,7 @@ EXPLAIN
"key_length": "8",
"used_key_parts": ["seq"],
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
@ -767,6 +823,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -791,12 +848,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -806,6 +865,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"first_match": "t2"
},
@ -834,12 +894,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -851,6 +913,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 10
},
"buffer_type": "flat",
@ -878,6 +941,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -888,6 +952,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a < 3",
"mrr_type": "Rowid-ordered scan"
@ -904,12 +969,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tbl1",
"access_type": "ALL",
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -921,6 +988,7 @@ EXPLAIN
"access_type": "ALL",
"possible_keys": ["a"],
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -942,6 +1010,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -951,6 +1020,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "!<in_optimizer>(outer_t1.a,<exists>(subquery#2))",
"using_index": true
@ -961,6 +1031,7 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"having_condition": "trigcond(t1.a is null)",
"nested_loop": [
{
@ -974,6 +1045,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["func"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)",
"using_index": true
@ -986,6 +1058,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -1017,6 +1090,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"const_condition": "<not>(<in_optimizer>(20000,<max>(subquery#2) >= 20000))",
"nested_loop": [
{
@ -1024,6 +1098,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1032,12 +1107,14 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tbl1",
"access_type": "ALL",
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -1047,6 +1124,7 @@ EXPLAIN
"table_name": "tbl2",
"access_type": "ALL",
"rows": 100,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -1075,12 +1153,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "!<in_optimizer>(t1.a,<exists>(subquery#2))"
}
@ -1090,6 +1170,7 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"having_condition": "trigcond(t2.b is null)",
"nested_loop": [
{
@ -1097,6 +1178,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "trigcond(<cache>(t1.a) = t2.b or t2.b is null)"
}
@ -1135,6 +1217,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1144,6 +1227,7 @@ EXPLAIN
"key_length": "10",
"used_key_parts": ["a", "b"],
"rows": 101,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index_for_group_by": true
}
@ -1159,6 +1243,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1172,6 +1257,7 @@ ANALYZE
"r_loops": 1,
"rows": 101,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1246,6 +1332,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1255,6 +1342,7 @@ EXPLAIN
"key_length": "147",
"used_key_parts": ["a1", "a2", "b"],
"rows": 17,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = 'a' and t1.a2 >= 'b'",
"using_index_for_group_by": true
@ -1268,6 +1356,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1277,6 +1366,7 @@ EXPLAIN
"key_length": "163",
"used_key_parts": ["a1", "a2", "b", "c"],
"rows": 128,
"cost": "COST_REPLACED",
"filtered": 0.198364258,
"attached_condition": "t1.b = 'a' and t1.c = 'i121' and t1.a2 >= 'b'",
"using_index": true
@ -1290,6 +1380,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1300,6 +1391,7 @@ EXPLAIN
"key_length": "147",
"used_key_parts": ["a1", "a2", "b"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = 'a' and t1.a1 >= '' and t1.a2 >= 'b'",
"using_index_for_group_by": true
@ -1319,12 +1411,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a = _latin1'\xDF'"
}
@ -1343,12 +1437,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(case when convert(t1.a using utf8mb3) = <cache>(_utf8mb3'a' collate utf8mb3_bin) then NULL else t1.a end)"
}
@ -1376,6 +1472,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"having_condition": "TOP > t2.a",
"filesort": {
"sort_key": "t2.a",
@ -1386,6 +1483,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 256,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1400,6 +1498,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t2.a",
"temporary_table": {
@ -1409,6 +1508,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 256,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1434,6 +1534,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t2.a",
"temporary_table": {
@ -1443,6 +1544,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 256,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1511,6 +1613,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"const_condition": "1",
"nested_loop": [
{
@ -1528,6 +1631,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1543,6 +1647,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "1",
@ -1567,6 +1672,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1588,12 +1694,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -1607,6 +1715,7 @@ EXPLAIN
"used_key_parts": ["pk"],
"ref": ["test.t1.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
"using_index": true,
@ -1625,6 +1734,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1635,6 +1745,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1653,6 +1764,7 @@ ANALYZE
"r_loops": 2,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1677,6 +1789,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"temporary_table": {
"nested_loop": [
{
@ -1684,6 +1797,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a is not null"
}
@ -1698,6 +1812,7 @@ EXPLAIN
"used_key_parts": ["pk"],
"ref": ["test.t1.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true,
"distinct": true
@ -1716,6 +1831,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"temporary_table": {
@ -1727,6 +1843,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1746,6 +1863,7 @@ ANALYZE
"r_loops": 2,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1783,12 +1901,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t3.a is not null"
}
@ -1804,6 +1924,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t3.a"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition_bka": "t4.b + 1 <= t3.b + 1"
},
@ -1825,6 +1946,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1835,6 +1957,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1855,6 +1978,7 @@ ANALYZE
"r_loops": 1,
"rows": 1,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1888,12 +2012,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1904,6 +2030,7 @@ EXPLAIN
"state": "uninitialized",
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"outer_ref_condition": "t0.a < 5",
"nested_loop": [
{
@ -1911,6 +2038,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b < t0.a"
}
@ -1933,6 +2061,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -1942,6 +2071,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1955,6 +2085,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -1964,6 +2095,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1977,6 +2109,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -1986,6 +2119,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2007,12 +2141,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -2024,6 +2160,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -2038,6 +2175,7 @@ EXPLAIN
"table_name": "t3",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 25
},
"buffer_type": "incremental",

View File

@ -11,10 +11,13 @@ drop table if exists t0,t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
--source include/explain-no-costs.inc
explain format=json select * from t0;
--source include/explain-no-costs.inc
explain format=json select * from t0 where 1>2;
--source include/explain-no-costs.inc
explain format=json select * from t0 where a<3;
--echo # Try a basic join
@ -26,22 +29,28 @@ select
'filler'
from t0 a, t0 b, t0 c;
--source include/explain-no-costs.inc
explain format=json select * from t0,t1 where t1.a=t0.a;
--echo # Try range and index_merge
create table t2 (a1 int, a2 int, b1 int, b2 int, key(a1,a2), key(b1,b2));
insert into t2 select a,a,a,a from t1;
--source include/explain-no-costs.inc
explain format=json select * from t2 where a1<5;
--source include/explain-no-costs.inc
explain format=json select * from t2 where a1=1 or b1=2;
--source include/explain-no-costs.inc
explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
--source include/explain-no-costs.inc
explain format=json select * from t2 where (a1=1 and a2=1) or
(b1=2 and b2=1);
--echo # Try ref access on two key components
--source include/explain-no-costs.inc
explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
drop table t1,t2;
@ -49,7 +58,9 @@ drop table t1,t2;
--echo #
--echo # Try a UNION
--echo #
--source include/explain-no-costs.inc
explain format=json select * from t0 A union select * from t0 B;
--source include/explain-no-costs.inc
explain format=json select * from t0 A union all select * from t0 B;
--echo #
@ -57,8 +68,10 @@ explain format=json select * from t0 A union all select * from t0 B;
--echo #
create table t1 (a int, b int);
insert into t1 select a,a from t0;
--source include/explain-no-costs.inc
explain format=json select a, a > (select max(b) from t1 where t1.b=t0.a) from t0;
--source include/explain-no-costs.inc
explain format=json
select * from t0 where
a > (select max(b) from t1 where t1.b=t0.a) or a < 3 ;
@ -71,6 +84,7 @@ drop table t1;
create table t1 (a int, b int);
insert into t1 select tbl1.a+10*tbl2.a, tbl1.a+10*tbl2.a from t0 tbl1, t0 tbl2;
--source include/explain-no-costs.inc
explain format=json
select * from t1 tbl1, t1 tbl2 where tbl1.a=tbl2.a and tbl1.b < 3 and tbl2.b < 5;
@ -79,16 +93,22 @@ drop table t1;
--echo #
--echo # Single-table UPDATE/DELETE, INSERT
--echo #
--source include/explain-no-costs.inc
explain format=json delete from t0;
--source include/explain-no-costs.inc
explain format=json delete from t0 where 1 > 2;
--source include/explain-no-costs.inc
explain format=json delete from t0 where a < 3;
--source include/explain-no-costs.inc
explain format=json update t0 set a=3 where a in (2,3,4);
--source include/explain-no-costs.inc
explain format=json insert into t0 values (1);
create table t1 like t0;
--source include/explain-no-costs.inc
explain format=json insert into t1 values ((select max(a) from t0));
drop table t1;
@ -98,10 +118,12 @@ drop table t1;
--echo #
create table t1 (a int, b int);
insert into t1 select a,a from t0;
--source include/explain-no-costs.inc
explain format=json
select * from (select a, count(*) as cnt from t1 group by a) as tbl
where cnt>0;
--source include/explain-no-costs.inc
explain format=json
select * from (select a, count(*) as cnt from t1 group by a) as tbl1, t1 as
tbl2 where cnt=tbl2.a;
@ -109,6 +131,7 @@ tbl2 where cnt=tbl2.a;
--echo #
--echo # Non-merged semi-join (aka JTBM)
--echo #
--source include/explain-no-costs.inc
explain format=json
select * from t1 where a in (select max(a) from t1 group by b);
@ -117,6 +140,7 @@ select * from t1 where a in (select max(a) from t1 group by b);
--echo #
create table t2 like t1;
insert into t2 select * from t1;
--source include/explain-no-costs.inc
explain format=json
select * from t1,t2 where t1.a in ( select seq+0 from seq_1_to_100);
@ -125,6 +149,7 @@ select * from t1,t2 where t1.a in ( select seq+0 from seq_1_to_100);
--echo #
explain
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
--source include/explain-no-costs.inc
explain format=json
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
@ -135,6 +160,7 @@ set @tmp= @@optimizer_switch;
set optimizer_switch='firstmatch=off';
explain
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
--source include/explain-no-costs.inc
explain format=json
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
set optimizer_switch=@tmp;
@ -149,10 +175,12 @@ insert into t1 select tbl1.a+10*tbl2.a, 12345 from t0 tbl1, t0 tbl2;
set @tmp= @@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
--source include/explain-no-costs.inc
explain format=json select * from t1 where a < 3;
--echo # 'Range checked for each record'
set optimizer_switch=@tmp;
--source include/explain-no-costs.inc
explain format=json
select * from t1 tbl1, t1 tbl2 where tbl2.a < tbl1.b;
@ -169,6 +197,7 @@ INSERT INTO t1 VALUES (1),(2),(5),(6),(7);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4),(9),(10),(11);
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON SELECT * FROM t1 AS outer_t1 WHERE a <> ALL ( SELECT a FROM t1, t2 WHERE b <> outer_t1.a );
DROP TABLE t1,t2;
@ -182,6 +211,7 @@ insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int, b int);
insert into t1 select tbl1.a+10*tbl2.a, 1234 from t0 tbl1, t0 tbl2;
--source include/explain-no-costs.inc
explain format=json
select * from t0
where
@ -200,6 +230,7 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a <> ALL ( SELECT b FROM t2 );
DROP TABLE t1, t2;
@ -221,6 +252,7 @@ insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int, c int, d int, key(a,b,c));
insert into t1 select A.a, B.a, C.a, D.a from t2 A, t2 B, t2 C, t2 D;
explain select count(distinct b) from t1 group by a;
--source include/explain-no-costs.inc
explain format=json select count(distinct b) from t1 group by a;
--source include/analyze-format.inc
analyze format=json select count(distinct b) from t1 group by a;
@ -278,10 +310,13 @@ explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
explain select count(distinct a1,a2,b) from t1 where a1 >= "" and (a2 >= 'b') and (b = 'a');
--source include/explain-no-costs.inc
explain format=json select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
--source include/explain-no-costs.inc
explain format=json select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
--source include/explain-no-costs.inc
explain format=json select count(distinct a1,a2,b) from t1 where a1 >= "" and (a2 >= 'b') and (b = 'a');
drop table t1;
@ -290,6 +325,7 @@ drop table t1;
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('b');
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
DROP TABLE t1;
@ -298,6 +334,7 @@ DROP TABLE t1;
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('A');
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE NULLIF(a,_utf8'a' COLLATE utf8_bin);
DROP TABLE t1;
@ -315,12 +352,16 @@ create table t2 (
);
insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
--echo # normal HAVING
--source include/explain-no-costs.inc
explain format=json select a, max(b) as TOP from t2 group by a having TOP > a;
--echo # HAVING is always TRUE (not printed)
--source include/explain-no-costs.inc
explain format=json select a, max(b) as TOP from t2 group by a having 1<>2;
--echo # HAVING is always FALSE (intercepted by message)
--source include/explain-no-costs.inc
explain format=json select a, max(b) as TOP from t2 group by a having 1=2;
--echo # HAVING is absent
--source include/explain-no-costs.inc
explain format=json select a, max(b) as TOP from t2 group by a;
drop table t0, t1, t2;
@ -332,6 +373,7 @@ drop table t0, t1, t2;
create table t1 (i int) engine=myisam;
explain
select * from t1;
--source include/explain-no-costs.inc
explain format=json
select * from t1;
--source include/analyze-format.inc
@ -348,6 +390,7 @@ insert into t2 values (1),(2);
explain
select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
--source include/explain-no-costs.inc
explain format=json
select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
--source include/analyze-format.inc
@ -357,6 +400,7 @@ select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
--echo # Check ET_NOT_EXISTS:
explain
select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
--source include/explain-no-costs.inc
explain format=json
select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
--source include/analyze-format.inc
@ -366,6 +410,7 @@ select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
--echo # Check ET_DISTINCT
explain
select distinct t1.a from t1 join t2 on t2.pk=t1.a;
--source include/explain-no-costs.inc
explain format=json
select distinct t1.a from t1 join t2 on t2.pk=t1.a;
--source include/analyze-format.inc
@ -392,6 +437,7 @@ set optimizer_switch='mrr=on';
set join_cache_level=6;
explain
select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
--source include/explain-no-costs.inc
explain format=json
select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
--source include/analyze-format.inc
@ -410,6 +456,7 @@ insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int);
insert into t1 select a,a from t0;
--source include/explain-no-costs.inc
explain format=json
select a, (select max(a) from t1 where t0.a<5 and t1.b<t0.a) from t0;
drop table t0,t1;
@ -420,8 +467,11 @@ drop table t0,t1;
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(2,3);
--source include/explain-no-costs.inc
explain format=json select * from t1 order by a, b desc;
--source include/explain-no-costs.inc
explain format=json select * from t1 order by a desc, b desc;
--source include/explain-no-costs.inc
explain format=json select * from t1 order by a desc, b ;
drop table t1;
@ -431,6 +481,7 @@ drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
--source include/explain-no-costs.inc
explain FORMAT=JSON
SELECT * FROM t1 t0
WHERE t0.a IN (SELECT t2.a FROM t1 t2 WHERE t0.a IN (SELECT t3.a FROM t1 t3));

View File

@ -12,6 +12,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -19,6 +20,7 @@ EXPLAIN
"partitions": ["p0"],
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a in (2,3,4)"
}
@ -34,6 +36,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -45,6 +48,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -7,6 +7,7 @@ create table t1 (
) partition by key(a);
insert into t1 select a from t2;
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);
--source include/analyze-format.inc
analyze format=json select * from t1 where a in (2,3,4);

View File

@ -16,12 +16,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -30,12 +32,14 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tbl_alias1",
"access_type": "ALL",
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null"
}
@ -53,6 +57,7 @@ EXPLAIN
"test.tbl_alias1.column_name_1"
],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2"
}

View File

@ -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;
INSERT INTO t3 VALUES (4,'USA'),(5,'CAN');
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE 0 < ALL (
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

View File

@ -447,6 +447,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -467,6 +468,7 @@ ANALYZE
"r_loops": 1,
"rows": 8,
"r_rows": 8,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,7 @@ WHERE t1.c<25 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND formula : pushing into HAVING
@ -60,6 +61,7 @@ WHERE t1.c>55 AND t1.b<4 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted OR formula : pushing into HAVING
@ -78,6 +80,7 @@ WHERE (t1.c>60 OR t1.c<25) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into HAVING
@ -114,6 +118,7 @@ WHERE ((t1.a<2 OR t1.d>3) AND t1.b>1) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # using view IN subquery defINition : pushing into HAVING
@ -132,6 +137,7 @@ WHERE t1.c>20 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equality : pushing into WHERE
@ -150,6 +156,7 @@ WHERE t1.c>20 AND t1.c=v1_y AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE
@ -168,6 +175,7 @@ WHERE t1.a<2 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted AND formula : pushing into WHERE
@ -186,6 +194,7 @@ WHERE t1.a>2 AND t1.a<5 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # extracted OR formula : pushing into WHERE
@ -204,6 +213,7 @@ WHERE (t1.a<2 OR t1.a>=4) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE
@ -258,6 +270,7 @@ WHERE ((t1.b<3 OR t1.d>2) AND t1.a<2) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equalities : pushing into WHERE
@ -276,6 +289,7 @@ WHERE t1.d=1 AND t1.a=t1.d AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equality : pushing into WHERE
@ -294,6 +308,7 @@ WHERE t1.d>1 AND t1.a=t1.d AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # using view IN subquery definition : pushing into WHERE
@ -312,6 +327,7 @@ WHERE t1.a<3 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # using equality : pushing into WHERE
@ -330,6 +346,7 @@ WHERE t1.a=v1_x AND v1_x<2 AND v1_y>30 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE
@ -349,6 +366,7 @@ WHERE ((t1.b<3 OR t1.b=4) AND t1.a<3) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using addition : pushing into HAVING
@ -367,6 +385,7 @@ WHERE (t1.a+t1.c>41) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using substitution : pushing into HAVING
@ -385,6 +404,7 @@ WHERE (t1.c-t1.a<35) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using multiplication : pushing into HAVING
@ -403,6 +423,7 @@ WHERE (t1.c*t1.a>100) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using division : pushing into HAVING
@ -421,6 +442,7 @@ WHERE (t1.c/t1.a>30) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using BETWEEN : pushing into HAVING
@ -439,6 +461,7 @@ WHERE (t1.c BETWEEN 50 AND 100) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using addition : pushing into WHERE
@ -457,6 +480,7 @@ WHERE (t1.a+t1.b > 5) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using substitution : pushing into WHERE
@ -475,6 +499,7 @@ WHERE (t1.a-t1.b > 0) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using multiplication : pushing into WHERE
@ -493,6 +518,7 @@ WHERE (t1.a*t1.b > 6) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using division : pushing into WHERE
@ -511,6 +537,7 @@ WHERE (t1.b/t1.a > 2) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula using BETWEEN : pushing into WHERE
@ -529,6 +556,7 @@ WHERE (t1.a BETWEEN 1 AND 3) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into HAVING of the IN subquery
@ -548,6 +576,7 @@ WHERE t1.c>3 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE of the IN subquery
@ -568,6 +597,7 @@ WHERE t1.a>1 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE and HAVING
@ -589,6 +619,7 @@ WHERE t1.a>1 AND t1.c<100 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE of the IN subquery
@ -615,6 +646,7 @@ WHERE t1.a>1 AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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;
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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;
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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;
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--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;
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE
@ -735,6 +771,7 @@ WHERE (t1.b>1) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
--echo # conjunctive subformula : pushing into WHERE
@ -753,6 +790,7 @@ WHERE (t1.b>1) AND
EVAL $no_pushdown $query;
EVAL $query;
EVAL EXPLAIN $query;
--source include/explain-no-costs.inc
EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1,t2,t3;

View File

@ -265,7 +265,7 @@
drop table t0,t1,t2;
#
# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
@@ -769,11 +769,12 @@
@@ -770,11 +770,12 @@
{
"table": {
"table_name": "t1",
@ -279,9 +279,9 @@
+ "used_key_parts": ["f2"],
+ "ref": ["const"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
@@ -806,8 +807,8 @@
@@ -809,8 +810,8 @@
"access_type": "range",
"possible_keys": ["k1"],
"key": "k1",
@ -290,5 +290,5 @@
+ "key_length": "3007",
+ "used_key_parts": ["pk1", "f2"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",

View File

@ -765,6 +765,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -775,6 +776,7 @@ EXPLAIN
"key_length": "3070",
"used_key_parts": ["f2", "pk1"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
"attached_condition": "t1.f1 <= '3'"
@ -799,6 +801,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -809,6 +812,7 @@ EXPLAIN
"key_length": "3011",
"used_key_parts": ["pk1", "f2", "pk2"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
"attached_condition": "t1.f1 <= '3'"

View File

@ -614,6 +614,7 @@ CREATE TABLE t1 (
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
--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';
drop table t1;
@ -627,6 +628,7 @@ PRIMARY KEY (pk1,pk2),
KEY k1(pk1,f2)
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
--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';
drop table t1;

View File

@ -51,12 +51,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -67,12 +69,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -83,12 +87,14 @@ EXPLAIN
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -115,6 +121,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -125,6 +132,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -138,6 +146,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -148,6 +157,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -161,6 +171,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -171,6 +182,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -192,6 +204,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -202,6 +215,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -217,6 +231,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -227,6 +242,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -240,6 +256,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -250,6 +267,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -263,6 +281,7 @@ ANALYZE
"query_block": {
"select_id": 4,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -273,6 +292,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -346,12 +366,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -362,12 +384,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -377,6 +401,7 @@ EXPLAIN
"table_name": "t3",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -407,6 +432,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -417,6 +443,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -430,6 +457,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -440,6 +468,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -454,6 +483,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -481,6 +511,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -491,6 +522,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -506,6 +538,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -516,6 +549,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -529,6 +563,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -539,6 +574,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -553,6 +589,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -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 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;
--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);
--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);
@ -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 * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
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);
--source include/analyze-format.inc
ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3);

View File

@ -63,12 +63,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -79,12 +81,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -95,12 +99,14 @@ EXPLAIN
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -127,6 +133,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -137,6 +144,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -150,6 +158,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -160,6 +169,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -173,6 +183,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -183,6 +194,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -204,6 +216,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -214,6 +227,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -229,6 +243,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -239,6 +254,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -252,6 +268,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -262,6 +279,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -275,6 +293,7 @@ ANALYZE
"query_block": {
"select_id": 4,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -285,6 +304,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -377,12 +397,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -393,12 +415,14 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -408,6 +432,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -438,6 +463,7 @@ ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -448,6 +474,7 @@ ANALYZE
"r_loops": 1,
"rows": 6,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -461,6 +488,7 @@ ANALYZE
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -471,6 +499,7 @@ ANALYZE
"r_loops": 1,
"rows": 5,
"r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -485,6 +514,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -512,6 +542,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -522,6 +553,7 @@ ANALYZE
"r_loops": 1,
"rows": 6,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -537,6 +569,7 @@ ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -547,6 +580,7 @@ ANALYZE
"r_loops": 1,
"rows": 6,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -560,6 +594,7 @@ ANALYZE
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -570,6 +605,7 @@ ANALYZE
"r_loops": 1,
"rows": 5,
"r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -584,6 +620,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -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 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;
--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);
--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);
@ -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 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;
--source include/explain-no-costs.inc
EXPLAIN format=json (select a,b from t1) intersect all (select c,e from t2,t3);
--source include/analyze-format.inc
ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3);

View File

@ -6254,6 +6254,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -6264,6 +6265,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "a.a <= 10",
"using_index": true
@ -6279,6 +6281,7 @@ EXPLAIN
"key_length": "10",
"used_key_parts": ["kp1", "kp2"],
"rows": 836,
"cost": "COST_REPLACED",
"filtered": 9.090909004,
"index_condition": "b.kp2 <= 10",
"attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333"

View File

@ -4245,6 +4245,7 @@ analyze table t3;
--echo # The following must have "B.col1 + 1 < 33333" attached to table B
--echo # and not to the block-nl-join node:
--source include/explain-no-costs.inc
explain format=json
select *
from t1 a, t3 b

View File

@ -1121,12 +1121,15 @@ INSERT INTO t1 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2);
INSERT INTO t2 (part,a,b) VALUES (0,0,0),(1,1,1),(2,2,2);
--echo # Expecting partition "Current"
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=0 AND t1.part=0;
--echo # Expecting partition "Relevant"
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=2 WHERE t2.part=1 AND t1.part=1;
--echo # Expecting partition "Archive"
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=2 AND t1.part=2;
DROP TABLES t1, t2;

View File

@ -10693,6 +10693,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 1.235599899,
"nested_loop": [
{
"table": {
@ -10703,6 +10704,7 @@ EXPLAIN
"key_length": "8",
"used_key_parts": ["start_date", "end_date"],
"rows": 1000,
"cost": 1.235599899,
"filtered": 100,
"index_condition": "t1.start_date >= '2019-02-10' and t1.end_date < '2019-04-01'"
}
@ -12374,12 +12376,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 2.30309056,
"nested_loop": [
{
"table": {
"table_name": "three",
"access_type": "ALL",
"rows": 3,
"cost": 0.010504815,
"filtered": 100,
"attached_condition": "three.a is not null"
}
@ -12402,6 +12406,7 @@ EXPLAIN
"selectivity_pct": 43.12
},
"rows": 1000,
"cost": 2.292585745,
"filtered": 43.11999893,
"attached_condition": "t1.b < 5000 and t1.c < 1000"
}
@ -12415,12 +12420,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 1.712236739,
"nested_loop": [
{
"table": {
"table_name": "three",
"access_type": "ALL",
"rows": 3,
"cost": 0.010504815,
"filtered": 100
}
},
@ -12431,6 +12438,7 @@ EXPLAIN
"access_type": "ALL",
"possible_keys": ["a", "b"],
"rows": 10000,
"cost": 1.701731924,
"filtered": 4.307688236,
"attached_condition": "t1.b < 5000 and t1.c < 1000"
},

View File

@ -7,6 +7,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -17,6 +18,7 @@ EXPLAIN
"key_length": "21",
"used_key_parts": ["col1"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.col1 >= 'a'"
}

View File

@ -5,6 +5,7 @@ create or replace table t1 (col1 char(10) character set ucs2, filler char(100),
insert into t1 values ('a', 'a');
insert into t1 values ('a', 'a');
set optimizer_trace=1;
--source include/explain-no-costs.inc
explain format=json select * from t1 force index(col1) where col1 >='a';
#enable after fix MDEV-27871
--disable_view_protocol

View File

@ -1564,6 +1564,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1589,6 +1590,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 50,
@ -3455,6 +3457,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -3475,6 +3478,7 @@ ANALYZE
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3804,6 +3808,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -3824,6 +3829,7 @@ ANALYZE
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3970,6 +3976,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -3990,6 +3997,7 @@ ANALYZE
"r_loops": 1,
"rows": 5,
"r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4019,6 +4027,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4039,6 +4048,7 @@ ANALYZE
"r_loops": 1,
"rows": 6,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4074,6 +4084,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4094,6 +4105,7 @@ ANALYZE
"r_loops": 1,
"rows": 6,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4143,6 +4155,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4163,6 +4176,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4325,6 +4339,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -4335,6 +4350,7 @@ ANALYZE
"r_loops": 1,
"rows": 50,
"r_rows": 50,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4349,6 +4365,7 @@ ANALYZE
"r_hit_ratio": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 50,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -4368,6 +4385,7 @@ ANALYZE
"r_loops": 50,
"rows": 50,
"r_rows": 50,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -4466,6 +4484,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -4476,6 +4495,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
@ -4501,6 +4521,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 97,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.b = 3"
}
@ -4537,6 +4558,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -4547,6 +4569,7 @@ EXPLAIN
"access_type": "ALL",
"possible_keys": ["PRIMARY"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -4573,6 +4596,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 97,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.b = 3"
}

View File

@ -2692,6 +2692,7 @@ let $query= SELECT t1.a
ORDER BY t1.a DESC;
eval EXPLAIN $query;
--source include/explain-no-costs.inc
eval EXPLAIN FORMAT=JSON $query;
eval $query;
@ -2701,6 +2702,7 @@ let $query= SELECT t1.a, group_concat(t1.b)
GROUP BY t1.a DESC;
eval EXPLAIN $query;
--source include/explain-no-costs.inc
eval EXPLAIN FORMAT=JSON $query;
eval $query;
DROP TABLE t1, t2;

View File

@ -94,6 +94,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -114,6 +115,7 @@ ANALYZE
"r_loops": 1,
"rows": 10000,
"r_rows": 10000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -258,6 +260,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -279,6 +282,7 @@ ANALYZE
"r_loops": 1,
"rows": 10000,
"r_rows": 10000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -420,6 +424,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -440,6 +445,7 @@ ANALYZE
"r_loops": 1,
"rows": 10000,
"r_rows": 10000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -476,6 +482,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -496,6 +503,7 @@ ANALYZE
"r_loops": 1,
"rows": 10000,
"r_rows": 10000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -2424,6 +2424,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2434,6 +2435,7 @@ EXPLAIN
"key_length": "10",
"used_key_parts": ["a", "b"],
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))"
}
@ -2488,6 +2490,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2498,6 +2501,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))"
}
@ -2518,6 +2522,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2528,6 +2533,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t1.b) in ((4,t1.a - 1),(8,t1.a + 8),(7,t1.a + 7))"
}
@ -2562,6 +2568,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2580,6 +2587,7 @@ EXPLAIN
"selectivity_pct": 60
},
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 60,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))"
@ -2595,6 +2603,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2648,6 +2657,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2666,6 +2676,7 @@ EXPLAIN
"selectivity_pct": 14.42307692
},
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 14.42307663,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
@ -2681,6 +2692,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 73.17073059
}
}
@ -2759,6 +2771,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2777,6 +2790,7 @@ EXPLAIN
"selectivity_pct": 6.730769231
},
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 6.730769157,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
@ -2792,6 +2806,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2823,6 +2838,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2833,6 +2849,7 @@ EXPLAIN
"key_length": "10",
"used_key_parts": ["d", "e"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
@ -2848,6 +2865,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2878,6 +2896,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2888,6 +2907,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 15,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a is not null"
}
@ -2902,6 +2922,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((4,t1.a + 1),(7,t1.a + 1),(8,t1.a + 1)) and octet_length(t2.f) = 1"
}
@ -2941,6 +2962,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2948,6 +2970,7 @@ EXPLAIN
"access_type": "ALL",
"possible_keys": ["idx"],
"rows": 144,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a is not null"
}
@ -2962,6 +2985,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
}
@ -2995,6 +3019,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -3005,6 +3030,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and octet_length(t1.c) = 1"
@ -3020,6 +3046,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "octet_length(t2.f) = 1"
}
@ -3078,6 +3105,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -3101,6 +3129,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and octet_length(t1.c) = 1"
@ -3116,6 +3145,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "octet_length(t2.f) = 1"
}

View File

@ -1920,6 +1920,7 @@ insert into t1 values
let $q1=
select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
eval explain $q1;
--source include/explain-no-costs.inc
eval explain format=json $q1;
eval $q1;
eval prepare stmt from "$q1";
@ -1931,6 +1932,7 @@ deallocate prepare stmt;
let $q2=
select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
eval explain $q2;
--source include/explain-no-costs.inc
eval explain format=json $q2;
eval $q2;
@ -1938,6 +1940,7 @@ eval $q2;
let $q3=
select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
eval explain $q3;
--source include/explain-no-costs.inc
eval explain format=json $q3;
eval $q3;
@ -1961,6 +1964,7 @@ let $q4=
select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(2,2));
eval explain $q4;
--source include/explain-no-costs.inc
eval explain format=json $q4;
eval $q4;
@ -1986,6 +1990,7 @@ let $q5=
select * from t1,t2
where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
eval explain $q5;
--source include/explain-no-costs.inc
eval explain format=json $q5;
--sorted_result
eval $q5;
@ -2004,6 +2009,7 @@ let $q6=
select * from t1,t2
where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
eval explain $q6;
--source include/explain-no-costs.inc
eval explain format=json $q6;
--sorted_result
eval $q6;
@ -2016,6 +2022,7 @@ let $q7=
select * from t1,t2
where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
eval explain $q7;
--source include/explain-no-costs.inc
eval explain format=json $q7;
eval $q7;
@ -2025,6 +2032,7 @@ let $q8=
select * from t1,t2
where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
eval explain $q8;
--source include/explain-no-costs.inc
eval explain format=json $q8;
--sorted_result
eval $q8;
@ -2035,6 +2043,7 @@ let $q9=
select * from t1,t2
where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
eval explain $q9;
--source include/explain-no-costs.inc
eval explain format=json $q9;
--sorted_result
eval $q9;
@ -2046,6 +2055,7 @@ select * from t1,t2
where a = d and (a,2) in ((2,2),(7,7),(8,8)) and
length(c) = 1 and length(f) = 1;
eval explain $q10;
--source include/explain-no-costs.inc
eval explain format=json $q10;
eval $q10;
eval prepare stmt from "$q10";
@ -2066,6 +2076,7 @@ select * from t1,t2,t3
(a,v+1) in ((2,2),(7,7),(8,8)) and
length(c) = 1 and length(f) = 1;
eval explain $q11;
--source include/explain-no-costs.inc
eval explain format=json $q11;
eval $q11;

View File

@ -2427,6 +2427,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2437,6 +2438,7 @@ EXPLAIN
"key_length": "10",
"used_key_parts": ["a", "b"],
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))",
"mrr_type": "Rowid-ordered scan"
@ -2492,6 +2494,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2502,6 +2505,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))",
"mrr_type": "Rowid-ordered scan"
@ -2523,6 +2527,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2533,6 +2538,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t1.b) in ((4,t1.a - 1),(8,t1.a + 8),(7,t1.a + 7))",
"mrr_type": "Rowid-ordered scan"
@ -2568,6 +2574,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2578,6 +2585,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["d"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 60,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))",
@ -2594,6 +2602,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2647,6 +2656,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2657,6 +2667,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["d"],
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 14.42307663,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
@ -2673,6 +2684,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 73.17073059
}
}
@ -2751,6 +2763,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2761,6 +2774,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["d"],
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 6.730769157,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
@ -2777,6 +2791,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2808,6 +2823,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2818,6 +2834,7 @@ EXPLAIN
"key_length": "10",
"used_key_parts": ["d", "e"],
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1",
@ -2834,6 +2851,7 @@ EXPLAIN
"used_key_parts": ["a"],
"ref": ["test.t2.d"],
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2864,6 +2882,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2874,6 +2893,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 15,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a is not null",
"mrr_type": "Rowid-ordered scan"
@ -2889,6 +2909,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((4,t1.a + 1),(7,t1.a + 1),(8,t1.a + 1)) and octet_length(t2.f) = 1"
}
@ -2928,6 +2949,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2935,6 +2957,7 @@ EXPLAIN
"access_type": "ALL",
"possible_keys": ["idx"],
"rows": 144,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a is not null"
}
@ -2949,6 +2972,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1"
}
@ -2982,6 +3006,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2992,6 +3017,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and octet_length(t1.c) = 1",
@ -3008,6 +3034,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "octet_length(t2.f) = 1"
}
@ -3066,6 +3093,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -3089,6 +3117,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and octet_length(t1.c) = 1",
@ -3105,6 +3134,7 @@ EXPLAIN
"used_key_parts": ["d"],
"ref": ["test.t1.a"],
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "octet_length(t2.f) = 1"
}

View File

@ -77,6 +77,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -95,6 +96,7 @@ EXPLAIN
"selectivity_pct": 11.69025812
},
"rows": 509,
"cost": "COST_REPLACED",
"filtered": 11.69025803,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -118,6 +120,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -145,6 +148,7 @@ ANALYZE
"r_loops": 1,
"rows": 509,
"r_rows": 60,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 11.69025803,
@ -232,6 +236,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -242,6 +247,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 509,
"cost": "COST_REPLACED",
"filtered": 11.69025803,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -265,6 +271,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -279,6 +286,7 @@ ANALYZE
"r_loops": 1,
"rows": 509,
"r_rows": 510,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 11.69025803,
@ -369,6 +377,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -379,6 +388,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 69,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -406,6 +416,7 @@ EXPLAIN
"selectivity_pct": 1.631973356
},
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 1.631973386,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
}
@ -431,6 +442,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -445,6 +457,7 @@ ANALYZE
"r_loops": 1,
"rows": 69,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -482,6 +495,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 0.154929577,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 1.631973386,
@ -523,6 +537,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -538,6 +553,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 98,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
}
@ -552,6 +568,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 4.599999905,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -577,6 +594,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -596,6 +614,7 @@ ANALYZE
"r_loops": 1,
"rows": 98,
"r_rows": 98,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -615,6 +634,7 @@ ANALYZE
"r_loops": 98,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 4.599999905,
@ -658,6 +678,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -682,6 +703,7 @@ EXPLAIN
"selectivity_pct": 11.69025812
},
"rows": 509,
"cost": "COST_REPLACED",
"filtered": 11.69025803,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -705,6 +727,7 @@ EXPLAIN
"selectivity_pct": 9.266666667
},
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 9.266666412,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
@ -732,6 +755,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -765,6 +789,7 @@ ANALYZE
"r_loops": 1,
"rows": 509,
"r_rows": 60,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 11.69025803,
@ -798,6 +823,7 @@ ANALYZE
"r_loops": 60,
"rows": 1,
"r_rows": 0.266666667,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 9.266666412,
@ -847,6 +873,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -863,6 +890,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 509,
"cost": "COST_REPLACED",
"filtered": 11.69025803,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -878,6 +906,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 9.266666412,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
@ -905,6 +934,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -925,6 +955,7 @@ ANALYZE
"r_loops": 1,
"rows": 509,
"r_rows": 510,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 11.69025803,
@ -945,6 +976,7 @@ ANALYZE
"r_loops": 60,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 9.266666412,
@ -1000,6 +1032,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1010,6 +1043,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 69,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -1037,6 +1071,7 @@ EXPLAIN
"selectivity_pct": 8.476269775
},
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 8.476269722,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
@ -1062,6 +1097,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1076,6 +1112,7 @@ ANALYZE
"r_loops": 1,
"rows": 69,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1113,6 +1150,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 0.521126761,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.476269722,
@ -1180,6 +1218,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1190,6 +1229,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 69,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -1209,6 +1249,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 8.476269722,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
@ -1234,6 +1275,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1248,6 +1290,7 @@ ANALYZE
"r_loops": 1,
"rows": 69,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1272,6 +1315,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 6.704225352,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.476269722,
@ -1350,6 +1394,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1366,6 +1411,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_receiptDATE"],
"rows": 18,
"cost": "COST_REPLACED",
"filtered": 0.566194832,
"index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-10-10'"
@ -1381,6 +1427,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 7.466666698,
"attached_condition": "orders.o_totalprice between 200000 and 250000"
}
@ -1410,6 +1457,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1430,6 +1478,7 @@ ANALYZE
"r_loops": 1,
"rows": 18,
"r_rows": 18,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.566194832,
@ -1450,6 +1499,7 @@ ANALYZE
"r_loops": 7,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 7.466666698,
@ -1487,6 +1537,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1503,6 +1554,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_receiptDATE"],
"rows": 18,
"cost": "COST_REPLACED",
"filtered": 0.566194832,
"index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-10-10'"
@ -1518,6 +1570,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 7.466666698,
"attached_condition": "orders.o_totalprice between 200000 and 250000"
}
@ -1547,6 +1600,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1567,6 +1621,7 @@ ANALYZE
"r_loops": 1,
"rows": 18,
"r_rows": 18,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.566194832,
@ -1587,6 +1642,7 @@ ANALYZE
"r_loops": 7,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 7.466666698,
@ -1631,6 +1687,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1641,6 +1698,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 39,
"cost": "COST_REPLACED",
"filtered": 3.200000048,
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000"
@ -1669,6 +1727,7 @@ EXPLAIN
"selectivity_pct": 3.04746045
},
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 3.047460556,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1698,6 +1757,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1712,6 +1772,7 @@ ANALYZE
"r_loops": 1,
"rows": 39,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.200000048,
@ -1750,6 +1811,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.047460556,
@ -1790,6 +1852,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1800,6 +1863,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 39,
"cost": "COST_REPLACED",
"filtered": 3.200000048,
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000"
@ -1820,6 +1884,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 3.047460556,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1849,6 +1914,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1863,6 +1929,7 @@ ANALYZE
"r_loops": 1,
"rows": 39,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.200000048,
@ -1888,6 +1955,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.047460556,
@ -1931,6 +1999,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -1946,6 +2015,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 39,
"cost": "REPLACED",
"filtered": "REPLACED",
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
@ -1966,6 +2036,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "REPLACED",
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1995,6 +2066,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2014,6 +2086,7 @@ ANALYZE
"r_loops": 1,
"rows": 39,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2039,6 +2112,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2079,6 +2153,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -2094,6 +2169,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 39,
"cost": "REPLACED",
"filtered": "REPLACED",
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
@ -2114,6 +2190,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "REPLACED",
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -2143,6 +2220,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2162,6 +2240,7 @@ ANALYZE
"r_loops": 1,
"rows": 39,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2187,6 +2266,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",

View File

@ -55,6 +55,7 @@ SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
l_quantity > 45;
eval $with_filter EXPLAIN $q1;
--source include/explain-no-costs.inc
eval $with_filter EXPLAIN FORMAT=JSON $q1;
eval $with_filter ANALYZE $q1;
--source include/analyze-format.inc
@ -63,6 +64,7 @@ eval $with_filter ANALYZE FORMAT=JSON $q1;
eval $with_filter $q1;
eval $without_filter EXPLAIN $q1;
--source include/explain-no-costs.inc
eval $without_filter EXPLAIN FORMAT=JSON $q1;
eval $without_filter ANALYZE $q1;
--source include/analyze-format.inc
@ -77,6 +79,7 @@ SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
o_totalprice between 200000 and 230000;
eval $with_filter EXPLAIN $q2;
--source include/explain-no-costs.inc
eval $with_filter EXPLAIN FORMAT=JSON $q2;
eval $with_filter ANALYZE $q2;
--source include/analyze-format.inc
@ -85,6 +88,7 @@ eval $with_filter ANALYZE FORMAT=JSON $q2;
eval $with_filter $q2;
eval $without_filter EXPLAIN $q2;
--source include/explain-no-costs.inc
eval $without_filter EXPLAIN FORMAT=JSON $q2;
eval $without_filter ANALYZE $q2;
--source include/analyze-format.inc
@ -100,6 +104,7 @@ SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
o_totalprice between 180000 and 230000;
eval $with_filter EXPLAIN $q3;
--source include/explain-no-costs.inc
eval $with_filter EXPLAIN FORMAT=JSON $q3;
eval $with_filter ANALYZE $q3;
--source include/analyze-format.inc
@ -108,6 +113,7 @@ eval $with_filter ANALYZE FORMAT=JSON $q3;
eval $with_filter $q3;
eval $without_filter EXPLAIN $q3;
--source include/explain-no-costs.inc
eval $without_filter EXPLAIN FORMAT=JSON $q3;
eval $without_filter ANALYZE $q3;
--source include/analyze-format.inc
@ -129,6 +135,7 @@ SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
o_totalprice between 200000 and 230000;
eval $with_filter EXPLAIN $q4;
--source include/explain-no-costs.inc
eval $with_filter EXPLAIN FORMAT=JSON $q4;
eval $with_filter ANALYZE $q4;
--source include/analyze-format.inc
@ -137,6 +144,7 @@ eval $with_filter ANALYZE FORMAT=JSON $q4;
eval $with_filter $q4;
eval $without_filter EXPLAIN $q4;
--source include/explain-no-costs.inc
eval $without_filter EXPLAIN FORMAT=JSON $q4;
eval $without_filter ANALYZE $q4;
--source include/analyze-format.inc
@ -162,6 +170,7 @@ WHERE o_orderkey=l_orderkey AND
o_totalprice BETWEEN 200000 AND 250000;
eval $with_filter EXPLAIN $q5;
--source include/explain-no-costs.inc
eval $with_filter EXPLAIN FORMAT=JSON $q5;
eval $with_filter ANALYZE $q5;
--source include/analyze-format.inc
@ -170,6 +179,7 @@ eval $with_filter ANALYZE FORMAT=JSON $q5;
eval $with_filter $q5;
eval $without_filter EXPLAIN $q5;
--source include/explain-no-costs.inc
eval $without_filter EXPLAIN FORMAT=JSON $q5;
eval $without_filter ANALYZE $q5;
--source include/analyze-format.inc
@ -195,6 +205,7 @@ WHERE o_orderkey=l_orderkey AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
eval $with_filter EXPLAIN $q6;
--source include/explain-no-costs.inc
eval $with_filter EXPLAIN FORMAT=JSON $q6;
eval $with_filter ANALYZE $q6;
--source include/analyze-format.inc
@ -203,6 +214,7 @@ eval $with_filter ANALYZE FORMAT=JSON $q6;
eval $with_filter $q6;
eval $without_filter EXPLAIN $q6;
--source include/explain-no-costs.inc
eval $without_filter EXPLAIN FORMAT=JSON $q6;
eval $without_filter ANALYZE $q6;
--source include/analyze-format.inc
@ -223,21 +235,21 @@ WHERE o_orderkey=l_orderkey AND
l_shipdate BETWEEN '1996-10-01' AND '1996-12-01';
eval $with_filter EXPLAIN $q7;
--replace_regex /"filtered": [0-9e\.\-+]*,/"filtered": "REPLACED",/
--source include/explain-no-costs-filtered.inc
eval $with_filter EXPLAIN FORMAT=JSON $q7;
--replace_column 11 #
eval $with_filter ANALYZE $q7;
--replace_regex /("(r_(total|table|other)_time_ms|r_buffer_size|r_filling_time_ms|filtered)": )[^, \n]*/\1"REPLACED"/
--source include/analyze-no-filtered.inc
eval $with_filter ANALYZE FORMAT=JSON $q7;
--sorted_result
eval $with_filter $q7;
eval $without_filter EXPLAIN $q7;
--replace_regex /"filtered": [0-9e\.\-+]*,/"filtered": "REPLACED",/
--source include/explain-no-costs-filtered.inc
eval $without_filter EXPLAIN FORMAT=JSON $q7;
--replace_column 11 #
eval $without_filter ANALYZE $q7;
--replace_regex /("(r_(total|table|other)_time_ms|r_buffer_size|r_filling_time_ms|filtered)": )[^, \n]*/\1"REPLACED"/
--source include/analyze-no-filtered.inc
eval $without_filter ANALYZE FORMAT=JSON $q7;
--sorted_result
eval $without_filter $q7;

View File

@ -78,6 +78,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -96,6 +97,7 @@ EXPLAIN
"selectivity_pct": 15.80349709
},
"rows": 482,
"cost": "COST_REPLACED",
"filtered": 15.80349731,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -119,6 +121,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -146,6 +149,7 @@ ANALYZE
"r_loops": 1,
"rows": 482,
"r_rows": 60,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 15.80349731,
@ -233,6 +237,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -243,6 +248,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 482,
"cost": "COST_REPLACED",
"filtered": 15.80349731,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -266,6 +272,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -280,6 +287,7 @@ ANALYZE
"r_loops": 1,
"rows": 482,
"r_rows": 510,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 15.80349731,
@ -370,6 +378,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -385,6 +394,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 92,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
}
@ -407,6 +417,7 @@ EXPLAIN
"selectivity_pct": 7.066666667
},
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 7.066666603,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -432,6 +443,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -451,6 +463,7 @@ ANALYZE
"r_loops": 1,
"rows": 92,
"r_rows": 98,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -483,6 +496,7 @@ ANALYZE
"r_loops": 98,
"rows": 1,
"r_rows": 0.112244898,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 7.066666603,
@ -524,6 +538,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -539,6 +554,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 92,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
}
@ -553,6 +569,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 7.066666603,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -578,6 +595,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -597,6 +615,7 @@ ANALYZE
"r_loops": 1,
"rows": 92,
"r_rows": 98,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -616,6 +635,7 @@ ANALYZE
"r_loops": 98,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 7.066666603,
@ -659,6 +679,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -683,6 +704,7 @@ EXPLAIN
"selectivity_pct": 15.80349709
},
"rows": 482,
"cost": "COST_REPLACED",
"filtered": 15.80349731,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -706,6 +728,7 @@ EXPLAIN
"selectivity_pct": 14.4
},
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 14.39999962,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
@ -733,6 +756,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -766,6 +790,7 @@ ANALYZE
"r_loops": 1,
"rows": 482,
"r_rows": 60,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 15.80349731,
@ -799,6 +824,7 @@ ANALYZE
"r_loops": 60,
"rows": 1,
"r_rows": 0.266666667,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 14.39999962,
@ -848,6 +874,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -864,6 +891,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 482,
"cost": "COST_REPLACED",
"filtered": 15.80349731,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -879,6 +907,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 14.39999962,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
@ -906,6 +935,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -926,6 +956,7 @@ ANALYZE
"r_loops": 1,
"rows": 482,
"r_rows": 510,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 15.80349731,
@ -946,6 +977,7 @@ ANALYZE
"r_loops": 60,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 14.39999962,
@ -1001,6 +1033,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1011,6 +1044,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 106,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -1038,6 +1072,7 @@ EXPLAIN
"selectivity_pct": 8.026644463
},
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 8.026644707,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
@ -1063,6 +1098,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1077,6 +1113,7 @@ ANALYZE
"r_loops": 1,
"rows": 106,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1114,6 +1151,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 0.521126761,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.026644707,
@ -1181,6 +1219,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1191,6 +1230,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 106,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -1210,6 +1250,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 8.026644707,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
@ -1235,6 +1276,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1249,6 +1291,7 @@ ANALYZE
"r_loops": 1,
"rows": 106,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1273,6 +1316,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 6.704225352,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.026644707,
@ -1351,6 +1395,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1367,6 +1412,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_receiptDATE"],
"rows": 17,
"cost": "COST_REPLACED",
"filtered": 0.532889247,
"index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-10-10'"
@ -1382,6 +1428,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 8.466666222,
"attached_condition": "orders.o_totalprice between 200000 and 250000"
}
@ -1411,6 +1458,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1431,6 +1479,7 @@ ANALYZE
"r_loops": 1,
"rows": 17,
"r_rows": 18,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.532889247,
@ -1451,6 +1500,7 @@ ANALYZE
"r_loops": 7,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.466666222,
@ -1488,6 +1538,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1504,6 +1555,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_receiptDATE"],
"rows": 17,
"cost": "COST_REPLACED",
"filtered": 0.532889247,
"index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-10-10'"
@ -1519,6 +1571,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 8.466666222,
"attached_condition": "orders.o_totalprice between 200000 and 250000"
}
@ -1548,6 +1601,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1568,6 +1622,7 @@ ANALYZE
"r_loops": 1,
"rows": 17,
"r_rows": 18,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.532889247,
@ -1588,6 +1643,7 @@ ANALYZE
"r_loops": 7,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.466666222,
@ -1632,6 +1688,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1642,6 +1699,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 61,
"cost": "COST_REPLACED",
"filtered": 5,
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000"
@ -1670,6 +1728,7 @@ EXPLAIN
"selectivity_pct": 2.897585346
},
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 2.897585392,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1699,6 +1758,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1713,6 +1773,7 @@ ANALYZE
"r_loops": 1,
"rows": 61,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 5,
@ -1751,6 +1812,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 2.897585392,
@ -1791,6 +1853,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1801,6 +1864,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 61,
"cost": "COST_REPLACED",
"filtered": 5,
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000"
@ -1821,6 +1885,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 2.897585392,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1850,6 +1915,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1864,6 +1930,7 @@ ANALYZE
"r_loops": 1,
"rows": 61,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 5,
@ -1889,6 +1956,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 2.897585392,
@ -1932,6 +2000,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -1947,6 +2016,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 61,
"cost": "REPLACED",
"filtered": "REPLACED",
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
@ -1967,6 +2037,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "REPLACED",
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1996,6 +2067,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2015,6 +2087,7 @@ ANALYZE
"r_loops": 1,
"rows": 61,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2040,6 +2113,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2080,6 +2154,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -2095,6 +2170,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 61,
"cost": "REPLACED",
"filtered": "REPLACED",
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
@ -2115,6 +2191,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "REPLACED",
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -2144,6 +2221,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2163,6 +2241,7 @@ ANALYZE
"r_loops": 1,
"rows": 61,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2188,6 +2267,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",

View File

@ -80,6 +80,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -98,6 +99,7 @@ EXPLAIN
"selectivity_pct": 10.07493755
},
"rows": 510,
"cost": "COST_REPLACED",
"filtered": 10.07493782,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -121,6 +123,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -148,6 +151,7 @@ ANALYZE
"r_loops": 1,
"rows": 510,
"r_rows": 60,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 10.07493782,
@ -235,6 +239,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -245,6 +250,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 510,
"cost": "COST_REPLACED",
"filtered": 10.07493782,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -268,6 +274,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -282,6 +289,7 @@ ANALYZE
"r_loops": 1,
"rows": 510,
"r_rows": 510,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 10.07493782,
@ -372,6 +380,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -387,6 +396,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 98,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
"using_index": true
@ -402,6 +412,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 4.733333111,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -427,6 +438,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -446,6 +458,7 @@ ANALYZE
"r_loops": 1,
"rows": 98,
"r_rows": 98,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -466,6 +479,7 @@ ANALYZE
"r_loops": 98,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 4.733333111,
@ -507,6 +521,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -522,6 +537,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_shipDATE"],
"rows": 98,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
"using_index": true
@ -537,6 +553,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 4.733333111,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
@ -562,6 +579,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -581,6 +599,7 @@ ANALYZE
"r_loops": 1,
"rows": 98,
"r_rows": 98,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -601,6 +620,7 @@ ANALYZE
"r_loops": 98,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 4.733333111,
@ -644,6 +664,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -668,6 +689,7 @@ EXPLAIN
"selectivity_pct": 10.07493755
},
"rows": 510,
"cost": "COST_REPLACED",
"filtered": 10.07493782,
"index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
"attached_condition": "lineitem.l_quantity > 45"
@ -683,6 +705,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 9.600000381,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
@ -710,6 +733,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -743,6 +767,7 @@ ANALYZE
"r_loops": 1,
"rows": 510,
"r_rows": 60,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 10.07493782,
@ -763,6 +788,7 @@ ANALYZE
"r_loops": 60,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 9.600000381,
@ -812,6 +838,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -822,6 +849,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 144,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "orders.o_totalprice between 180000 and 230000",
"using_index": true
@ -843,6 +871,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 0.855656624,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45"
}
@ -870,6 +899,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -884,6 +914,7 @@ ANALYZE
"r_loops": 1,
"rows": 144,
"r_rows": 144,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -910,6 +941,7 @@ ANALYZE
"r_loops": 144,
"rows": 4,
"r_rows": 6.625,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.855656624,
@ -965,6 +997,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -975,6 +1008,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 71,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "orders.o_totalprice between 200000 and 230000",
"using_index": true
@ -995,6 +1029,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 8.492922783,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
@ -1020,6 +1055,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1034,6 +1070,7 @@ ANALYZE
"r_loops": 1,
"rows": 71,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1059,6 +1096,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 6.704225352,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.492922783,
@ -1126,6 +1164,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1136,6 +1175,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totalprice"],
"rows": 71,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "orders.o_totalprice between 200000 and 230000",
"using_index": true
@ -1156,6 +1196,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 8.492922783,
"attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
}
@ -1181,6 +1222,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1195,6 +1237,7 @@ ANALYZE
"r_loops": 1,
"rows": 71,
"r_rows": 71,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -1220,6 +1263,7 @@ ANALYZE
"r_loops": 71,
"rows": 4,
"r_rows": 6.704225352,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.492922783,
@ -1298,6 +1342,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1314,6 +1359,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_receiptDATE"],
"rows": 18,
"cost": "COST_REPLACED",
"filtered": 0.566194832,
"index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-10-10'"
@ -1329,6 +1375,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 5.666666508,
"attached_condition": "orders.o_totalprice between 200000 and 250000"
}
@ -1358,6 +1405,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1378,6 +1426,7 @@ ANALYZE
"r_loops": 1,
"rows": 18,
"r_rows": 18,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.566194832,
@ -1398,6 +1447,7 @@ ANALYZE
"r_loops": 7,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 5.666666508,
@ -1435,6 +1485,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1451,6 +1502,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["l_receiptDATE"],
"rows": 18,
"cost": "COST_REPLACED",
"filtered": 0.566194832,
"index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-10-10'"
@ -1466,6 +1518,7 @@ EXPLAIN
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 5.666666508,
"attached_condition": "orders.o_totalprice between 200000 and 250000"
}
@ -1495,6 +1548,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1515,6 +1569,7 @@ ANALYZE
"r_loops": 1,
"rows": 18,
"r_rows": 18,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 0.566194832,
@ -1535,6 +1590,7 @@ ANALYZE
"r_loops": 7,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 5.666666508,
@ -1579,6 +1635,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1589,6 +1646,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 41,
"cost": "COST_REPLACED",
"filtered": 3.333333254,
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000"
@ -1609,6 +1667,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 3.047460556,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1638,6 +1697,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1652,6 +1712,7 @@ ANALYZE
"r_loops": 1,
"rows": 41,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.333333254,
@ -1677,6 +1738,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.047460556,
@ -1717,6 +1779,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -1727,6 +1790,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 41,
"cost": "COST_REPLACED",
"filtered": 3.333333254,
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000"
@ -1747,6 +1811,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 3.047460556,
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1776,6 +1841,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1790,6 +1856,7 @@ ANALYZE
"r_loops": 1,
"rows": 41,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.333333254,
@ -1815,6 +1882,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 3.047460556,
@ -1858,6 +1926,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -1873,6 +1942,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 41,
"cost": "REPLACED",
"filtered": "REPLACED",
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
@ -1893,6 +1963,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "REPLACED",
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -1922,6 +1993,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -1941,6 +2013,7 @@ ANALYZE
"r_loops": 1,
"rows": 41,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -1966,6 +2039,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2006,6 +2080,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -2021,6 +2096,7 @@ EXPLAIN
"key_length": "9",
"used_key_parts": ["o_totaldiscount"],
"rows": 41,
"cost": "REPLACED",
"filtered": "REPLACED",
"index_condition": "orders.o_totaldiscount between 18000 and 20000",
"attached_condition": "orders.o_totalprice between 200000 and 220000 and orders.o_orderDATE between '1992-12-01' and '1997-01-01'"
@ -2041,6 +2117,7 @@ EXPLAIN
"used_key_parts": ["l_orderkey"],
"ref": ["dbt3_s001.orders.o_orderkey"],
"rows": 4,
"cost": "REPLACED",
"filtered": "REPLACED",
"attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
}
@ -2070,6 +2147,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2089,6 +2167,7 @@ ANALYZE
"r_loops": 1,
"rows": 41,
"r_rows": 41,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2114,6 +2193,7 @@ ANALYZE
"r_loops": 1,
"rows": 4,
"r_rows": 6,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": "REPLACED",
@ -2199,6 +2279,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2218,6 +2299,7 @@ EXPLAIN
"selectivity_pct": 1.587301587
},
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 1.587301612,
"index_condition": "t1.f1 is null",
"attached_condition": "t1.f2 is null and (t1.f2 between 'a' and 'z' or t1.f1 = 'a')"
@ -2230,6 +2312,7 @@ EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -2249,6 +2332,7 @@ EXPLAIN
"selectivity_pct": 1.587301587
},
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 1.587301612,
"index_condition": "t1.f1 is null",
"attached_condition": "t1.f2 is null and (t1.f2 between 'a' and 'z' or t1.f1 = 'a')"
@ -3203,6 +3287,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -3231,6 +3316,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3252,6 +3338,7 @@ ANALYZE
"r_loops": 1,
"rows": 1,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -3292,6 +3379,7 @@ ANALYZE
"r_loops": 1,
"rows": 24,
"r_rows": 32,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 14.46428585,

View File

@ -49,6 +49,7 @@ let $q=
eval $q;
eval explain $q;
--source include/explain-no-costs.inc
eval explain format=json $q;
drop table t1;

View File

@ -136,12 +136,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 101,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null"
}
@ -164,6 +166,7 @@ EXPLAIN
"selectivity_pct": 87
},
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 87,
"attached_condition": "t1.b1 <= (subquery#2)"
}
@ -173,6 +176,7 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -183,6 +187,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["pk2"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t2.pk2 <= 1"
}
@ -339,6 +344,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -353,6 +359,7 @@ ANALYZE
"r_loops": 1,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 49.20000076,
@ -392,6 +399,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -406,6 +414,7 @@ ANALYZE
"r_loops": 1,
"rows": 1,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 49.20000076,
@ -470,6 +479,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -498,6 +508,7 @@ ANALYZE
"r_loops": 1,
"rows": 55,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 1.149999976,
@ -584,6 +595,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -611,6 +623,7 @@ ANALYZE
"r_loops": 1,
"rows": 44,
"r_rows": 0,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.630000114,
@ -650,6 +663,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -677,6 +691,7 @@ ANALYZE
"r_loops": 1,
"rows": 44,
"r_rows": 0,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 8.529999733,

View File

@ -1735,6 +1735,7 @@ SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 )
eval $q;
eval EXPLAIN EXTENDED $q;
--source include/explain-no-costs.inc
eval EXPLAIN FORMAT=JSON $q;
DROP TABLE t1,t2;

View File

@ -571,12 +571,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
}
@ -587,12 +589,14 @@ EXPLAIN
"query_block": {
"select_id": 8,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -603,12 +607,14 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 6,
"cost": "REPLACED",
"filtered": 100
}
}
@ -628,12 +634,14 @@ EXPLAIN
"query_block": {
"select_id": 4,
"operation": "INTERSECT",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived5>",
"access_type": "ALL",
"rows": 10,
"cost": "REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -642,12 +650,14 @@ EXPLAIN
{
"query_block": {
"select_id": 5,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
}
@ -658,12 +668,14 @@ EXPLAIN
"query_block": {
"select_id": 6,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
}
@ -692,12 +704,14 @@ EXPLAIN
"query_block": {
"select_id": 7,
"operation": "EXCEPT",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
}
@ -708,12 +722,14 @@ EXPLAIN
"query_block": {
"select_id": 9,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 6,
"cost": "REPLACED",
"filtered": 100
}
}
@ -724,12 +740,14 @@ EXPLAIN
"query_block": {
"select_id": 10,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
}
@ -740,12 +758,14 @@ EXPLAIN
"query_block": {
"select_id": 11,
"operation": "EXCEPT",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
},
@ -755,6 +775,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 6,
"cost": "REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -769,12 +790,14 @@ EXPLAIN
"query_block": {
"select_id": 12,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100,
"attached_condition": "t1.a < 4"
}
@ -785,6 +808,7 @@ EXPLAIN
"table_name": "t2",
"access_type": "ALL",
"rows": 6,
"cost": "REPLACED",
"filtered": 100
},
"buffer_type": "flat",
@ -799,12 +823,14 @@ EXPLAIN
"query_block": {
"select_id": 13,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 5,
"cost": "REPLACED",
"filtered": 100
}
}

View File

@ -272,6 +272,7 @@ select * from v0 where g < 4
UNION ALL
select * from t3;
--source include/analyze-format.inc
EXPLAIN format=json
select * from t1
UNION ALL

View File

@ -405,6 +405,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
@ -424,6 +425,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -44,6 +44,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -53,6 +54,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 1000,
"r_rows": 1000,
"cost": "REPLACED",
"filtered": 50,
"r_filtered": 50,
"attached_condition": "t1.c < 500"
@ -77,6 +79,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -86,6 +89,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 1000,
"r_rows": 1000,
"cost": "REPLACED",
"filtered": 10,
"r_filtered": 10,
"attached_condition": "t1.c < 10"
@ -111,6 +115,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -122,6 +127,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 1000,
"r_rows": 1000,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 99.90000153,
@ -160,6 +166,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -169,6 +176,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 60,
"attached_condition": "a.a <= 5"
@ -181,6 +189,7 @@ SHOW ANALYZE
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -189,6 +198,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "b.a >= 9"
@ -229,6 +239,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -238,6 +249,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 60,
"attached_condition": "a.a <= 5"
@ -250,6 +262,7 @@ SHOW ANALYZE
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -259,6 +272,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 10,
"attached_condition": "b.a >= 9"
@ -299,6 +313,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -309,6 +324,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -323,6 +339,7 @@ SHOW ANALYZE
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -331,6 +348,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "b.a >= 9"
@ -371,6 +389,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -381,6 +400,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -395,6 +415,7 @@ SHOW ANALYZE
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -405,6 +426,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -441,6 +463,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -450,6 +473,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 20,
"attached_condition": "a.a < 2"
@ -460,6 +484,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -469,6 +494,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 30,
"attached_condition": "b.a > 6"
@ -501,6 +527,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -511,6 +538,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -523,6 +551,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -533,6 +562,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -567,6 +597,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -575,6 +606,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "a.a < 2"
@ -588,6 +620,7 @@ SHOW ANALYZE
"r_loops": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -596,6 +629,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "b.a + a.a < 10"
@ -629,6 +663,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -638,6 +673,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 20,
"attached_condition": "a.a < 2"
@ -651,6 +687,7 @@ SHOW ANALYZE
"r_hit_ratio": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 2,
"nested_loop": [
{
@ -660,6 +697,7 @@ SHOW ANALYZE
"r_loops": 2,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 95,
"attached_condition": "b.a + a.a < 10"
@ -693,6 +731,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -703,6 +742,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -718,6 +758,7 @@ SHOW ANALYZE
"r_hit_ratio": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 2,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -728,6 +769,7 @@ SHOW ANALYZE
"r_loops": 2,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -791,6 +833,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -799,6 +842,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "t2.a + t0.a < 3"
@ -834,6 +878,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -843,6 +888,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 30,
"attached_condition": "t2.a + t0.a < 3"
@ -889,6 +935,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -897,6 +944,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "t2.a + t0.a < 3"
@ -932,6 +980,7 @@ SHOW ANALYZE
{
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -941,6 +990,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 30,
"attached_condition": "t2.a + t0.a < 3"
@ -974,6 +1024,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -983,6 +1034,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 1,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
@ -995,6 +1047,7 @@ SHOW ANALYZE
"r_hit_ratio": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"nested_loop": [
{
"table": {
@ -1003,6 +1056,7 @@ SHOW ANALYZE
"r_loops": 0,
"rows": 10,
"r_rows": null,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": null,
"attached_condition": "t2.a + t0.a < 3"
@ -1026,6 +1080,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -1035,6 +1090,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 2,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
@ -1047,6 +1103,7 @@ SHOW ANALYZE
"r_hit_ratio": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -1056,6 +1113,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 30,
"attached_condition": "t2.a + t0.a < 3"
@ -1079,6 +1137,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -1088,6 +1147,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
@ -1100,6 +1160,7 @@ SHOW ANALYZE
"r_hit_ratio": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 2,
"nested_loop": [
{
@ -1109,6 +1170,7 @@ SHOW ANALYZE
"r_loops": 2,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 25,
"attached_condition": "t2.a + t0.a < 3"
@ -1146,6 +1208,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"nested_loop": [
{
@ -1164,6 +1227,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
@ -1205,6 +1269,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"temporary_table": {
"nested_loop": [
@ -1215,6 +1280,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
@ -1254,6 +1320,7 @@ SHOW ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"temporary_table": {
"nested_loop": [
@ -1264,6 +1331,7 @@ SHOW ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"filtered": 100,
"r_filtered": 100
}

View File

@ -47,6 +47,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -57,6 +58,7 @@ SHOW EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 999,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.a < 100000",
"using_index": true
@ -77,6 +79,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -87,6 +90,7 @@ SHOW EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a < 10"
}
@ -106,6 +110,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -116,6 +121,7 @@ SHOW EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a < 10"
}
@ -138,6 +144,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -148,6 +155,7 @@ SHOW EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a < 10",
"mrr_type": "Rowid-ordered scan"
@ -169,6 +177,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -179,6 +188,7 @@ SHOW EXPLAIN
"key_length": "5",
"used_key_parts": ["a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t1.a < 10",
"mrr_type": "Rowid-ordered scan"
@ -210,12 +220,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "A",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -226,12 +238,14 @@ SHOW EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "B",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -266,12 +280,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "A",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -282,12 +298,14 @@ SHOW EXPLAIN
"query_block": {
"select_id": 2,
"operation": "UNION",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "B",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -378,12 +396,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "a",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "a.a < 1"
}
@ -394,12 +414,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "b",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "b.a + a.a < 10"
}
@ -427,12 +449,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "a",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "a.a < 1"
}
@ -443,12 +467,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "b",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "b.a + a.a < 10"
}
@ -476,12 +502,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "a",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "a.a < 1"
}
@ -492,12 +520,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "b",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "b.a + a.a < 10"
}
@ -552,12 +582,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -586,12 +618,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -628,12 +662,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -662,12 +698,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -707,12 +745,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -741,12 +781,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -786,12 +828,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -820,12 +864,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -854,12 +900,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -869,12 +917,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -893,12 +943,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -908,12 +960,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -932,12 +986,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -947,12 +1003,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -986,12 +1044,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1001,12 +1061,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -1025,12 +1087,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1040,12 +1104,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -1064,12 +1130,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1079,12 +1147,14 @@ SHOW EXPLAIN
"expression_cache": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t2.a + t0.a < 3"
}
@ -1120,6 +1190,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"read_sorted_file": {
@ -1129,6 +1200,7 @@ SHOW EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1169,6 +1241,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"temporary_table": {
"nested_loop": [
{
@ -1176,6 +1249,7 @@ SHOW EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1215,6 +1289,7 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"temporary_table": {
"nested_loop": [
{
@ -1222,6 +1297,7 @@ SHOW EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1264,12 +1340,14 @@ SHOW EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t0.a = <cache>(octet_length('гы'))"
}

View File

@ -118,6 +118,7 @@ send select count(*) from t1 where a < 100000;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain FORMAT=JSON for $thr2;
connection con1;
reap;
@ -126,6 +127,7 @@ reap;
send select max(c) from t1 where a < 10;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain FORMAT=JSON for connection $thr2;
connection con1;
reap;
@ -134,6 +136,7 @@ reap;
send select max(c) from t1 where a < 10;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
connection con1;
reap;
@ -145,6 +148,7 @@ set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
send explain select max(c) from t1 where a < 10;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
connection con1;
reap;
@ -153,6 +157,7 @@ reap;
send explain select max(c) from t1 where a < 10;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
connection con1;
reap;
@ -165,6 +170,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format = JSON for $thr2;
connection con1;
reap;
@ -177,6 +183,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
connection con1;
reap;
@ -234,6 +241,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
connection con1;
reap;
@ -245,6 +253,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
connection con1;
reap;
@ -256,6 +265,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
connection con1;
reap;
@ -293,8 +303,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
connection con1;
reap;
@ -308,8 +320,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
connection con1;
reap;
@ -326,8 +340,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
connection con1;
reap;
@ -343,8 +359,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
connection con1;
reap;
@ -360,10 +378,13 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
connection con1;
reap;
@ -380,10 +401,13 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp explain format=JSON for connection $thr2;
connection con1;
reap;
@ -400,6 +424,7 @@ set @show_explain_probe_select_id=1;
send select * from t0 order by a;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
connection con1;
reap;
@ -417,6 +442,7 @@ set @show_explain_probe_select_id=1;
send select distinct a from t0;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
connection con1;
reap;
@ -435,6 +461,7 @@ set @show_explain_probe_select_id=1;
send select distinct a from t0;
connection default;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=json for $thr2;
connection con1;
reap;
@ -461,6 +488,7 @@ select * from t0 where length('
connection default;
set names utf8;
--source include/wait_condition.inc
--source include/explain-no-costs.inc
evalp show explain format=JSON for $thr2;
set names default;

View File

@ -8338,12 +8338,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 18,
"cost": "COST_REPLACED",
"filtered": 5.555555344,
"attached_condition": "t1.a > 'y'"
}

View File

@ -477,6 +477,7 @@ INSERT INTO t1 VALUES ('o'),('s'),('j'),('s'),('y'),('s'),('l'),
set histogram_type=json_hb;
analyze table t1 persistent for all;
--echo # filtered must not be negative:
--source include/explain-no-costs.inc
explain format=json select * from t1 where a > 'y';
drop table t1;

View File

@ -2927,6 +2927,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"duplicate_removal": {
@ -2939,6 +2940,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -2953,6 +2955,7 @@ ANALYZE
"r_loops": 0,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2963,6 +2966,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -2975,6 +2979,7 @@ ANALYZE
{
"query_block": {
"select_id": 3,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -2985,6 +2990,7 @@ ANALYZE
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -49,6 +49,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -59,6 +60,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -73,6 +75,7 @@ ANALYZE
"r_hit_ratio": 60,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 4,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -83,6 +86,7 @@ ANALYZE
"r_loops": 4,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -106,6 +110,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -116,6 +121,7 @@ ANALYZE
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -138,6 +144,7 @@ ANALYZE
{
"query_block": {
"select_id": 3,
"cost": "REPLACED",
"r_loops": 4,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -148,6 +155,7 @@ ANALYZE
"r_loops": 4,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -178,6 +186,7 @@ ANALYZE
"r_hit_ratio": 60,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 4,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -188,6 +197,7 @@ ANALYZE
"r_loops": 4,
"rows": 4,
"r_rows": 4,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -208,12 +218,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -224,12 +236,14 @@ EXPLAIN
"state": "uninitialized",
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = t2.c"
}
@ -247,12 +261,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -269,12 +285,14 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = t2.c"
}
@ -301,12 +319,14 @@ EXPLAIN
"state": "uninitialized",
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = t2.c"
}

View File

@ -34,8 +34,10 @@ select a, (select d from t2 where b=c) from t1;
--source include/analyze-format.inc
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;
--source include/explain-no-costs.inc
explain format=json
select a, (select d from t2 where b=c) from t1;
--source include/explain-no-costs.inc
explain 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;
set optimizer_switch='subquery_cache=off';

View File

@ -7438,12 +7438,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -7467,12 +7469,14 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "1 = t3.c"
}

View File

@ -24,6 +24,7 @@ INSERT INTO t3 VALUES (4),(5);
SET @tmp19714=@@optimizer_switch;
SET optimizer_switch='subquery_cache=off';
--source include/explain-no-costs.inc
explain format=json
SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;

View File

@ -737,6 +737,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"const_condition": "1",
"nested_loop": [
{
@ -744,6 +745,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -769,6 +771,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"const_condition": "1",
"nested_loop": [
{
@ -776,6 +779,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -789,11 +793,13 @@ EXPLAIN
"used_key_parts": ["b"],
"ref": ["test.t1.a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "trigcond(t1.a = v2b.b and trigcond(t1.a is not null))",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"const_condition": "1",
"filesort": {
"sort_key": "t11.a",
@ -804,6 +810,7 @@ EXPLAIN
"table_name": "t11",
"access_type": "ALL",
"rows": 1000,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -831,6 +838,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"const_condition": "1",
"nested_loop": [
{
@ -838,6 +846,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -857,6 +866,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"const_condition": "1",
"nested_loop": [
{
@ -864,6 +874,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -877,11 +888,13 @@ EXPLAIN
"used_key_parts": ["b"],
"ref": ["test.t1.a"],
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "trigcond(trigcond(t1.a is not null))",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"const_condition": "1",
"filesort": {
"sort_key": "t11.a",
@ -892,6 +905,7 @@ EXPLAIN
"table_name": "t11",
"access_type": "ALL",
"rows": 1000,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -905,6 +919,7 @@ EXPLAIN
"used_key_parts": ["pk"],
"ref": ["test.t11.b"],
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "trigcond(trigcond(t11.b is not null))"
}

View File

@ -680,6 +680,7 @@ group by t11.a;
explain select t1.* from t1 left join v2b on v2b.a=t1.a;
--echo # Check format JSON as well
--source include/explain-no-costs.inc
explain format=JSON select t1.* from t1 left join v2b on t1.a=v2b.a;
--echo # Elimination of a whole subquery
@ -692,6 +693,7 @@ explain select t1.* from t1 left join
explain select t1.* from t1 left join v2b on t1.a=v2b.b;
--echo # Check format JSON as well
--source include/explain-no-costs.inc
explain format=JSON select t1.* from t1 left join v2b on t1.a=v2b.b;
create view v2c as
@ -703,12 +705,14 @@ group by t11.a;
explain select t1.* from t1 left join v2c on v2c.a=t1.a;
--echo # Check format JSON as well
--source include/explain-no-costs.inc
explain format=JSON select t1.* from t1 left join v2c on v2c.a=t1.a;
--echo # In this case v2c cannot be eliminated (since v2c.b is not unique)!
explain select t1.* from t1 left join v2c on t1.a=v2c.b;
--echo # Check format JSON as well
--source include/explain-no-costs.inc
explain format=JSON select t1.* from t1 left join v2c on t1.a=v2c.b;
--echo # Create a view with multiple fields in the GROUP BY clause:

View File

@ -833,6 +833,7 @@ deallocate prepare stmt1;
explain
values (1,2);
--source include/explain-no-costs.inc
explain format=json
values (1,2);
@ -853,16 +854,19 @@ values (5,6)
union
values (1,2),(3,4);
--source include/explain-no-costs.inc
explain format=json
select 1,2
union
values (1,2),(3,4);
--source include/explain-no-costs.inc
explain format=json
values (1,2),(3,4)
union
select 1,2;
--source include/explain-no-costs.inc
explain format=json
values (5,6)
union
@ -875,6 +879,7 @@ values (3,4)
union
values (1,2);
--source include/explain-no-costs.inc
explain format=json
select 1,2
union
@ -899,16 +904,19 @@ values (1,2)
union all
values (1,2),(3,4);
--source include/explain-no-costs.inc
explain format=json
values (1,2),(3,4)
union all
select 1,2;
--source include/explain-no-costs.inc
explain format=json
select 1,2
union
values (1,2),(3,4);
--source include/explain-no-costs.inc
explain format=json
values (1,2)
union all
@ -921,6 +929,7 @@ values (3,4)
union all
values (1,2);
--source include/explain-no-costs.inc
explain format=json
select 1,2
union all

View File

@ -1402,6 +1402,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1417,6 +1418,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1437,6 +1439,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.a",
"window_functions_computation": {
@ -1454,6 +1457,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1474,6 +1478,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1489,6 +1494,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1511,6 +1517,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"having_condition": "MX in (3,5,7)",
"filesort": {
"sort_key": "t1.b",
@ -1529,6 +1536,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1665,6 +1673,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1680,6 +1689,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1697,6 +1707,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1712,6 +1723,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1729,6 +1741,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1744,6 +1757,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1761,6 +1775,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1776,6 +1791,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1821,6 +1837,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
"window_functions_computation": {
@ -1838,6 +1855,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1981,6 +1999,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"duplicate_removal": {
"window_functions_computation": {
"sorts": [
@ -1997,6 +2016,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 9,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2161,6 +2181,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -2176,6 +2197,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2228,6 +2250,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -2243,6 +2266,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -3827,6 +3851,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"window_functions_computation": {
@ -3852,6 +3877,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -927,11 +927,13 @@ drop table t0,t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
--source include/explain-no-costs.inc
explain format=json select rank() over (order by a) from t0;
create table t1 (a int, b int, c int);
insert into t1 select a,a,a from t0;
--source include/explain-no-costs.inc
explain format=json
select
a,
@ -939,6 +941,7 @@ select
from t1
group by a;
--source include/explain-no-costs.inc
explain format=json
select
a,
@ -952,6 +955,7 @@ order by null;
--echo #
select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
--source include/explain-no-costs.inc
explain format=json
select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
@ -1040,24 +1044,28 @@ from t1;
show status like '%sort%';
# Check using EXPLAIN FORMAT=JSON
--source include/explain-no-costs.inc
explain format=json
select
rank() over (partition by c order by a),
rank() over (partition by c order by a)
from t1;
--source include/explain-no-costs.inc
explain format=json
select
rank() over (order by a),
row_number() over (order by a)
from t1;
--source include/explain-no-costs.inc
explain format=json
select
rank() over (partition by c order by a),
count(*) over (partition by c)
from t1;
--source include/explain-no-costs.inc
explain format=json
select
count(*) over (partition by c),
@ -1089,6 +1097,7 @@ insert into t1 values (null,'a');
insert into t1 values (2,'b');
insert into t1 values (-1,'');
--source include/explain-no-costs.inc
explain format=json
select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
@ -1177,6 +1186,7 @@ insert into t1 values
select rank() over (partition by part_id order by a) from t1;
select distinct rank() over (partition by part_id order by a) from t1;
--source include/explain-no-costs.inc
explain format=json
select distinct rank() over (partition by part_id order by a) from t1;
@ -1301,6 +1311,7 @@ select pk, a, d,
sum(d) over (order by a
ROWS BETWEEN 1 preceding and 2 following) as sum_2
from t1;
--source include/explain-no-costs.inc
explain format=json
select pk, a, d,
sum(d) over (partition by a order by pk
@ -1336,6 +1347,7 @@ insert into t1 values
(10, 5, 1000),
(10, 1, 100);
--source include/explain-no-costs.inc
explain format=json
select
a,b,c,

View File

@ -36,6 +36,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -54,6 +55,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["pk"],
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
@ -68,6 +70,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -86,6 +89,7 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["pk"],
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}

View File

@ -21,7 +21,9 @@ insert into t1 values
(11, 2, 10, NULL, 0.9, NULL);
select pk, row_number() over () from t1;
--source include/explain-no-costs.inc
explain FORMAT=JSON select pk, row_number() over () from t1;
--source include/explain-no-costs.inc
explain FORMAT=JSON select row_number() over (), pk from t1;
select row_number() over () from (select 4) as t;

View File

@ -1408,6 +1408,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1423,6 +1424,7 @@ EXPLAIN
"table_name": "t0",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1443,6 +1445,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "t1.a",
"window_functions_computation": {
@ -1460,6 +1463,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1480,6 +1484,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1495,6 +1500,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1517,6 +1523,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"having_condition": "MX in (3,5,7)",
"filesort": {
"sort_key": "t1.b",
@ -1535,6 +1542,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1671,6 +1679,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1686,6 +1695,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1703,6 +1713,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1718,6 +1729,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1735,6 +1747,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1750,6 +1763,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1767,6 +1781,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -1782,6 +1797,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1827,6 +1843,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"filesort": {
"sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
"window_functions_computation": {
@ -1844,6 +1861,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -1987,6 +2005,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"duplicate_removal": {
"window_functions_computation": {
"sorts": [
@ -2003,6 +2022,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 9,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2167,6 +2187,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -2182,6 +2203,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 11,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -2234,6 +2256,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"window_functions_computation": {
"sorts": [
{
@ -2249,6 +2272,7 @@ EXPLAIN
"table_name": "t1",
"access_type": "ALL",
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100
}
}
@ -3833,6 +3857,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"window_functions_computation": {
@ -3858,6 +3883,7 @@ ANALYZE
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,

View File

@ -160,12 +160,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 7,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -179,6 +181,7 @@ EXPLAIN
"used_key_parts": ["name"],
"ref": ["federated.t3.name"],
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
@ -231,6 +234,7 @@ ANALYZE
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
@ -241,6 +245,7 @@ ANALYZE
"r_loops": 1,
"rows": 7,
"r_rows": 7,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -259,6 +264,7 @@ ANALYZE
"r_loops": 7,
"rows": 2,
"r_rows": 0,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
@ -364,12 +370,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t5",
"access_type": "ALL",
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100
}
},
@ -379,6 +387,7 @@ EXPLAIN
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 5,
"cost": "COST_REPLACED",
"filtered": 100
},
"buffer_type": "flat",

View File

@ -76,6 +76,7 @@ SELECT id FROM federated.t1 WHERE id < 5;
EXPLAIN EXTENDED
SELECT id FROM federated.t1 WHERE id < 5;
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON
SELECT id FROM federated.t1 WHERE id < 5;
@ -103,6 +104,7 @@ SELECT *
FROM federated.t3, (SELECT * FROM federated.t1 WHERE id > 3) t
WHERE federated.t3.name=t.name;
--source include/explain-no-costs.inc
EXPLAIN FORMAT=JSON
SELECT *
FROM federated.t3, (SELECT * FROM federated.t1 WHERE id > 3) t
@ -177,6 +179,7 @@ explain
select * from federated.t1
where name in (select name from federated.t2);
--source include/explain-no-costs.inc
explain format=json
select * from federated.t1
where name in (select name from federated.t2);
@ -196,6 +199,7 @@ select * from t5,
where name in (select name from federated.t2) or name like 'foo%') as TQ;
--echo # Must not show elements with select_id=3
--source include/explain-no-costs.inc
explain format=json
select * from t5,
(select id from federated.t1

View File

@ -211,12 +211,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tt",
"access_type": "ALL",
"rows": 40,
"cost": "COST_REPLACED",
"filtered": 100,
"table_function": "json_table"
}

View File

@ -189,12 +189,14 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "tt",
"access_type": "ALL",
"rows": 40,
"cost": "COST_REPLACED",
"filtered": 100,
"table_function": "json_table"
}

View File

@ -145,6 +145,7 @@ create view v2 as select * from json_table('[{"co\\\\lor": "blue", "price": 50
select * from v2;
drop view v2;
--source include/explain-no-costs.inc
explain format=json select * from
json_table('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
explain select * from

View File

@ -167,6 +167,7 @@ select * from
#eval $query;
#eval explain $query;
--source include/explain-no-costs.inc
explain format=json
select * from
json_table(

View File

@ -1033,6 +1033,9 @@ void Explain_select::print_explain_json(Explain_query *query,
writer->add_member("select_id").add_ll(select_id);
add_linkage(writer);
if (cost != 0.0)
writer->add_member("cost").add_double(cost);
if (is_analyze && time_tracker.get_loops())
{
writer->add_member("r_loops").add_ll(time_tracker.get_loops());
@ -1942,7 +1945,13 @@ void Explain_table_access::print_explain_json(Explain_query *query,
else
writer->add_null();
}
}
if (cost != 0.0)
writer->add_member("cost").add_double(cost);
if (is_analyze)
{
if (op_tracker.get_loops())
{
double total_time= op_tracker.get_time_ms();

View File

@ -216,6 +216,7 @@ public:
message(NULL),
having(NULL), having_value(Item::COND_UNDEF),
using_temporary(false), using_filesort(false),
cost(0.0),
time_tracker(is_analyze),
aggr_tree(NULL)
{}
@ -249,6 +250,7 @@ public:
bool using_temporary;
bool using_filesort;
double cost;
/* ANALYZE members */
Time_and_counter_tracker time_tracker;
@ -824,6 +826,9 @@ public:
ha_rows rows;
double filtered;
/* Total cost incurred during one execution of this select */
double cost;
/*
Contents of the 'Extra' column. Some are converted into strings, some have
parameters, values for which are stored below.

View File

@ -12021,6 +12021,7 @@ bool JOIN::get_best_combination()
j->records_init= j->records_out= j->records_read;
j->records= (ha_rows) j->records_read;
j->cond_selectivity= 1.0;
j->join_read_time= 0.0; /* Not saved currently */
JOIN_TAB *jt;
JOIN_TAB_RANGE *jt_range;
if (!(jt= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB)*sjm->tables)) ||
@ -12081,6 +12082,7 @@ bool JOIN::get_best_combination()
j->records_init= cur_pos->records_init;
j->records_read= cur_pos->records_read;
j->records_out= cur_pos->records_out;
j->join_read_time= cur_pos->read_time;
loop_end:
j->cond_selectivity= cur_pos->cond_selectivity;
@ -28585,6 +28587,7 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
explain_plan= eta;
eta->key.clear();
eta->quick_info= NULL;
eta->cost= join_read_time;
SQL_SELECT *tab_select;
/*
@ -29198,6 +29201,7 @@ int JOIN::save_explain_data_intern(Explain_query *output,
table_map used_tables=0;
join->select_lex->set_explain_type(true);
xpl_sel->cost= best_read;
xpl_sel->select_id= join->select_lex->select_number;
xpl_sel->select_type= join->select_lex->type;
xpl_sel->linkage= select_lex->get_linkage();

View File

@ -350,6 +350,12 @@ typedef struct st_join_table {
/* Copy of POSITION::records_out, set by get_best_combination() */
double records_out;
/*
Copy of POSITION::read_time, set by get_best_combination(). The cost of
accessing the table in course of the join execution.
*/
double join_read_time;
/* The selectivity of the conditions that can be pushed to the table */
double cond_selectivity;

View File

@ -49,7 +49,7 @@ insert into t3 select a,a/10,a,a from t1;
explain
select * from t3 where kp1=3 and kp2 like '%foo%';
--replace_column 9 #
--source include/explain-no-costs.inc
explain format=json
select * from t3 where kp1 between 2 and 4 and mod(kp1,3)=0 and kp2 like '%foo%';

View File

@ -47,6 +47,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -57,6 +58,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["kp1"],
"rows": 1000,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
"attached_condition": "t3.kp2 like '%foo%'"

View File

@ -47,6 +47,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
@ -57,6 +58,7 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["kp1"],
"rows": 1000,
"cost": "COST_REPLACED",
"filtered": 100,
"index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
"attached_condition": "t3.kp2 like '%foo%'"