summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Krivonos <sergei.krivonos@mariadb.com>2021-11-14 09:48:20 +0200
committerSergei Krivonos <sergeikrivonos@gmail.com>2021-11-26 15:11:06 +0200
commit73df7a30094a0fac8f59de1c91a7bce6cd3ff643 (patch)
treea768b2533689fe63e7b54a1cf06770b0f8118218
parenta01c82ef2e95b31334034e55e97fb4f2e25ff4be (diff)
downloadmariadb-git-73df7a30094a0fac8f59de1c91a7bce6cd3ff643.tar.gz
MDEV-27036: resolve duplicated key issues of JSON tracing outputs:
MDEV-27036: repeated "table" key resolve for print_explain_json MDEV-27036: duplicated keys in best_access_path MDEV-27036: Explain_aggr_filesort::print_json_members: resolve duplicated "filesort" member in Json object MDEV-27036: Explain_basic_join:: print_explain_json_interns fixed start_dups_weedout case for main.explain_json test
-rw-r--r--mysql-test/main/analyze_format_json.result884
-rw-r--r--mysql-test/main/analyze_stmt_orderby.result454
-rw-r--r--mysql-test/main/brackets.result152
-rw-r--r--mysql-test/main/cte_recursive.result948
-rw-r--r--mysql-test/main/derived_cond_pushdown.result18428
-rw-r--r--mysql-test/main/derived_view.result520
-rw-r--r--mysql-test/main/except.result590
-rw-r--r--mysql-test/main/except_all.result710
-rw-r--r--mysql-test/main/explain_json.result1804
-rw-r--r--mysql-test/main/explain_json_format_partitions.result50
-rw-r--r--mysql-test/main/explain_json_innodb.result68
-rw-r--r--mysql-test/main/having_cond_pushdown.result2888
-rw-r--r--mysql-test/main/in_subq_cond_pushdown.result2987
-rw-r--r--mysql-test/main/innodb_ext_key,off.rdiff54
-rw-r--r--mysql-test/main/innodb_ext_key.result56
-rw-r--r--mysql-test/main/intersect.result584
-rw-r--r--mysql-test/main/intersect_all.result584
-rw-r--r--mysql-test/main/join_cache.result64
-rw-r--r--mysql-test/main/opt_trace.result42
-rw-r--r--mysql-test/main/opt_trace_ucs2.result26
-rw-r--r--mysql-test/main/order_by.result468
-rw-r--r--mysql-test/main/order_by_pack_big.result178
-rw-r--r--mysql-test/main/range.result558
-rw-r--r--mysql-test/main/range_mrr_icp.result536
-rw-r--r--mysql-test/main/rowid_filter.result2220
-rw-r--r--mysql-test/main/rowid_filter_innodb.result2388
-rw-r--r--mysql-test/main/set_operation.result316
-rw-r--r--mysql-test/main/subselect_cache.result222
-rw-r--r--mysql-test/main/subselect_no_semijoin.result50
-rw-r--r--mysql-test/main/win.result360
-rw-r--r--mysql-test/main/win_empty_over.result68
-rw-r--r--mysql-test/suite/encryption/r/tempfiles_encrypted.result360
-rw-r--r--mysql-test/suite/federated/federatedx_create_handlers.result166
-rw-r--r--mysql-test/suite/json/r/json_table.result18
-rw-r--r--mysql-test/suite/json/r/json_table_mysql.result18
-rw-r--r--sql/sql_explain.cc41
-rw-r--r--sql/sql_select.cc14
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result28
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result28
39 files changed, 22602 insertions, 17328 deletions
diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result
index fc643d1a8af..6c9b8ce2982 100644
--- a/mysql-test/main/analyze_format_json.result
+++ b/mysql-test/main/analyze_format_json.result
@@ -9,18 +9,22 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 30,
- "attached_condition": "t0.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "t0.a < 3"
+ }
+ }
+ ]
}
}
create table t1 (a int, b int, c int, key(a));
@@ -38,32 +42,38 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 0,
- "attached_condition": "t0.a > 9 and t0.a is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "r_loops": 0,
- "rows": 1,
- "r_rows": null,
- "filtered": 100,
- "r_filtered": null
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 0,
+ "attached_condition": "t0.a > 9 and t0.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "r_loops": 0,
+ "rows": 1,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null
+ }
+ }
+ ]
}
}
analyze
@@ -79,35 +89,41 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t0.a is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "r_loops": 10,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 40,
- "attached_condition": "t1.b < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "r_loops": 10,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 40,
+ "attached_condition": "t1.b < 4"
+ }
+ }
+ ]
}
}
analyze
@@ -123,36 +139,42 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "tbl1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 100,
- "r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 20,
- "attached_condition": "tbl1.b < 20"
- },
- "block-nl-join": {
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 100,
- "r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 60,
- "attached_condition": "tbl2.b < 60"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "tbl1.b < 20"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "1Kb",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 60,
+ "attached_condition": "tbl2.b < 60"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
analyze format=json
@@ -163,37 +185,43 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "tbl1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 100,
- "r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 20,
- "attached_condition": "tbl1.b < 20"
- },
- "block-nl-join": {
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 100,
- "r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 60,
- "attached_condition": "tbl2.b < 60"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "tbl1.b < 20"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "1Kb",
- "join_type": "BNL",
- "attached_condition": "tbl1.c > tbl2.c",
- "r_filtered": 15.83333333
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 60,
+ "attached_condition": "tbl2.b < 60"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL",
+ "attached_condition": "tbl1.c > tbl2.c",
+ "r_filtered": 15.83333333
+ }
+ }
+ ]
}
}
drop table t1;
@@ -212,35 +240,41 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "r_loops": 10,
- "rows": 2,
- "r_rows": 0.2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "using_index": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "r_loops": 10,
+ "rows": 2,
+ "r_rows": 0.2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "using_index": true
+ }
+ }
+ ]
}
}
drop table t1,t2;
@@ -264,18 +298,22 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 50,
- "attached_condition": "test.t1.a < 5"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "test.t1.a < 5"
+ }
+ }
+ ]
}
}
disconnect con1;
@@ -318,23 +356,27 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 50,
- "index_condition": "t1.pk < 10",
- "attached_condition": "t1.b > 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "index_condition": "t1.pk < 10",
+ "attached_condition": "t1.b > 4"
+ }
+ }
+ ]
}
}
analyze format=json
@@ -388,42 +430,48 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 5,
- "r_rows": 5,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "range-checked-for-each-record": {
- "keys": ["key1", "key2", "key3", "key4"],
- "r_keys": {
- "full_scan": 1,
- "index_merge": 1,
- "range": {
- "key1": 2,
- "key2": 1,
- "key3": 0,
- "key4": 0
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
}
},
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["key1", "key2", "key3", "key4"],
- "r_loops": 5,
- "rows": 1010,
- "r_rows": 203.8,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 98.13542689
+ {
+ "range-checked-for-each-record": {
+ "keys": ["key1", "key2", "key3", "key4"],
+ "r_keys": {
+ "full_scan": 1,
+ "index_merge": 1,
+ "range": {
+ "key1": 2,
+ "key2": 1,
+ "key3": 0,
+ "key4": 0
+ }
+ },
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["key1", "key2", "key3", "key4"],
+ "r_loops": 5,
+ "rows": 1010,
+ "r_rows": 203.8,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 98.13542689
+ }
+ }
}
- }
+ ]
}
}
drop table t1,t2,t3,t4;
@@ -449,18 +497,22 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "tbl1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 50,
- "attached_condition": "tbl1.a < 5"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "tbl1.a < 5"
+ }
+ }
+ ]
}
},
{
@@ -469,18 +521,22 @@ ANALYZE
"operation": "UNION",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 20,
- "attached_condition": "tbl2.a in (2,3)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "tbl2.a in (2,3)"
+ }
+ }
+ ]
}
}
]
@@ -519,17 +575,21 @@ ANALYZE
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 256,
- "r_rows": 256,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 256,
+ "r_rows": 256,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -551,17 +611,21 @@ ANALYZE
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 256,
- "r_rows": 256,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 256,
+ "r_rows": 256,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -594,17 +658,21 @@ ANALYZE
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 256,
- "r_rows": 256,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 256,
+ "r_rows": 256,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -624,44 +692,24 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 0,
- "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))"
- },
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
- "r_filtered": null
- },
- "subqueries": [
+ "nested_loop": [
{
- "query_block": {
- "select_id": 2,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
"r_loops": 1,
- "r_total_time_ms": "REPLACED",
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t1",
+ "table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
@@ -669,8 +717,38 @@ ANALYZE
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
- "r_filtered": 100
- }
+ "r_filtered": 0,
+ "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
+ "r_filtered": null
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -715,35 +793,41 @@ ANALYZE
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 0,
- "attached_condition": "t3.f3 in (1,2)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "1",
- "join_type": "BNL",
- "r_filtered": null
- },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 0,
+ "attached_condition": "t3.f3 in (1,2)"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1",
+ "join_type": "BNL",
+ "r_filtered": null
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -751,31 +835,37 @@ ANALYZE
"r_loops": 0,
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 0,
- "rows": 2,
- "r_rows": null,
- "filtered": 100,
- "r_filtered": null
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 0,
- "rows": 2,
- "r_rows": null,
- "filtered": 100,
- "r_filtered": null
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 2,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "t2.f2 = t3.f3",
- "r_filtered": null
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 2,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "t2.f2 = t3.f3",
+ "r_filtered": null
+ }
+ }
+ ]
}
}
}
@@ -802,18 +892,22 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 0,
- "attached_condition": "t1.a < 0"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 0,
+ "attached_condition": "t1.a < 0"
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -821,27 +915,31 @@ ANALYZE
"r_loops": 0,
"query_block": {
"select_id": 2,
- "read_sorted_file": {
- "r_rows": null,
- "filesort": {
- "sort_key": "t2.c",
- "r_loops": null,
- "r_limit": null,
- "r_used_priority_queue": null,
- "r_output_rows": null,
- "r_sort_mode": "sort_key,rowid",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 0,
- "rows": 10,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": null,
- "filtered": 100,
- "r_filtered": null,
- "attached_condition": "t2.a < t1.a"
+ "filesort": {
+ "sort_key": "t2.c",
+ "r_loops": null,
+ "r_limit": null,
+ "r_used_priority_queue": null,
+ "r_output_rows": null,
+ "r_sort_mode": "sort_key,rowid",
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "t2.a < t1.a"
+ }
+ }
}
}
- }
+ ]
}
}
}
diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result
index 11736c47a49..d4d0fe6b25b 100644
--- a/mysql-test/main/analyze_stmt_orderby.result
+++ b/mysql-test/main/analyze_stmt_orderby.result
@@ -176,24 +176,30 @@ EXPLAIN
"filesort": {
"sort_key": "t2.b",
"temporary_table": {
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t0.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "rows": 1,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -215,34 +221,40 @@ ANALYZE
"r_output_rows": 4,
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t0.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "r_loops": 10,
- "rows": 1,
- "r_rows": 0.4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "r_loops": 10,
+ "rows": 1,
+ "r_rows": 0.4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -261,29 +273,35 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t0.a",
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t0.a",
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ }
+ }
+ },
+ {
"table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t0.a is not null"
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "rows": 1,
+ "filtered": 100
}
}
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "rows": 1,
- "filtered": 100
- }
+ ]
}
}
analyze format=json
@@ -294,46 +312,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 10,
- "filesort": {
- "sort_key": "t0.a",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 10,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,addon_fields",
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 10,
+ "filesort": {
+ "sort_key": "t0.a",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,addon_fields",
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ }
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "r_loops": 10,
+ "rows": 1,
+ "r_rows": 0.4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t0.a is not null"
+ "r_filtered": 100
}
}
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "r_loops": 10,
- "rows": 1,
- "r_rows": 0.4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ ]
}
}
drop table t2;
@@ -365,18 +389,22 @@ ANALYZE
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 1000,
- "r_rows": 1000,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 50,
- "attached_condition": "t2.a MOD 2 = 0"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "t2.a MOD 2 = 0"
+ }
+ }
+ ]
}
}
}
@@ -414,35 +442,41 @@ ANALYZE
"r_total_time_ms": "REPLACED",
"duplicate_removal": {
"temporary_table": {
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "t3.a = t0.a",
- "r_filtered": 10
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "t3.a = t0.a",
+ "r_filtered": 10
+ }
+ }
+ ]
}
}
}
@@ -488,36 +522,42 @@ ANALYZE
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t6",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 5,
- "r_rows": 5,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 80,
- "attached_condition": "t6.b > 0 and t6.a <= 5"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t5",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t6",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 80,
+ "attached_condition": "t6.b > 0 and t6.a <= 5"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "attached_condition": "t5.a = t6.a",
- "r_filtered": 21.42857143
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t5",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "attached_condition": "t5.a = t6.a",
+ "r_filtered": 21.42857143
+ }
+ }
+ ]
}
}
}
@@ -538,25 +578,31 @@ EXPLAIN
"filesort": {
"sort_key": "t5.a",
"temporary_table": {
- "table": {
- "table_name": "t6",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t6.b > 0 and t6.a <= 5"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t5",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t6",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t6.b > 0 and t6.a <= 5"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "attached_condition": "t5.a = t6.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t5",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "attached_condition": "t5.a = t6.a"
+ }
+ }
+ ]
}
}
}
@@ -593,21 +639,25 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["col1"],
- "r_loops": 1,
- "rows": 7,
- "r_rows": 20,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "using_index_for_group_by": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["col1"],
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 20,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "using_index_for_group_by": true
+ }
+ }
+ ]
}
}
drop table t2;
diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result
index 69b479d7820..88707cfb5df 100644
--- a/mysql-test/main/brackets.result
+++ b/mysql-test/main/brackets.result
@@ -261,17 +261,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a desc",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
(select a from t1 order by a desc) limit 1;
@@ -287,17 +291,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a desc",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
(select a from t1 where a=20 union select a from t1) order by a desc limit 1;
@@ -321,25 +329,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.a = 20"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a = 20"
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -367,25 +383,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.a = 20"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a = 20"
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -421,30 +445,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.pk",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.pk",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.pk > 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.pk > 4"
+ }
+ }
+ ]
}
}
]
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index 478bd9a92a5..e2ca6d0b118 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -1339,107 +1339,133 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 24,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union4,6,5>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "folks",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "folks.`name` = 'Me2'"
- }
- }
- },
- {
- "query_block": {
- "select_id": 6,
- "operation": "UNION",
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "prev_gen.`id` < 345",
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union3,2>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "folks",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "folks.`name` = 'Me'"
- }
- }
- },
- {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 24,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union4,6,5>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "folks",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "folks.`name` = 'Me2'"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 6,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "prev_gen.`id` < 345",
+ "materialized": {
"query_block": {
- "select_id": 2,
- "operation": "UNION",
- "table": {
- "table_name": "folks",
+ "recursive_union": {
+ "table_name": "<union3,2>",
"access_type": "ALL",
- "possible_keys": ["PRIMARY"],
- "rows": 12,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "686",
- "join_type": "BNL",
- "attached_condition": "prev_gen.father = folks.`id` or prev_gen.mother = folks.`id`"
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "folks",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "folks.`name` = 'Me'"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "folks",
+ "access_type": "ALL",
+ "possible_keys": ["PRIMARY"],
+ "rows": 12,
+ "filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "686",
+ "join_type": "BNL",
+ "attached_condition": "prev_gen.father = folks.`id` or prev_gen.mother = folks.`id`"
+ }
+ }
+ ]
+ }
+ }
+ ]
}
}
}
- ]
+ }
}
- }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 5,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 24,
+ "filtered": 100,
+ "attached_condition": "ancestors.`id` < 234"
+ }
+ }
+ ]
}
}
- }
- },
- {
- "query_block": {
- "select_id": 5,
- "operation": "UNION",
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 24,
- "filtered": 100,
- "attached_condition": "ancestors.`id` < 234"
- }
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
#
@@ -1473,91 +1499,111 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union3,2>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "v",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "v.`name` = 'Me' and v.father is not null and v.mother is not null"
- },
- "table": {
- "table_name": "h",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["id"],
- "ref": ["test.v.father"],
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "w",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["id"],
- "ref": ["test.v.mother"],
- "rows": 1,
- "filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 2,
- "operation": "UNION",
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "a.father is not null and a.mother is not null"
- },
- "table": {
- "table_name": "h",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["id"],
- "ref": ["a.father"],
- "rows": 1,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union3,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "v",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v.`name` = 'Me' and v.father is not null and v.mother is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "h",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["test.v.father"],
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "w",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["test.v.mother"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
},
- "table": {
- "table_name": "w",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["id"],
- "ref": ["a.mother"],
- "rows": 1,
- "filtered": 100
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "a.father is not null and a.mother is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "h",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["a.father"],
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "w",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["a.mother"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
create table my_ancestors
@@ -1778,46 +1824,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t.a < 1000"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t.a < 1000"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop table t1;
@@ -2401,57 +2459,65 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "r_loops": 0,
- "r_rows": null,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "message": "No tables used"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "r_loops": 10,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 10,
- "rows": 2,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 90,
- "attached_condition": "src.counter < 10"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "r_loops": 10,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 10,
+ "rows": 2,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 90,
+ "attached_condition": "src.counter < 10"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
#
@@ -3799,105 +3865,121 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t1.a1 is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "23",
- "used_key_parts": ["a2"],
- "ref": ["test.t1.a1"],
- "r_loops": 3,
- "rows": 1,
- "r_rows": 0.333333333,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "first_match": "t1",
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union3,4>",
- "access_type": "ALL",
- "r_loops": 0,
- "r_rows": null,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 3,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "const",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "22",
- "used_key_parts": ["a2"],
- "ref": ["const"],
- "r_loops": 0,
- "rows": 1,
- "r_rows": null,
- "filtered": 100,
- "r_filtered": null,
- "using_index": true
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "UNION",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "cte.a2 is not null"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.a1 is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "23",
+ "used_key_parts": ["a2"],
+ "ref": ["test.t1.a1"],
+ "r_loops": 3,
+ "rows": 1,
+ "r_rows": 0.333333333,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "first_match": "t1",
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union3,4>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "22",
+ "used_key_parts": ["a2"],
+ "ref": ["const"],
+ "r_loops": 0,
+ "rows": 1,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "using_index": true
+ }
+ }
+ ]
+ }
},
- "table": {
- "table_name": "tt2",
- "access_type": "ref",
- "possible_keys": ["b1"],
- "key": "b1",
- "key_length": "23",
- "used_key_parts": ["b1"],
- "ref": ["cte.a2"],
- "r_loops": 1,
- "rows": 2,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "UNION",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "cte.a2 is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "tt2",
+ "access_type": "ref",
+ "possible_keys": ["b1"],
+ "key": "b1",
+ "key_length": "23",
+ "used_key_parts": ["b1"],
+ "ref": ["cte.a2"],
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop function f1;
@@ -4059,83 +4141,97 @@ ANALYZE
"operation": "UNION",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "recursive_union": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "r_loops": 0,
- "r_rows": null,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "s",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t1.c is not null"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "s",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
},
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "9",
- "used_key_parts": ["a"],
- "ref": ["test.t1.c"],
- "r_loops": 4,
- "rows": 2,
- "r_rows": 0.5,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "9",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.c"],
+ "r_loops": 4,
+ "rows": 2,
+ "r_rows": 0.5,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
]
@@ -4197,17 +4293,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "tt",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tt",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
prepare stmt from "with h_cte as
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index b3a4dc4c253..3b7de95118b 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -122,42 +122,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 214"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "t2.a > v1.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 214",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 214"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "t2.a > v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 214",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from
@@ -198,42 +208,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.max_c > 300",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into HAVING
@@ -277,42 +297,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
@@ -345,42 +375,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 300 or v1.max_c < 135"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.b = t2.b and v1.max_c > 300 and v1.avg_c > t2.d or v1.a = t2.a and v1.max_c < 135 and v1.max_c < t2.c",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (max_c > 300 or max_c < 135)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.b = t2.b and v1.max_c > 300 and v1.avg_c > t2.d or v1.a = t2.a and v1.max_c < 135 and v1.max_c < t2.c",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 300 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -402,43 +442,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a > 6"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "t2.b > v1.b",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 6"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 6"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "t2.b > v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 6"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where (v2.b>25) and (t2.a<v2.a);
@@ -469,43 +519,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v2.b > 25"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "t2.a < v2.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b > 25"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.b > 25"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "t2.a < v2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 25"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into WHERE
@@ -557,43 +617,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a > 7 or v1.a < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a > 7 and t2.c < v1.max_c or v1.a < 2 and t2.b < v1.b",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 7 or t1.a < 2"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 7 or v1.a < 2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a > 7 and t2.c < v1.max_c or v1.a < 2 and t2.b < v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 7 or t1.a < 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where
@@ -638,43 +708,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v2.a > 7 or v2.a > 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v2.a > 7 and t2.c < v2.max_c or v2.a > 5 and t2.b < v2.b",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and (t1.a > 7 or t1.a > 5)"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.a > 7 or v2.a > 5"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v2.a > 7 and t2.c < v2.max_c or v2.a > 5 and t2.b < v2.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and (t1.a > 7 or t1.a > 5)"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
@@ -705,43 +785,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a > 4 or v1.a < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a > 4 and v1.b > t2.b and v1.max_c = t2.d or v1.a < 2 and v1.max_c < t2.c and v1.max_c = t2.d",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 4 or t1.a < 2"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 4 or v1.a < 2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a > 4 and v1.b > t2.b and v1.max_c = t2.d or v1.a < 2 and v1.max_c < t2.c and v1.max_c = t2.d",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 4 or t1.a < 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformulas : pushing into HAVING and WHERE
@@ -765,43 +855,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 2 and v1.max_c > 400"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "t2.b > v1.b",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 400",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 2"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c > 400"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "t2.b > v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 400",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_double as v,t2_double as t where
@@ -836,43 +936,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v.avg_a > 0.45 and v.b > 10",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "avg_a < 22.333 and avg_a > 0.45",
- "filesort": {
- "sort_key": "t1_double.b, t1_double.c",
- "temporary_table": {
- "table": {
- "table_name": "t1_double",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t1_double.b > 12.2 and t1_double.b > 10"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.avg_a > 0.45 and v.b > 10",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_a < 22.333 and avg_a > 0.45",
+ "filesort": {
+ "sort_key": "t1_double.b, t1_double.c",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_double",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_double.b > 12.2 and t1_double.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_decimal as v,t2_decimal as t where
@@ -895,43 +1005,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "3",
- "used_key_parts": ["a"],
- "ref": ["test.t.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v.avg_c > 15 and v.b > 1",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "avg_c > 12 and avg_c > 15",
- "filesort": {
- "sort_key": "t1_decimal.a, t1_decimal.b",
- "temporary_table": {
- "table": {
- "table_name": "t1_decimal",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t1_decimal.b > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "3",
+ "used_key_parts": ["a"],
+ "ref": ["test.t.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.avg_c > 15 and v.b > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_c > 12 and avg_c > 15",
+ "filesort": {
+ "sort_key": "t1_decimal.a, t1_decimal.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_decimal",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_decimal.b > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into HAVING and WHERE
@@ -977,43 +1097,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a > 7 and v1.max_c > 300 or v1.a < 4 and v1.max_c < 500"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a > 7 and v1.max_c > 300 and t2.c < v1.max_c or v1.a < 4 and v1.max_c < 500 and t2.b < v1.b",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (t1.a > 7 and max_c > 300 or t1.a < 4 and max_c < 500)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 7 or t1.a < 4"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 7 and v1.max_c > 300 or v1.a < 4 and v1.max_c < 500"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a > 7 and v1.max_c > 300 and t2.c < v1.max_c or v1.a < 4 and v1.max_c < 500 and t2.b < v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a > 7 and max_c > 300 or t1.a < 4 and max_c < 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 7 or t1.a < 4"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7);
@@ -1066,43 +1196,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.a > 7"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a > 7"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formulas : pushing into WHERE and HAVING
@@ -1144,43 +1284,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.b = t2.b and v1.a < 2 and v1.max_c > 120 or v1.a > 7",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.a > 7"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.b = t2.b and v1.a < 2 and v1.max_c > 120 or v1.a > 7",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a > 7"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
@@ -1211,43 +1361,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 2 and v1.max_c < 200 or v1.a > 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a < 2 and v1.max_c < 200 and t2.c > v1.max_c and v1.max_c = t2.d or v1.max_c = t2.c and v1.a > 4 and t2.c < 500 and t2.b < v1.b",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (t1.a < 2 and max_c < 200 or t1.a > 4 and max_c < 500)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.a > 4"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 2 and v1.max_c < 200 or v1.a > 4"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a < 2 and v1.max_c < 200 and t2.c > v1.max_c and v1.max_c = t2.d or v1.max_c = t2.c and v1.a > 4 and t2.c < 500 and t2.b < v1.b",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 2 and max_c < 200 or t1.a > 4 and max_c < 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# prepare of a query containing extracted or formula
@@ -1288,42 +1448,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
execute stmt;
@@ -1331,42 +1501,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.max_c < 135"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
deallocate prepare stmt;
@@ -1390,43 +1570,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 1 and t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a = 1",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1 and t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d);
@@ -1445,43 +1635,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.d is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["max_c"],
- "ref": ["test.t2.d"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a = 5 and v1.max_c = t2.d",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.d is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.d"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a = 5 and v1.max_c = t2.d",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE using equalities
@@ -1507,42 +1707,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a);
@@ -1559,42 +1769,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "ref": ["test.t2.a", "test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = t1.a"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into HAVING using equalities
@@ -1616,41 +1836,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.c > 150 and t2.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["max_c"],
- "ref": ["test.t2.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 150",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c > 150 and t2.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 150",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted and formula : pushing into WHERE
@@ -1669,38 +1899,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 3"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 3 and v1.b = 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 3"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t1",
+ "table_name": "<derived2>",
"access_type": "ALL",
"rows": 20,
"filtered": 100,
- "attached_condition": "t1.a = 3 and t1.b = 3"
+ "attached_condition": "v1.a = 3 and v1.b = 3"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 3 and t1.b = 3"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2);
@@ -1719,38 +1959,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 2"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 1 and v1.b = 21"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 2"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t1",
+ "table_name": "<derived2>",
"access_type": "ALL",
"rows": 20,
"filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b = 21"
+ "attached_condition": "v1.a = 1 and v1.b = 21"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b = 21"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where
@@ -1775,43 +2025,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "v.a = 'c' and v.b < 'Hermes'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 9",
- "filesort": {
- "sort_key": "t1_char.b",
- "temporary_table": {
- "table": {
- "table_name": "t1_char",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t1_char.a = 'c' and t1_char.b < 'Hermes'"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v.a = 'c' and v.b < 'Hermes'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 9",
+ "filesort": {
+ "sort_key": "t1_char.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_char",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1_char.a = 'c' and t1_char.b < 'Hermes'"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "220",
- "join_type": "BNL",
- "attached_condition": "t.b = v.b or v.max_c > 20"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "220",
+ "join_type": "BNL",
+ "attached_condition": "t.b = v.b or v.max_c > 20"
+ }
+ }
+ ]
}
}
# extracted and formula : pushing into WHERE using equalities
@@ -1848,42 +2108,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "(t.b > 1 or t.b = 1) and t.b is not null and t.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "6",
- "used_key_parts": ["a", "b"],
- "ref": ["test.t.b", "test.t.b"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "avg_c > 12",
- "filesort": {
- "sort_key": "t1_decimal.a, t1_decimal.b",
- "temporary_table": {
- "table": {
- "table_name": "t1_decimal",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t1_decimal.b = t1_decimal.a and (t1_decimal.a > 1 or t1_decimal.a = 1)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(t.b > 1 or t.b = 1) and t.b is not null and t.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "6",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t.b", "test.t.b"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_c > 12",
+ "filesort": {
+ "sort_key": "t1_decimal.a, t1_decimal.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_decimal",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_decimal.b = t1_decimal.a and (t1_decimal.a > 1 or t1_decimal.a = 1)"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into HAVING using equalities
@@ -1917,42 +2187,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 4 or t2.c > 150"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 4 or t2.c > 150"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a = t2.a and t2.a < 4 or v1.max_c = t2.c and t2.c > 150",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (t1.a < 4 or max_c > 150)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a and t2.a < 4 or v1.max_c = t2.c and t2.c > 150",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a < 4 or max_c > 150)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformulas : pushing into WHERE and HAVING using equalities
@@ -1976,42 +2256,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 5 and t2.c > 250 and t2.a is not null and t2.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "10",
- "used_key_parts": ["a", "max_c"],
- "ref": ["test.t2.a", "test.t2.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 250",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 5 and t2.c > 250 and t2.a is not null and t2.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "max_c"],
+ "ref": ["test.t2.a", "test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 250",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformulas : pushing into WHERE and HAVING
@@ -2046,43 +2336,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 8"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 8 and v1.max_c = 404"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 8"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c = 404",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 8"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 8 and v1.max_c = 404"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c = 404",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformulas : pushing into WHERE and HAVING
@@ -2106,43 +2406,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.d is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["max_c"],
- "ref": ["test.t2.d"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a > 3 and v1.max_c > 200 and t2.b < v1.b and t2.d = v1.max_c",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.d is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.d"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a > 3 and v1.max_c > 200 and t2.b < v1.b and t2.d = v1.max_c",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -2166,43 +2476,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t.c is not null and t.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "18",
- "used_key_parts": ["b", "c"],
- "ref": ["test.t.c", "test.t.c"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t.c > 10 or v.a = 1",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "avg_a < 22.333 and (t1_double.b > 10 or t1_double.a = 1)",
- "filesort": {
- "sort_key": "t1_double.b, t1_double.c",
- "temporary_table": {
- "table": {
- "table_name": "t1_double",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t1_double.c = t1_double.b and t1_double.b > 12.2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.c is not null and t.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "18",
+ "used_key_parts": ["b", "c"],
+ "ref": ["test.t.c", "test.t.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.c > 10 or v.a = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_a < 22.333 and (t1_double.b > 10 or t1_double.a = 1)",
+ "filesort": {
+ "sort_key": "t1_double.b, t1_double.c",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_double",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_double.c = t1_double.b and t1_double.b > 12.2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -2231,43 +2551,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t.c > 18 and t.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "9",
- "used_key_parts": ["c"],
- "ref": ["test.t.c"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v.a > 0.2 or v.b < 17 or t.c > 17",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "avg_a < 22.333 and (t1_double.a > 0.2 or t1_double.b < 17 or t1_double.c > 17)",
- "filesort": {
- "sort_key": "t1_double.b, t1_double.c",
- "temporary_table": {
- "table": {
- "table_name": "t1_double",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t1_double.b > 12.2 and t1_double.c > 18"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t.c > 18 and t.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "9",
+ "used_key_parts": ["c"],
+ "ref": ["test.t.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.a > 0.2 or v.b < 17 or t.c > 17",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_a < 22.333 and (t1_double.a > 0.2 or t1_double.b < 17 or t1_double.c > 17)",
+ "filesort": {
+ "sort_key": "t1_double.b, t1_double.c",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_double",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_double.b > 12.2 and t1_double.c > 18"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into WHERE
@@ -2327,42 +2657,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "(v.a > 4 or v.a = 2 or v.b > 3) and v.avg_c = 13",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "avg_c > 12 and avg_c = 13",
- "filesort": {
- "sort_key": "t1_decimal.a, t1_decimal.b",
- "temporary_table": {
- "table": {
- "table_name": "t1_decimal",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t1_decimal.a > 4 or t1_decimal.a = 2 or t1_decimal.b > 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(v.a > 4 or v.a = 2 or v.b > 3) and v.avg_c = 13",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "avg_c > 12 and avg_c = 13",
+ "filesort": {
+ "sort_key": "t1_decimal.a, t1_decimal.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_decimal",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t1_decimal.a > 4 or t1_decimal.a = 2 or t1_decimal.b > 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "162",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "162",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from
@@ -2391,43 +2731,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "ref": ["test.t2.a", "test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.max_c > 300",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = t1.a and t1.a > 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# nothing to push
@@ -2457,41 +2807,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 2 and t2.c > 900"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2 and t2.c > 900"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b);
@@ -2514,41 +2874,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null and t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "ref": ["test.t2.a", "test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
@@ -2585,41 +2955,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a = t2.a or v1.b = t2.b and (v1.a = 1 or v1.a = 6)",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a or v1.b = t2.b and (v1.a = 1 or v1.a = 6)",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2);
@@ -2680,41 +3060,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a = 1 or v1.b = 21 or t2.a = 2",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = 1 or v1.b = 21 or t2.a = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where
@@ -2747,42 +3137,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 2 and t2.c > 900"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2 and t2.c > 900"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a < t2.a or t2.a < 11",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a < t2.a or t2.a < 11",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using several derived tables : nothing to push
@@ -2814,71 +3214,87 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key1"],
- "key": "key1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.b < 50",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b < 50"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.b < 50",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 50"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where
@@ -2929,72 +3345,88 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b < 50"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b < 50"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.b is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.b is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["v1.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.a = v1.a or v1.a = t2.a",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.a = v1.a or v1.a = t2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where
@@ -3025,71 +3457,87 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a = t2.a or t2.c < 115",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a or t2.c < 115",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
},
- "buffer_type": "incremental",
- "buffer_size": "4Kb",
- "join_type": "BNL",
- "attached_condition": "v1.a = t2.a and v2.a = t2.a or v2.b > 13 and t2.c < 115",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "4Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = t2.a and v2.a = t2.a or v2.b > 13 and t2.c < 115",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using several derived tables : pushing in all tables
@@ -3124,72 +3572,88 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c < 300"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c < 300"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v2.b < 50 or v2.b = 19"
},
- "buffer_type": "incremental",
- "buffer_size": "4Kb",
- "join_type": "BNL",
- "attached_condition": "(v2.a = v1.a or v1.a = t2.a) and (v2.b < 50 or v2.b = 19)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and (t1.b < 50 or t1.b = 19)"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.b < 50 or v2.b = 19"
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "4Kb",
+ "join_type": "BNL",
+ "attached_condition": "(v2.a = v1.a or v1.a = t2.a) and (v2.b < 50 or v2.b = 19)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and (t1.b < 50 or t1.b = 19)"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using several derived tables : pushing only in one table
@@ -3215,72 +3679,88 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null and t2.a is not null and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key1"],
- "key": "key1",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "ref": ["test.t2.a", "test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = t1.a"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "ref": ["test.t2.a", "test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.max_c < 300",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707 and max_c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.max_c < 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707 and max_c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using several derived tables : pushing only in one table
@@ -3303,72 +3783,88 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 1 and v1.b > 10"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.b is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b > 10"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and v1.b > 10"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.b is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["v1.b"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b > 10"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into WHERE
@@ -3402,43 +3898,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "v.a = 'b' and (v.b = 'Vika' or v.b = 'Ali')",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 9",
- "filesort": {
- "sort_key": "t1_char.b",
- "temporary_table": {
- "table": {
- "table_name": "t1_char",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t1_char.a = 'b' and (t1_char.b = 'Vika' or t1_char.b = 'Ali')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v.a = 'b' and (v.b = 'Vika' or v.b = 'Ali')",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 9",
+ "filesort": {
+ "sort_key": "t1_char.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_char",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1_char.a = 'b' and (t1_char.b = 'Vika' or t1_char.b = 'Ali')"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t.a = 'b'"
},
- "buffer_type": "flat",
- "buffer_size": "220",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t.a = 'b'"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "220",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
}
# using several derived tables : pushing in all tables
@@ -3499,103 +4005,125 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v3.b < 50 or v3.b = 33",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "min_c > 109",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and (t1.b < 50 or t1.b = 33)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v3.b < 50 or v3.b = 33",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "min_c > 109",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.b < 50 or t1.b = 33)"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v2.max_c > 300"
},
- "buffer_type": "flat",
- "buffer_size": "715",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707 and max_c > 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.max_c > 300"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "715",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c < 500"
},
- "buffer_type": "incremental",
- "buffer_size": "9Kb",
- "join_type": "BNL",
- "attached_condition": "v1.a = v2.a or v1.a = t2.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c < 500",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c < 500"
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "9Kb",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = v2.a or v1.a = t2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c < 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using several derived tables : pushing in all tables
@@ -3636,73 +4164,89 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key1"],
- "key": "key1",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.max_c > 130 and v1.a is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 130 and v1.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["v1.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.min_c < 130",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "min_c < 707 and min_c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["v1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.min_c < 130",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "min_c < 707 and min_c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using several derived tables : pushing in all tables
@@ -3776,103 +4320,125 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.avg_c < 400 or v1.a > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "(v1.avg_c < 400 or v1.a > 1) and v1.a is not null and v1.b is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (avg_c < 400 or t1.a > 1)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.avg_c < 400 or v1.a > 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "(v1.avg_c < 400 or v1.a > 1) and v1.a is not null and v1.b is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (avg_c < 400 or t1.a > 1)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["v1.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.min_c < 200",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "min_c < 707 and min_c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["v1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.min_c < 200",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "min_c < 707 and min_c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["v1.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v3.avg_c > 170 or v3.a < 5",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "avg_c > 170 or t1.a < 5",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 8"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v3.avg_c > 170 or v3.a < 5",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "avg_c > 170 or t1.a < 5",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 8"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted or formula : pushing into HAVING
@@ -3921,43 +4487,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "(v1.a = 1 or v1.max_c < 300) and v1.b > 25"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a = 1 or v1.max_c < 300",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and (t1.a = 1 or max_c < 300)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 25"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "(v1.a = 1 or v1.max_c < 300) and v1.b > 25"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a = 1 or v1.max_c < 300",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and (t1.a = 1 or max_c < 300)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 25"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# extracted and formula : pushing into WHERE
@@ -3992,43 +4568,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.max_c > 300 and v1.b < 30",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 707 and max_c > 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b < 30"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 300 and v1.b < 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 707 and max_c > 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 30"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using query with union
@@ -4070,86 +4656,106 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.c > 800 and t2.b is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a < 5",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c > 800 and t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a < 5",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.d > 800"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 100 and v1.a > 7"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.d > 800"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707 and max_c > 100",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 7"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 100 and v1.a > 7"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and max_c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 7"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
]
@@ -4214,85 +4820,105 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b = 19"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.b = 19 and v1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b = 19"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = 19 and t1.a < 5"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = 19 and v1.a < 5"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = 19 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.max_c > 400 or v1.avg_c > 270"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "(v1.max_c > 400 or v1.avg_c > 270) and v1.a < t2.a",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707 and (max_c > 400 or avg_c > 270)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 400 or v1.avg_c > 270"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "(v1.max_c > 400 or v1.avg_c > 270) and v1.a < t2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and (max_c > 400 or avg_c > 270)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
]
@@ -4369,85 +4995,105 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 1 or v1.a = 6"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "(v1.a = t2.a or v1.b = t2.b) and (v1.a = 1 or v1.a = 6)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1 or t1.a = 6"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 or v1.a = 6"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "(v1.a = t2.a or v1.b = t2.b) and (v1.a = 1 or v1.a = 6)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 or t1.a = 6"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707 and (t1.a > 3 and t1.b > 27 or max_c > 550)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and (t1.a > 3 and t1.b > 27 or max_c > 550)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
]
@@ -4525,131 +5171,161 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 1"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 1 and (v1.max_c < 500 or v1.avg_c > 500)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v1.max_c < 500 or v1.avg_c > 500",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707 and (max_c < 500 or avg_c > 500)",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1 and (v1.max_c < 500 or v1.avg_c > 500)"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v1.max_c < 500 or v1.avg_c > 500",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and (max_c < 500 or avg_c > 500)",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 2"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived5>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v2.b > 10"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v2.a < t2.b or v2.max_c > 200",
- "materialized": {
- "query_block": {
- "select_id": 5,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b > 10"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v2.b > 10"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v2.a < t2.b or v2.max_c > 200",
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 3,
"operation": "UNION",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.c is not null"
- },
- "table": {
- "table_name": "<derived6>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["max_c"],
- "ref": ["test.t2.c"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.b < 10",
- "materialized": {
- "query_block": {
- "select_id": 6,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b < 10"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived6>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.b < 10",
+ "materialized": {
+ "query_block": {
+ "select_id": 6,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 10"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
]
@@ -4692,71 +5368,85 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 40,
- "filtered": 100,
- "attached_condition": "v_union.a < 3 and v_union.c > 100"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109 and c > 100",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and t1.a < 3"
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "v_union.a < 3 and v_union.c > 100"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.a < 3"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "c < 300 and c > 100",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 3"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "c < 300 and c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 3"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union
@@ -4800,72 +5490,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 40,
- "filtered": 100,
- "attached_condition": "(v_union.a < 2 or v_union.c > 800) and v_union.b > 12"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "v_union.a < 2 or v_union.c > 800",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109 and (t1.a < 2 or c > 800)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and t1.b > 12"
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "(v_union.a < 2 or v_union.c > 800) and v_union.b > 12"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "v_union.a < 2 or v_union.c > 800",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and (t1.a < 2 or c > 800)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.b > 12"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "c < 300 and (t1.a < 2 or c > 800)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.b > 12"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "c < 300 and (t1.a < 2 or c > 800)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.b > 12"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union
@@ -4896,72 +5600,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 1"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 40,
- "filtered": 100,
- "attached_condition": "v_union.a = 1 and v_union.c < 200"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109 and c < 200",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "v_union.a = 1 and v_union.c < 200"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c < 200",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "c < 300 and c < 200",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "c < 300 and c < 200",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where
@@ -4990,43 +5708,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "2",
- "used_key_parts": ["a"],
- "ref": ["test.t.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v.b = 'Vika' and v.max_c > 2",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 9 and max_c > 2",
- "filesort": {
- "sort_key": "t1_char.a",
- "temporary_table": {
- "table": {
- "table_name": "t1_char",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t1_char.b = 'Vika'"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "2",
+ "used_key_parts": ["a"],
+ "ref": ["test.t.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v.b = 'Vika' and v.max_c > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 9 and max_c > 2",
+ "filesort": {
+ "sort_key": "t1_char.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1_char",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1_char.b = 'Vika'"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using derived table with union
@@ -5063,68 +5791,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 1"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a = 1"
- },
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
- }
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 1"
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 40,
- "filtered": 100,
- "attached_condition": "v_union.a = 1"
},
- "buffer_type": "incremental",
- "buffer_size": "4Kb",
- "join_type": "BNL",
- "attached_condition": "v_union.c > 800 or v1.max_c > 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a = 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
"table": {
"table_name": "t1",
"access_type": "ALL",
@@ -5133,33 +5830,84 @@ EXPLAIN
"attached_condition": "t1.a = 1"
}
}
- }
+ ]
}
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ }
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "attached_condition": "v_union.a = 1"
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "4Kb",
+ "join_type": "BNL",
+ "attached_condition": "v_union.c > 800 or v1.max_c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union
@@ -5199,91 +5947,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "(t2.a = 6 or t2.a = 8) and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 6,
- "filtered": 100,
- "attached_condition": "v.c > 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and (t1.a = 6 or t1.a = 8)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(t2.a = 6 or t2.a = 8) and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 6,
+ "filtered": 100,
+ "attached_condition": "v.c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.a = 6 or t1.a = 8)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "c < 300 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.a = 6 or t1.a = 8)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "c < 300 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.a = 6 or t1.a = 8)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "UNION",
- "having_condition": "c < 707 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.c > 300 and (t1.a = 6 or t1.a = 8)"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "UNION",
+ "having_condition": "c < 707 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.c > 300 and (t1.a = 6 or t1.a = 8)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union of selects without aggregation
@@ -5368,60 +6134,74 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 4,
- "filtered": 100,
- "attached_condition": "v.c > 6",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and t1.a + 1 > 6"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.c > 100 and t1.c > 6"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "v.c > 6",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.a + 1 > 6"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.c > 100 and t1.c > 6"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union of selects without aggregation
@@ -5486,60 +6266,74 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.a > 1 or v.b < 20",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and (t1.a > 1 or t1.b < 20)"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.a > 1 or t1.b < 20)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.a > 1 or v.b < 20",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.a > 1 or t1.b < 20)"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.a > 1 or t1.b < 20)"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union of selects without aggregation
@@ -5572,60 +6366,74 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 4,
- "filtered": 100,
- "attached_condition": "(v.b = 19 or v.b = 21) and (v.c < 3 or v.c > 600)",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and (t1.b = 19 or t1.b = 21) and (t1.a + 1 < 3 or t1.a + 1 > 600)"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.b = 19 or t1.b = 21) and (t1.c < 3 or t1.c > 600)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(v.b = 19 or v.b = 21) and (v.c < 3 or v.c > 600)",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.b = 19 or t1.b = 21) and (t1.a + 1 < 3 or t1.a + 1 > 600)"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.b = 19 or t1.b = 21) and (t1.c < 3 or t1.c > 600)"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union of
@@ -5655,66 +6463,80 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 4,
- "filtered": 100,
- "attached_condition": "v.b < 20",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and t1.b < 20"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "v.b < 20",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and t1.b < 20"
+ }
+ }
+ ]
+ }
}
}
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.b < 20"
+ }
+ }
+ ]
+ }
}
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.b < 20"
- }
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using derived table with union of
@@ -5763,66 +6585,80 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 4,
- "filtered": 100,
- "attached_condition": "(t2.a < 3 or v.b < 40) and v.c > 500",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 109 and c > 500",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 10 and (t1.a < 3 or t1.b < 40)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "(t2.a < 3 or v.b < 40) and v.c > 500",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 109 and c > 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 10 and (t1.a < 3 or t1.b < 40)"
+ }
+ }
+ ]
+ }
}
}
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.a < 3 or t1.b < 40) and t1.c + 100 > 500"
+ }
+ }
+ ]
+ }
}
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.a < 3 or t1.b < 40) and t1.c + 100 > 500"
- }
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using embedded derived table : pushing the same conditions
@@ -5873,78 +6709,96 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v4.a < 13",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15 and v1.a < 13",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15 and t1.a < 13"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.a < 13",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and v1.a < 13",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and t1.a < 13"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a > 5 and v1.b > 12"
},
- "buffer_type": "flat",
- "buffer_size": "333",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b > 12"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a > 5 and v1.b > 12"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "333",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b > 12"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : nothing to push
@@ -5975,89 +6829,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key1"],
- "key": "key1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.b > 30",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b > 30"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b > 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b > 30"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing different conditions
@@ -6090,91 +6964,111 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 1 and t2.a is not null and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key1"],
- "key": "key1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v4.min_c > 100",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "min_c > 100",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15 and v1.a > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15 and t1.a > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 1 and t2.a is not null and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key1"],
+ "key": "key1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v4.min_c > 100",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c > 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and v1.a > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and t1.a > 1"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.b < 30",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.b < 30"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b < 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.b < 30"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing different conditions
@@ -6292,89 +7186,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v4.b > 10 and v4.a > 1 or v4.b < 20"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "238",
- "join_type": "BNL",
- "attached_condition": "(v4.b > 10 and v4.a > 1 or v4.b < 20) and v4.a is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15 and (v1.b > 10 and v1.a > 1 or v1.b < 20)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15 and (t1.b > 10 and t1.a > 1 or t1.b < 20)"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b > 10 and v4.a > 1 or v4.b < 20"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "238",
+ "join_type": "BNL",
+ "attached_condition": "(v4.b > 10 and v4.a > 1 or v4.b < 20) and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.b > 10 and v1.a > 1 or v1.b < 20)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.b > 10 and t1.a > 1 or t1.b < 20)"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["v4.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.max_c > 200",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707 and max_c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.max_c > 200",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and max_c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing different conditions
@@ -6401,78 +7315,96 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v4.a > 12 and v4.min_c < 300 and v4.b > 13 or v4.a < 1",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "v1.a > 12 and min_c < 300 and v1.b > 13 or v1.a < 1",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15 and (v1.a > 12 and v1.b > 13 or v1.a < 1)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15 and (t1.a > 12 and t1.b > 13 or t1.a < 1)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.a > 12 and v4.min_c < 300 and v4.b > 13 or v4.a < 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "v1.a > 12 and min_c < 300 and v1.b > 13 or v1.a < 1",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.a > 12 and v1.b > 13 or v1.a < 1)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.a > 12 and t1.b > 13 or t1.a < 1)"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "333",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "333",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing different conditions
@@ -6500,78 +7432,96 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v4.b = v4.a and v4.min_c < 100 and v4.a is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "min_c < 100",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.b = v1.a and v1.a < 15",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = t1.a and t1.a < 15"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b = v4.a and v4.min_c < 100 and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c < 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = v1.a and v1.a < 15",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a < 15"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["v4.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing the same conditions
@@ -6599,77 +7549,95 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v4.b = v4.a and v4.a < 30 and v4.a is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.b = v1.a and v1.a < 15 and v1.a < 30",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = t1.a and t1.a < 15 and t1.a < 30"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b = v4.a and v4.a < 30 and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = v1.a and v1.a < 15 and v1.a < 30",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a < 15 and t1.a < 30"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["v4.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and t1.b < 30"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and t1.b < 30"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing the same conditions
@@ -6697,77 +7665,95 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v4.b = v4.a and (v4.a < 30 or v4.a > 2) and v4.a is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.b = v1.a and v1.a < 15 and (v1.a < 30 or v1.a > 2)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.b = t1.a and t1.a < 15 and (t1.a < 30 or t1.a > 2)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v4.b = v4.a and (v4.a < 30 or v4.a > 2) and v4.a is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.b = v1.a and v1.a < 15 and (v1.a < 30 or v1.a > 2)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.b = t1.a and t1.a < 15 and (t1.a < 30 or t1.a > 2)"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["v4.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5 and (t1.b < 30 or t1.b > 2)"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["v4.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5 and (t1.b < 30 or t1.b > 2)"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing the same conditions
@@ -6803,78 +7789,96 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "(v4.a < 12 and v4.b > 13 or v4.a > 10) and v4.min_c > 100 and v4.min_c is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "min_c > 100",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15 and (v1.a < 12 and v1.b > 13 or v1.a > 10)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15 and (t1.a < 12 and t1.b > 13 or t1.a > 10)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "(v4.a < 12 and v4.b > 13 or v4.a > 10) and v4.min_c > 100 and v4.min_c is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c > 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.a < 12 and v1.b > 13 or v1.a > 10)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.a < 12 and t1.b > 13 or t1.a > 10)"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["max_c"],
- "ref": ["v4.min_c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707 and max_c > 100",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["max_c"],
+ "ref": ["v4.min_c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707 and max_c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# using embedded view : pushing the same conditions
@@ -6909,90 +7913,110 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.c > 100 and t2.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["min_c"],
- "ref": ["test.t2.c"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v4.a < 12 and t2.b > 13 or v4.a > 10",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "min_c > 100",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "v1.a < 15 and (v1.a < 12 or v1.a > 10)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a < 15 and (t1.a < 12 or t1.a > 10)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.c > 100 and t2.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["min_c"],
+ "ref": ["test.t2.c"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v4.a < 12 and t2.b > 13 or v4.a > 10",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "min_c > 100",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "v1.a < 15 and (v1.a < 12 or v1.a > 10)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a < 15 and (t1.a < 12 or t1.a > 10)"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "715",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "having_condition": "max_c < 707",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t1.a > 5"
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "715",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "max_c < 707",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
drop view v1,v2,v3,v4;
@@ -7136,47 +8160,61 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))",
- "table": {
- "table_name": "t1",
- "access_type": "system",
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.b = 2",
- "first_match": "t1"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.b = 2",
+ "first_match": "t1"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 3,
- "table": {
- "table_name": "<derived5>",
- "access_type": "index_subquery",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["c"],
- "ref": ["func"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 5,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t3.c = 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["c"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t3.c = 2"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
]
@@ -7220,52 +8258,66 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))",
- "table": {
- "table_name": "t1",
- "access_type": "system",
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.b = 2",
- "first_match": "t1"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.b = 2",
+ "first_match": "t1"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 3,
- "table": {
- "table_name": "<derived5>",
- "access_type": "index_subquery",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["func"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 5,
- "having_condition": "s > 2",
- "filesort": {
- "sort_key": "t4.d",
- "temporary_table": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "having_condition": "s > 2",
+ "filesort": {
+ "sort_key": "t4.d",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
]
@@ -7295,35 +8347,47 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "<in_optimizer>(1,exists(subquery#3))",
- "table": {
- "table_name": "t1",
- "access_type": "system",
- "rows": 1,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 3,
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.b = 1",
- "materialized": {
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.b = 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.b = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.b = 1"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
]
@@ -7352,35 +8416,45 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP VIEW v2;
@@ -7397,25 +8471,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "<nop>(v1.i <= 3)",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "<nop>(t1.i <= 3)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<nop>(v1.i <= 3)",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<nop>(t1.i <= 3)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
Warnings:
@@ -7450,39 +8532,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#2)) or t1.b = 100"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#2)) or t1.b = 100"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "<derived4>",
- "access_type": "index_subquery",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "4",
- "used_key_parts": ["pk2"],
- "ref": ["func"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
]
@@ -7500,39 +8594,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#3)) or t1.b = 100"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#3)) or t1.b = 100"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 3,
- "table": {
- "table_name": "<derived4>",
- "access_type": "index_subquery",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "4",
- "used_key_parts": ["pk2"],
- "ref": ["func"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "index_subquery",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
]
@@ -7558,35 +8664,47 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "system",
- "rows": 1,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a = 50",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.a = 50"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a = 50",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.a = 50"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
]
@@ -7604,40 +8722,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "system",
- "rows": 1,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "v2.s < 50",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "s < 50",
- "filesort": {
- "sort_key": "t3.a",
- "temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "v2.s < 50",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "s < 50",
+ "filesort": {
+ "sort_key": "t3.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
]
@@ -7664,45 +8794,55 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery2>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "table": {
- "message": "Select tables optimized away"
- }
- }
- }
- },
- "read_sorted_file": {
- "filesort": {
- "sort_key": "v1.a",
+ "nested_loop": [
+ {
"table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
+ "table_name": "<subquery2>",
+ "access_type": "system",
+ "rows": 1,
"filtered": 100,
- "attached_condition": "v1.b = 2",
"materialized": {
+ "unique": 1,
"query_block": {
- "select_id": 3,
+ "select_id": 2,
"table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.b = 2"
+ "message": "Select tables optimized away"
+ }
+ }
+ }
+ }
+ },
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "v1.a",
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.b = 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
DROP VIEW v1;
@@ -7724,68 +8864,84 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery2>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.f = 2",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t.f = 2"
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.f = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.f = 2"
+ }
+ }
+ ]
+ }
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.pk > 2"
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 4,
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t",
- "access_type": "range",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "rows": 1,
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 2,
"filtered": 100,
- "index_condition": "t.pk > 2"
+ "attached_condition": "v2.pk > 2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t.pk > 2"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP VIEW v;
@@ -7808,40 +8964,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = 3",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = 3"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 3",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 3"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
UPDATE t2 SET j = 2 WHERE j = 3;
@@ -7865,40 +9031,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = 2.71",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = 2.7100000381469727"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 2.71",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 2.7100000381469727"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -7917,40 +9093,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = 3.21",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = 3.21"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 3.21",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 3.21"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -7969,40 +9155,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = 'aa'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = 'aa'"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = 'aa'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = 'aa'"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -8023,40 +9219,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = '2007-05-28 00:00:00'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = '2007-05-28 00:00:00'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -8075,40 +9281,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = '2007-05-28'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = DATE'2007-05-28'"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = '2007-05-28'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = DATE'2007-05-28'"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -8127,40 +9343,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<subquery3>",
- "access_type": "system",
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "message": "Select tables optimized away"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "message": "Select tables optimized away"
+ }
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "sq.i = '10:00:02'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.i = TIME'10:00:02'"
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "sq.i = '10:00:02'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.i = TIME'10:00:02'"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -8179,25 +9405,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "nullif(1,v1.i)",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "nullif(1,t1.i)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "nullif(1,v1.i)",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "nullif(1,t1.i)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP VIEW v1;
@@ -8266,36 +9500,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c = 'foo'",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.c = 'foo'"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.c = 'foo'"
+ }
+ }
+ ]
+ }
}
}
}
- },
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "1 = t2.a"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ ]
}
}
]
@@ -8315,35 +9561,47 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- },
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 128,
- "filtered": 100,
- "attached_condition": "1 = t2.a"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 128,
+ "filtered": 100,
+ "attached_condition": "1 = t2.a"
+ }
+ }
+ ]
}
}
]
@@ -8479,41 +9737,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a > 2 and t1.a is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t2.b",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t2.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
select a
@@ -8529,41 +9797,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a > 2 and t1.a is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t2.b",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t2.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
select a
@@ -8582,38 +9860,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a > 2 and t1.a is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 3,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
select a
@@ -8629,41 +9917,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a > 2 and t1.a is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["m"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "m > 2",
- "filesort": {
- "sort_key": "t2.b",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["m"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "m > 2",
+ "filesort": {
+ "sort_key": "t2.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
drop view v1,v2,v3;
@@ -8682,25 +9980,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.f > 0",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "f > 0",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.f > 0",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "f > 0",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP VIEW v1;
@@ -8722,42 +10028,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["i1"],
- "key": "i1",
- "key_length": "5",
- "used_key_parts": ["i1"],
- "ref": ["const"],
- "rows": 1,
- "filtered": 100,
- "using_index": true
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.i2 = 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["i1"],
+ "key": "i1",
+ "key_length": "5",
+ "used_key_parts": ["i1"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100,
+ "using_index": true
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 3,
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t2",
+ "table_name": "<derived3>",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
- "attached_condition": "t2.i2 = 1"
+ "attached_condition": "v2.i2 = 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.i2 = 1"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP VIEW v2;
@@ -8780,26 +10096,34 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t.f = 'a' or t.f = 'b'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t.f = 'a' or t.f = 'b'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
drop table t1;
@@ -8827,42 +10151,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t1.id2 is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["id2"],
- "ref": ["test.t1.id2"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "vc.ct > 0",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "ct > 0",
- "filesort": {
- "sort_key": "t2.id2",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t1.id2 is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["id2"],
+ "ref": ["test.t1.id2"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "vc.ct > 0",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "ct > 0",
+ "filesort": {
+ "sort_key": "t2.id2",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -8916,38 +10250,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.x = 1"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.x = 1"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c > 37 and max_c > 30",
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t1",
+ "table_name": "<derived2>",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b = 1"
+ "attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c > 37 and max_c > 30",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b = 1"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
SELECT *
@@ -8991,38 +10335,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.x = 1"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.x = 1"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c > 37 and max_c > 30",
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t1",
+ "table_name": "<derived2>",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b = 1 and t1.d = 1"
+ "attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c > 37 and max_c > 30",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b = 1 and t1.d = 1"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -9098,43 +10452,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "10",
- "used_key_parts": ["e", "max_f"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 2,
- "filtered": 100,
- "first_match": "t1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_f > 18",
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t2.e > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["e", "max_f"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "first_match": "t1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_f > 18",
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t2.e > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT * FROM t1
@@ -9187,42 +10551,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b < 25 and t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "10",
- "used_key_parts": ["e", "max_f"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 2,
- "filtered": 100,
- "first_match": "t1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_f > 18 and max_f < 25",
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b < 25 and t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "10",
+ "used_key_parts": ["e", "max_f"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 2,
+ "filtered": 100,
+ "first_match": "t1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_f > 18 and max_f < 25",
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT * FROM t1
@@ -9275,56 +10649,70 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "max_f"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "d_tab.e > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t2.e > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "max_f"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "d_tab.e > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t2.e > 1"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
SELECT * FROM t1
@@ -9377,56 +10765,70 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "max_f"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "d_tab.max_f > 20",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_f > 20",
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "max_f"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "d_tab.max_f > 20",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_f > 20",
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2;
@@ -9471,30 +10873,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "dt.a = 2",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "a = 2",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "dt.a = 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "a = 2",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT * FROM
@@ -9520,31 +10930,39 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "dt.a > 1",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "a > 1",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.a < 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "dt.a > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "a > 1",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a < 3"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT * FROM
@@ -9569,29 +10987,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "dt.a = 'ab'",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "dt.a = 'ab'",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT * FROM
@@ -9616,29 +11042,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "dt.a = 1",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "dt.a = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
DROP TABLE t1;
@@ -9683,42 +11117,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "1 in (0,dt1.a)",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "1 in (0,t1.a) and 1 in (0,t1.a)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 in (0,dt1.a)",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 in (0,t1.a) and 1 in (0,t1.a)"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "t1.a = dt1.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "t1.a = dt1.a"
+ }
+ }
+ ]
}
}
SELECT * FROM
@@ -9742,42 +11186,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "dt.a in (1,dt.a)",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.a in (1,t1.a)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "dt.a in (1,dt.a)",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.a in (1,t1.a)"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "attached_condition": "t1.a = dt.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "attached_condition": "t1.a = dt.a"
+ }
+ }
+ ]
}
}
DROP TABLE t1;
@@ -9864,30 +11318,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t.a <= 2",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a <= 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t.a <= 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a <= 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
INSERT INTO t3
@@ -9902,42 +11364,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "8",
- "used_key_parts": ["c"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.a = t.c and t.a >= 3",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a >= 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "8",
+ "used_key_parts": ["c"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.a = t.c and t.a >= 3",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a >= 3"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10
@@ -9955,31 +11427,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t.a = 2 and t2.a = t.c + 9",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t.a = 2 and t2.a = t.c + 9",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t
@@ -10019,30 +11501,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "case when tab2.max_a = 1 or tab2.max_a = 2 then 1 else 0 end = 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "case when max_a = 1 or max_a = 2 then 1 else 0 end = 1",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "case when tab2.max_a = 1 or tab2.max_a = 2 then 1 else 0 end = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "case when max_a = 1 or max_a = 2 then 1 else 0 end = 1",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT *
@@ -10068,30 +11558,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "case when tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4 then 1 else 0 end = 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "case when max_a = 1 or max_a > 2 and max_a < 4 then 1 else 0 end = 1",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "case when tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4 then 1 else 0 end = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "case when max_a = 1 or max_a > 2 and max_a < 4 then 1 else 0 end = 1",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT *
@@ -10117,30 +11615,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "case when tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2) then 1 else 0 end = 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "case when max_a > 1 and (max_a = 2 or max_a > 2) then 1 else 0 end = 1",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "case when tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2) then 1 else 0 end = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "case when max_a > 1 and (max_a = 2 or max_a > 2) then 1 else 0 end = 1",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
SELECT *
@@ -10166,30 +11672,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "case when tab2.b = 2 or tab2.b = 4 then 1 else 0 end = 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "case when t1.b = 2 or t1.b = 4 then 1 else 0 end = 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "case when tab2.b = 2 or tab2.b = 4 then 1 else 0 end = 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "case when t1.b = 2 or t1.b = 4 then 1 else 0 end = 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
DROP TABLE t1;
@@ -10235,47 +11749,61 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 144,
- "filtered": 100,
- "attached_condition": "t.f is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 144,
+ "filtered": 100,
+ "attached_condition": "t.f is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t1.f is not null"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "64",
+ "join_type": "BNL"
+ }
}
- }
+ ]
}
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t1.f is not null"
- },
- "buffer_type": "flat",
- "buffer_size": "64",
- "join_type": "BNL"
}
}
}
- }
+ ]
}
}
SELECT * FROM t1;
@@ -10304,48 +11832,62 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t.f is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t1.f is not null"
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "4",
- "used_key_parts": ["f"],
- "ref": ["test.t1.f"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t1.f is not null"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t.f is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t1.f is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "4",
+ "used_key_parts": ["f"],
+ "ref": ["test.t1.f"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t1.f is not null"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
}
}
- }
+ ]
}
}
SELECT * FROM t1;
@@ -10375,32 +11917,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t.f2 < 2",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.f2 < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.f2 < 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f2 < 2"
+ }
+ }
+ ]
+ }
}
}
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f2 = t.f2"
+ }
}
- },
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.f2 = t.f2"
- }
+ ]
}
}
SELECT * FROM t1;
@@ -10416,39 +11968,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t.f2 < 2",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.f2 < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t.f2 < 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f2 < 2"
+ }
+ }
+ ]
+ }
}
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "t1.f2 = t.f2"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "t1.f2 = t.f2"
+ }
+ }
+ ]
}
}
DROP VIEW v1,v2;
@@ -10487,39 +12049,43 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "message": "no matching row in const table"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "message": "no matching row in const table"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "no matching row in const table"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "table": {
+ "message": "no matching row in const table"
+ }
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
DROP TABLE t1;
@@ -10689,56 +12255,68 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v3.col1 = 123 and v3.col2 = 321",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["const"],
- "rows": 1,
- "filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["const"],
- "rows": 1,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v3.col1 = 123 and v3.col2 = 321",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop function f1;
@@ -10763,31 +12341,39 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v2.s + 1 > 10 and v2.a > 1 and v2.a2 > 123",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "s + 1 > 10 and a2 > 123",
- "filesort": {
- "sort_key": "t1.a, f1(t1.a)",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v2.s + 1 > 10 and v2.a > 1 and v2.a2 > 123",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "s + 1 > 10 and a2 > 123",
+ "filesort": {
+ "sort_key": "t1.a, f1(t1.a)",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# Extra test for 10.4+: Check that this works for pushdown into IN
@@ -10808,41 +12394,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t4.a + 1 > 10 and t4.b > 1 and t4.c > 123 and t4.a is not null and t4.b is not null and t4.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "23",
- "used_key_parts": ["a", "f1(a)", "sum(b)"],
- "ref": ["test.t4.a", "test.t4.b", "test.t4.c"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "t4.c = `<subquery2>`.`sum(b)`",
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`f1(a)` > 1 and `sum(b)` > 123",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t1.a + 1 > 10"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t4.a + 1 > 10 and t4.b > 1 and t4.c > 123 and t4.a is not null and t4.b is not null and t4.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "23",
+ "used_key_parts": ["a", "f1(a)", "sum(b)"],
+ "ref": ["test.t4.a", "test.t4.b", "test.t4.c"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "t4.c = `<subquery2>`.`sum(b)`",
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`f1(a)` > 1 and `sum(b)` > 123",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t1.a + 1 > 10"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
drop view v2;
@@ -10895,71 +12491,85 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 5"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -10983,72 +12593,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 8"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a = 8"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 8"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 8"
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a = 8"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 8 and t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11071,72 +12695,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 8"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a = 8"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 8"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 8"
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a = 8"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 8 and t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11161,72 +12799,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11252,72 +12904,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 110",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and c > 110",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 110",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and c > 110",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100 and c > 110",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 5"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100 and c > 110",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11344,72 +13010,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.b > 27 or v1.b < 19",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and (t1.b > 27 or t1.b < 19)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b > 27 or v1.b < 19",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and (t1.b > 27 or t1.b < 19)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.b > 27 or t1.b < 19)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.b > 27 or t1.b < 19)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11442,72 +13122,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 200 or v1.c < 105",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and (c > 200 or c < 105)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 200 or v1.c < 105",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and (c > 200 or c < 105)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100 and (c > 200 or c < 105)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100 and (c > 200 or c < 105)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11562,72 +13256,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a > 3 or v1.a = 1 and v1.c < 110"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "attached_condition": "v1.c = t2.c and v1.a > 3 and t2.c > 110 or v1.a = 1 and v1.c < 110",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and (t1.a > 3 and c > 110 or t1.a = 1 and c < 110)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and (t1.a > 3 or t1.a = 1)"
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a > 3 or v1.a = 1 and v1.c < 110"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "attached_condition": "v1.c = t2.c and v1.a > 3 and t2.c > 110 or v1.a = 1 and v1.c < 110",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and (t1.a > 3 and c > 110 or t1.a = 1 and c < 110)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and (t1.a > 3 or t1.a = 1)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100 and (t1.a > 3 and c > 110 or t1.a = 1 and c < 110)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.a > 3 or t1.a = 1)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100 and (t1.a > 3 and c > 110 or t1.a = 1 and c < 110)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.a > 3 or t1.a = 1)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using intersect in view definition
@@ -11711,72 +13419,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.c = 909 and t2.b > 13 or d1.a < 4 and d1.c < 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and (t1.b > 13 or t1.a < 4 and c < 200)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and (t1.b > 13 or t1.a < 4)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.c = 909 and t2.b > 13 or d1.a < 4 and d1.c < 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and (t1.b > 13 or t1.a < 4 and c < 200)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and (t1.b > 13 or t1.a < 4)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 100 and (t1.b > 13 or t1.a < 4 and c < 200)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.b > 13 or t1.a < 4)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 100 and (t1.b > 13 or t1.a < 4 and c < 200)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.b > 13 or t1.a < 4)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -11812,71 +13534,85 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 5"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -11902,72 +13638,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 6"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a = 6"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 6"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 6"
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a = 6"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 6"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 6 and t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 6 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -11992,72 +13742,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a = 6"
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a = 6"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a = 6"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 6"
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a = 6"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 6"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a = 6 and t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a = 6 and t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -12086,72 +13850,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 500",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and c > 500",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 500",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and c > 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300 and c > 500",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300 and c > 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -12177,72 +13955,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 500",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and c > 500",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 500",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and c > 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300 and c > 500",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 5"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300 and c > 500",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -12271,72 +14063,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.b > 27 or v1.b < 19",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and (t1.b > 27 or t1.b < 19)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b > 27 or v1.b < 19",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and (t1.b > 27 or t1.b < 19)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.b > 27 or t1.b < 19)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.b > 27 or t1.b < 19)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -12369,72 +14175,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c < 400 or v1.c > 800",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and (c < 400 or c > 800)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c < 400 or v1.c > 800",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and (c < 400 or c > 800)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300 and (c < 400 or c > 800)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300 and (c < 400 or c > 800)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -12487,72 +14307,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a > 1 or v1.a = 1 and v1.c > 500"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "attached_condition": "v1.c = t2.c and v1.a > 1 and t2.c < 500 or v1.a = 1 and v1.c > 500",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "<derived2>",
"access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and (t1.a > 1 and c < 500 or t1.a = 1 and c > 500)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and (t1.a > 1 or t1.a = 1)"
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a > 1 or v1.a = 1 and v1.c > 500"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "attached_condition": "v1.c = t2.c and v1.a > 1 and t2.c < 500 or v1.a = 1 and v1.c > 500",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and (t1.a > 1 and c < 500 or t1.a = 1 and c > 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and (t1.a > 1 or t1.a = 1)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300 and (t1.a > 1 and c < 500 or t1.a = 1 and c > 500)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.a > 1 or t1.a = 1)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300 and (t1.a > 1 and c < 500 or t1.a = 1 and c > 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.a > 1 or t1.a = 1)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
# using except in view definition
@@ -12632,72 +14466,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.c = 988 and t2.b > 13 or d1.a > 4 and d1.c > 500",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and (t1.b > 13 or t1.a > 4 and c > 500)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and (t1.b > 13 or t1.a > 4)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.c = 988 and t2.b > 13 or d1.a > 4 and d1.c > 500",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and (t1.b > 13 or t1.a > 4 and c > 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and (t1.b > 13 or t1.a > 4)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 300 and (t1.b > 13 or t1.a > 4 and c > 500)",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and (t1.b > 13 or t1.a > 4)"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 300 and (t1.b > 13 or t1.a > 4 and c > 500)",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and (t1.b > 13 or t1.a > 4)"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -12735,113 +14583,135 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.c > 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 5"
- }
- }
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "__5.a > 5 and __5.c > 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect4,5>",
- "access_type": "ALL",
- "query_specifications": [
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
{
- "query_block": {
- "select_id": 4,
- "having_condition": "c < 300 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 5"
- }
- }
- }
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 5"
}
- },
- {
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "__5.a > 5 and __5.c > 200",
+ "materialized": {
"query_block": {
- "select_id": 5,
- "operation": "INTERSECT",
- "having_condition": "c < 530 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a > 3 and t1.a > 5"
+ "union_result": {
+ "table_name": "<intersect4,5>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "c < 300 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 5"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 5,
+ "operation": "INTERSECT",
+ "having_condition": "c < 530 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3 and t1.a > 5"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
}
- ]
+ }
}
- }
+ ]
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -12879,91 +14749,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.c < 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<unit2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.c < 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c < 500 and c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a > 3 and t1.a > 4"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c < 500 and c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "UNION",
- "having_condition": "c < 300 and c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 4"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "UNION",
+ "having_condition": "c < 300 and c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -12999,91 +14887,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 5 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.c > 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<unit2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 5 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.c > 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "c < 300 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 5"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "c < 300 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "EXCEPT",
- "having_condition": "c < 530 and c > 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a > 3 and t1.a > 5"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "EXCEPT",
+ "having_condition": "c < 530 and c > 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3 and t1.a > 5"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -13121,91 +15027,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.c < 200",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<unit2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 200 and c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.c < 200",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 200 and c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c < 500 and c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a > 3 and t1.a > 4"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c < 500 and c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "UNION",
- "having_condition": "c < 300 and c < 200",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 4"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "UNION",
+ "having_condition": "c < 300 and c < 200",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -13241,91 +15165,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c < 150",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<unit2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and c < 150",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c < 150",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and c < 150",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c < 500 and c < 150",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 7 and t1.a > 4"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c < 500 and c < 150",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "EXCEPT",
- "having_condition": "c > 150 and c < 150",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 4"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "EXCEPT",
+ "having_condition": "c > 150 and c < 150",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -13361,113 +15303,135 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c < 130",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 4"
- }
- }
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "__5.a > 4 and __5.c < 130",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect4,5>",
- "access_type": "ALL",
- "query_specifications": [
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c < 130",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
{
- "query_block": {
- "select_id": 4,
- "having_condition": "c > 150 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 4"
- }
- }
- }
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 4"
}
- },
- {
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "__5.a > 4 and __5.c < 130",
+ "materialized": {
"query_block": {
- "select_id": 5,
- "operation": "INTERSECT",
- "having_condition": "c < 500 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 7 and t1.a > 4"
+ "union_result": {
+ "table_name": "<intersect4,5>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "c > 150 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 5,
+ "operation": "INTERSECT",
+ "having_condition": "c < 500 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
}
- ]
+ }
}
- }
+ ]
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -13507,99 +15471,144 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.c < 130",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<unit2,3,6>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 300 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.c < 130",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit2,3,6>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 300 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "table": {
- "table_name": "<derived4>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "__6.a > 4 and __6.c < 130",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect4,5>",
- "access_type": "ALL",
- "query_specifications": [
- {
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "__6.a > 4 and __6.c < 130",
+ "materialized": {
"query_block": {
- "select_id": 4,
- "having_condition": "c > 150 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 4"
+ "union_result": {
+ "table_name": "<intersect4,5>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 4,
+ "having_condition": "c > 150 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 5,
+ "operation": "INTERSECT",
+ "having_condition": "c < 500 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
- },
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 6,
+ "operation": "UNION",
+ "having_condition": "c < 120 and c < 130",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
{
- "query_block": {
- "select_id": 5,
- "operation": "INTERSECT",
- "having_condition": "c < 500 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 7 and t1.a > 4"
- }
- }
- }
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 7 and t1.a > 4"
}
}
]
@@ -13607,32 +15616,13 @@ EXPLAIN
}
}
}
- }
- },
- {
- "query_block": {
- "select_id": 6,
- "operation": "UNION",
- "having_condition": "c < 120 and c < 130",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 7 and t1.a > 4"
- }
- }
- }
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -13669,90 +15659,108 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.c < 150",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 150",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a < 7 and v1.a > 4",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 3,
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 7 and t1.a > 4"
- }
- }
- }
- }
- },
- {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.c < 150",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 150",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a < 7 and v1.a > 4",
+ "materialized": {
"query_block": {
- "select_id": 4,
- "operation": "INTERSECT",
- "having_condition": "c > 120",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a < 7 and t1.a > 4"
+ "union_result": {
+ "table_name": "<intersect3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "INTERSECT",
+ "having_condition": "c > 120",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
}
- ]
+ }
}
- }
+ ]
}
}
}
}
}
}
- }
+ ]
}
}
drop view v1,v2;
@@ -13789,90 +15797,108 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v2.c < 150",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "c < 150",
- "filesort": {
- "sort_key": "v1.a, v1.b",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "v1.a < 7 and v1.a > 4",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 3,
- "having_condition": "c < 300",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a < 7 and t1.a > 4"
- }
- }
- }
- }
- },
- {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v2.c < 150",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c < 150",
+ "filesort": {
+ "sort_key": "v1.a, v1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "v1.a < 7 and v1.a > 4",
+ "materialized": {
"query_block": {
- "select_id": 4,
- "operation": "EXCEPT",
- "having_condition": "c > 150",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a < 7 and t1.a > 4"
+ "union_result": {
+ "table_name": "<except3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "c < 300",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "EXCEPT",
+ "having_condition": "c > 150",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a < 7 and t1.a > 4"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
}
- ]
+ }
}
- }
+ ]
}
}
}
}
}
}
- }
+ ]
}
}
drop view v1,v2;
@@ -13905,72 +15931,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 4 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.b > 12 and v1.c < 450",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 300 and t1.b > 12 and c < 450",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 4 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b > 12 and v1.c < 450",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 300 and t1.b > 12 and c < 450",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 4"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c > 200 and t1.a > 4 and c < 450",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b < 21 and t1.b > 12"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c > 200 and t1.a > 4 and c < 450",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b < 21 and t1.b > 12"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -14003,72 +16043,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a < 2 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.b < 30 and v1.c > 450",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 300 and t1.b < 30 and c > 450",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 20 and t1.a < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a < 2 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.b < 30 and v1.c > 450",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 300 and t1.b < 30 and c > 450",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 20 and t1.a < 2"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c > 150 and t1.a < 2 and c > 450",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 7 and t1.b < 30"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c > 150 and t1.a < 2 and c > 450",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 7 and t1.b < 30"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -14103,72 +16157,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "(t2.a < 2 or t2.a < 5) and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 450",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 300 and c > 450",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 20 and (t1.a < 2 or t1.a < 5)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "(t2.a < 2 or t2.a < 5) and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 450",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 300 and c > 450",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 20 and (t1.a < 2 or t1.a < 5)"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "having_condition": "c > 150 and (t1.a < 2 or t1.a < 5) and c > 450",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 7"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "having_condition": "c > 150 and (t1.a < 2 or t1.a < 5) and c > 450",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 7"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -14205,91 +16273,109 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.a > 1 and t2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.b > 12 and v1.c > 400",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<unit2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "having_condition": "c > 100 and t1.b > 12 and c > 400",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a < 9 and t1.a > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.a > 1 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.b > 12 and v1.c > 400",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<unit2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "c > 100 and t1.b > 12 and c > 400",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a < 9 and t1.a > 1"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "having_condition": "c < 800 and t1.a > 1 and c > 400",
- "filesort": {
- "sort_key": "t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.a > 3 and t1.b > 12"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "having_condition": "c < 800 and t1.a > 1 and c > 400",
+ "filesort": {
+ "sort_key": "t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.a > 3 and t1.b > 12"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "UNION",
- "having_condition": "c > 300 and c > 400",
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 18,
- "filtered": 100,
- "attached_condition": "t1.b > 10 and t1.a > 1 and t1.b > 12"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "UNION",
+ "having_condition": "c > 300 and c > 400",
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 18,
+ "filtered": 100,
+ "attached_condition": "t1.b > 10 and t1.a > 1 and t1.b > 12"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -14331,41 +16417,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a < 5",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["i1"],
- "key": "i1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 5,
- "filtered": 100,
- "index_condition": "t3.a > 0 and t3.a < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a < 5",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["i1"],
+ "key": "i1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "index_condition": "t3.a > 0 and t3.a < 5"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -14400,68 +16496,82 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "v1.a < 4",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["i1"],
- "key": "i1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t3.a > 1 and t3.a < 4"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["i1"],
- "key": "i1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t3.a > 2 and t3.a < 4"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "v1.a < 4",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["i1"],
+ "key": "i1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t3.a > 1 and t3.a < 4"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["i1"],
+ "key": "i1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t3.a > 2 and t3.a < 4"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
},
- "buffer_type": "flat",
- "buffer_size": "173",
- "join_type": "BNL",
- "attached_condition": "t2.b = v1.b"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "173",
+ "join_type": "BNL",
+ "attached_condition": "t2.b = v1.b"
+ }
+ }
+ ]
}
}
drop view v1;
@@ -14496,70 +16606,84 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "attached_condition": "t2.b is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["b"],
- "ref": ["test.t2.b"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.a < 3",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["i1"],
- "key": "i1",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t3.a > 1 and t3.a < 3"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "having_condition": "t3.a < 3",
- "filesort": {
- "sort_key": "t3.b",
- "temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t3.b < 21"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "t2.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t2.b"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.a < 3",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["i1"],
+ "key": "i1",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t3.a > 1 and t3.a < 3"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "having_condition": "t3.a < 3",
+ "filesort": {
+ "sort_key": "t3.b",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t3.b < 21"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
drop view v1;
@@ -14615,35 +16739,45 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from
@@ -14720,68 +16854,84 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 32,
- "filtered": 100,
- "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 32,
+ "filtered": 100,
+ "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select *
@@ -14814,45 +16964,57 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t1.c in ('aa','bb','cc') and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "24",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t2.c in ('aa','bb','cc')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t1.c in ('aa','bb','cc') and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "24",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t2.c in ('aa','bb','cc')"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from
@@ -14942,88 +17104,108 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 48,
- "filtered": 100,
- "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 48,
+ "filtered": 100,
+ "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2"
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2"
+ }
+ }
+ ]
+ }
}
}
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "UNION",
- "having_condition": "t2.c in ('aa','bb','cc')",
- "filesort": {
- "sort_key": "t2.a",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2"
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "UNION",
+ "having_condition": "t2.c in ('aa','bb','cc')",
+ "filesort": {
+ "sort_key": "t2.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c,
@@ -15073,35 +17255,45 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c,
@@ -15151,35 +17343,45 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 20,
- "filtered": 80,
- "attached_condition": "t2.a > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 20,
+ "filtered": 80,
+ "attached_condition": "t2.a > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c,
@@ -15229,37 +17431,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.a, t2.c"
- },
- "filesort": {
- "sort_key": "t2.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 20,
- "filtered": 100,
- "attached_condition": "t2.c in ('aa','bb','cc')"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.a, t2.c"
+ }
+ },
+ {
+ "filesort": {
+ "sort_key": "t2.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 20,
+ "filtered": 100,
+ "attached_condition": "t2.c in ('aa','bb','cc')"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
drop table t1,t2;
@@ -15332,47 +17546,57 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx_b"],
- "key": "idx_b",
- "key_length": "5",
- "used_key_parts": ["b"],
- "rows": 4,
- "filtered": 100,
- "index_condition": "t1.b < 3",
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t1.a is not null",
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 1,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx_b"],
+ "key": "idx_b",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "rows": 4,
+ "filtered": 100,
+ "index_condition": "t1.b < 3",
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t1.a is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
prepare stmt from "select t1.a,t.s,t.m
@@ -15443,43 +17667,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "possible_keys": ["idx_b"],
- "rows": 12,
- "filtered": 83.33333588,
- "attached_condition": "t1.b <= 5 and t1.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t1.a is not null",
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 1,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["idx_b"],
+ "rows": 12,
+ "filtered": 83.33333588,
+ "attached_condition": "t1.b <= 5 and t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t1.a is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
prepare stmt from "select t1.a,t.s,t.m
@@ -15548,41 +17782,51 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 9,
- "filtered": 100,
- "attached_condition": "trigcond(trigcond(t1.a is not null))",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t2.a",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "possible_keys": ["idx_a"],
- "rows": 90,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 9,
+ "filtered": 100,
+ "attached_condition": "trigcond(trigcond(t1.a is not null))",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t2.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "possible_keys": ["idx_a"],
+ "rows": 90,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam;
@@ -15639,47 +17883,57 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["idx_b"],
- "key": "idx_b",
- "key_length": "5",
- "used_key_parts": ["b"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t3.b > 15",
- "attached_condition": "t3.a is not null and t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "133",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t3.a", "test.t3.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t3.a is not null and t3.c is not null",
- "table": {
- "table_name": "t4",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "133",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t3.a", "test.t3.c"],
- "rows": 1,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["idx_b"],
+ "key": "idx_b",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t3.b > 15",
+ "attached_condition": "t3.a is not null and t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "133",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t3.a", "test.t3.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t3.a is not null and t3.c is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "133",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t3.a", "test.t3.c"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min
@@ -15718,42 +17972,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "possible_keys": ["idx_b"],
- "rows": 12,
- "filtered": 83.33333588,
- "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "133",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t3.a", "test.t3.c"],
- "rows": 4,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t4.a, t4.c",
- "temporary_table": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 40,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "possible_keys": ["idx_b"],
+ "rows": 12,
+ "filtered": 83.33333588,
+ "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "133",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t3.a", "test.t3.c"],
+ "rows": 4,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t4.a, t4.c",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 40,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min
@@ -15792,47 +18056,57 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["idx_b"],
- "key": "idx_b",
- "key_length": "5",
- "used_key_parts": ["b"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t3.b > 15",
- "attached_condition": "t3.a is not null and t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "133",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t3.a", "test.t3.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t3.a is not null and t3.c is not null",
- "table": {
- "table_name": "t4",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "133",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t3.a", "test.t3.c"],
- "rows": 1,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["idx_b"],
+ "key": "idx_b",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t3.b > 15",
+ "attached_condition": "t3.a is not null and t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "133",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t3.a", "test.t3.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t3.a is not null and t3.c is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "133",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t3.a", "test.t3.c"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min
@@ -15871,42 +18145,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "possible_keys": ["idx_b"],
- "rows": 12,
- "filtered": 83.33333588,
- "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "133",
- "used_key_parts": ["a", "c"],
- "ref": ["test.t3.a", "test.t3.c"],
- "rows": 4,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t4.c, t4.a",
- "temporary_table": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 40,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "possible_keys": ["idx_b"],
+ "rows": 12,
+ "filtered": 83.33333588,
+ "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "133",
+ "used_key_parts": ["a", "c"],
+ "ref": ["test.t3.a", "test.t3.c"],
+ "rows": 4,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t4.c, t4.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 40,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
drop index idx_a on t2;
@@ -15956,59 +18240,71 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "133",
- "used_key_parts": ["c", "b"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t2.b between 80 and 85 and t2.c in ('y','z')",
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "t3",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t3.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t3.c is not null",
- "table": {
- "table_name": "t4",
- "access_type": "ref",
- "possible_keys": ["idx_c"],
- "key": "idx_c",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t3.c"],
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "133",
+ "used_key_parts": ["c", "b"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t2.b between 80 and 85 and t2.c in ('y','z')",
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t3.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t3.c is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ref",
+ "possible_keys": ["idx_c"],
+ "key": "idx_c",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t3.c"],
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='split_materialized=off' for select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min
@@ -16104,53 +18400,65 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 90,
- "filtered": 63.28125,
- "attached_condition": "t2.b < 40 and t2.a is not null"
- },
- "table": {
- "table_name": "t3",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t3.c"],
- "rows": 10,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t4.c",
- "temporary_table": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "possible_keys": ["idx_c"],
- "rows": 160,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 90,
+ "filtered": 63.28125,
+ "attached_condition": "t2.b < 40 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t3.c"],
+ "rows": 10,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t4.c",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "possible_keys": ["idx_c"],
+ "rows": 160,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='split_materialized=off' for select *
@@ -16204,68 +18512,82 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "133",
- "used_key_parts": ["c", "b"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t2.b between 80 and 85 and t2.c in ('y','z')",
- "attached_condition": "t2.a is not null"
- },
- "table": {
- "table_name": "t3",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t3.c"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t3.c is not null",
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t4.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t4",
- "access_type": "ref",
- "possible_keys": ["idx_c"],
- "key": "idx_c",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t3.c"],
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "133",
+ "used_key_parts": ["c", "b"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t2.b between 80 and 85 and t2.c in ('y','z')",
+ "attached_condition": "t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t3.c"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t3.c is not null",
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t4.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ref",
+ "possible_keys": ["idx_c"],
+ "key": "idx_c",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t3.c"],
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
set statement optimizer_switch='split_materialized=off' for select *
@@ -16601,57 +18923,71 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 90,
- "filtered": 63.28125,
- "attached_condition": "t2.b < 40 and t2.a is not null"
- },
- "table": {
- "table_name": "t3",
- "access_type": "ref",
- "possible_keys": ["idx_a"],
- "key": "idx_a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "t3.c is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t3.c"],
- "rows": 10,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t4.c"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "possible_keys": ["idx_c"],
- "rows": 160,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 90,
+ "filtered": 63.28125,
+ "attached_condition": "t2.b < 40 and t2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ref",
+ "possible_keys": ["idx_a"],
+ "key": "idx_a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "t3.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t3.c"],
+ "rows": 10,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t4.c"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "possible_keys": ["idx_c"],
+ "rows": 160,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
drop table t1,t2,t3,t4;
@@ -16704,84 +19040,102 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t4",
- "access_type": "range",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t4.a < 2",
- "attached_condition": "t4.c is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t4.c"],
- "rows": 2,
- "filtered": 100,
- "first_match": "t4",
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 3,
- "const_condition": "1",
- "outer_ref_condition": "t4.c is not null",
- "table": {
- "table_name": "t3",
- "access_type": "ref",
- "possible_keys": ["c"],
- "key": "c",
- "key_length": "128",
- "used_key_parts": ["c"],
- "ref": ["test.t4.c"],
- "rows": 2,
- "filtered": 100
- },
- "table": {
- "table_name": "<subquery4>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "4",
- "used_key_parts": ["a"],
- "ref": ["func"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 4,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- },
- "block-nl-join": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t4",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t4.a < 2",
+ "attached_condition": "t4.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t4.c"],
+ "rows": 2,
+ "filtered": 100,
+ "first_match": "t4",
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 3,
+ "const_condition": "1",
+ "outer_ref_condition": "t4.c is not null",
+ "nested_loop": [
+ {
"table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
+ "table_name": "t3",
+ "access_type": "ref",
+ "possible_keys": ["c"],
+ "key": "c",
+ "key_length": "128",
+ "used_key_parts": ["c"],
+ "ref": ["test.t4.c"],
+ "rows": 2,
"filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "t2.i = t1.i and t2.i = t1.i"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery4>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "ref": ["func"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 4,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "t2.i = t1.i and t2.i = t1.i"
+ }
+ }
+ ]
+ }
+ }
+ }
}
- }
+ ]
}
}
}
}
- }
+ ]
}
}
DROP VIEW v1;
@@ -16856,43 +19210,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "possible_keys": ["PRIMARY"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.f <> 5"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "4",
- "used_key_parts": ["pk2"],
- "ref": ["test.t1.pk1"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk2"],
- "ref": ["test.t1.pk1"],
- "rows": 1,
- "filtered": 100,
- "using_index": true
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["PRIMARY"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.f <> 5"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "ref": ["test.t1.pk1"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "ref": ["test.t1.pk1"],
+ "rows": 1,
+ "filtered": 100,
+ "using_index": true
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
DROP VIEW v2;
@@ -17288,58 +19652,66 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 50,
- "attached_condition": "v1.a = 3",
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 2,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 50,
- "attached_condition": "t1.a = 3"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "UNION",
- "table": {
- "message": "No tables used"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "v1.a = 3",
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<union2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 2,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 50,
+ "attached_condition": "t1.a = 3"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "UNION",
+ "table": {
+ "message": "No tables used"
+ }
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
SELECT * from v1 WHERE a=3;
@@ -17386,73 +19758,91 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t3.`id` is not null and t3.`id` is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.id"],
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "<subquery3>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "4",
- "used_key_parts": ["a"],
- "ref": ["func"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t3.`id` is not null and t3.`id` is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.id"],
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "ref": ["func"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.id"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "cp2",
- "access_type": "range",
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 8,
- "filtered": 100,
- "using_index_for_group_by": true
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.id"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "cp2",
+ "access_type": "range",
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 8,
+ "filtered": 100,
+ "using_index_for_group_by": true
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
set optimizer_switch="split_materialized=default";
@@ -17476,77 +19866,95 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t3.`id` is not null and t3.`id` is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.id"],
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "<subquery3>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "4",
- "used_key_parts": ["a"],
- "ref": ["func"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t3.`id` is not null and t3.`id` is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.id"],
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "ref": ["func"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
- }
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.id"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "lateral": 1,
- "query_block": {
- "select_id": 2,
- "outer_ref_condition": "t1.a is not null",
- "table": {
- "table_name": "cp2",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t1.a"],
- "rows": 1,
- "filtered": 100,
- "using_index": true
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.id"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "lateral": 1,
+ "query_block": {
+ "select_id": 2,
+ "outer_ref_condition": "t1.a is not null",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "cp2",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100,
+ "using_index": true
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
prepare stmt from "select * from t1, (select a from t1 cp2 group by a) dt, t3
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 3c13cc976aa..09e9fd6d55c 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -381,41 +381,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t2.f2 in (2,3) and t2.f2 is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["f1"],
- "ref": ["test.t2.f2"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 in (2,3)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t2.f2 in (2,3) and t2.f2 is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["test.t2.f2"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 in (2,3)"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
select * from v1 join v4 on f1=f2;
@@ -475,46 +485,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "tt.f1",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "tt.f1 > 2",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "tt.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
}
- }
+ ]
}
}
select * from (select * from
@@ -544,58 +566,72 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2 and tt.f1 > 2 and tt.f1 is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived5>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["f1"],
- "ref": ["tt.f1"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 5,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
+ },
+ {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["tt.f1"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2 and t1.f1 > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
flush status;
@@ -671,92 +707,114 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "x.f1 is not null",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "tt.f1",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "tt.f1 > 2",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "x.f1 is not null",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "tt.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
- },
- "table": {
- "table_name": "<derived4>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["f1"],
- "ref": ["x.f1"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 4,
- "filesort": {
- "sort_key": "tt.f1",
- "temporary_table": {
- "table": {
- "table_name": "<derived5>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "tt.f1 > 2",
- "materialized": {
- "query_block": {
- "select_id": 5,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ },
+ {
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["x.f1"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 4,
+ "filesort": {
+ "sort_key": "tt.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "tt.f1 > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 > 2"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
}
- }
+ ]
}
}
select * from
@@ -795,30 +853,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "v1.f1 < 7",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "v1.f1 < 7",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
select * from ( select * from v1 where f1 < 7) tt;
@@ -873,41 +939,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null"
- },
- "table": {
- "table_name": "<derived5>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["f1"],
- "ref": ["test.t2.f2"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 5,
- "filesort": {
- "sort_key": "t1.f1",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100,
- "attached_condition": "t1.f1 < 7 and t1.f1 in (2,3)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t2.f2 < 7 and t2.f2 in (2,3) and t2.f2 is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["f1"],
+ "ref": ["test.t2.f2"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 5,
+ "filesort": {
+ "sort_key": "t1.f1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100,
+ "attached_condition": "t1.f1 < 7 and t1.f1 in (2,3)"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
select * from v6 join v7 on f2=f1;
diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result
index 96efeb03c5e..c88b91991f2 100644
--- a/mysql-test/main/except.result
+++ b/mysql-test/main/except.result
@@ -37,24 +37,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -76,17 +84,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -95,17 +107,21 @@ ANALYZE
"operation": "EXCEPT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -119,66 +135,78 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 1,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 1,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
select * from ((select a,b from t1) except (select c,d from t2)) a;
@@ -247,46 +275,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
}
]
@@ -308,34 +348,40 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -344,34 +390,40 @@ ANALYZE
"operation": "EXCEPT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -386,100 +438,116 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 3,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 3,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
"r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
},
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
"r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a;
diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result
index 2903ec857c3..f74aeda5ab2 100644
--- a/mysql-test/main/except_all.result
+++ b/mysql-test/main/except_all.result
@@ -65,24 +65,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "EXCEPT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -111,66 +119,78 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 4,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 4,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
ANALYZE format=json select * from ((select a from t1) except all (select c from t2)) a;
@@ -180,66 +200,78 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 4,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 4,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
select * from ((select a from t1) except all (select c from t2)) a;
@@ -349,67 +381,83 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL"
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL"
+ }
+ }
+ ]
+ }
},
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL"
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL"
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
ANALYZE format=json (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4);
@@ -427,34 +475,40 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -463,34 +517,40 @@ ANALYZE
"operation": "EXCEPT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -504,100 +564,116 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 9,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<except2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 7,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 9,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<except2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 7,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
"r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "EXCEPT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
},
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ALL",
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "EXCEPT",
"r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "r_filtered": 100
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
prepare stmt from "(select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)";
diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result
index 98a2fec91fa..35f2d11c8b6 100644
--- a/mysql-test/main/explain_json.result
+++ b/mysql-test/main/explain_json.result
@@ -6,12 +6,16 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
explain format=json select * from t0 where 1>2;
@@ -29,13 +33,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t0.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a < 3"
+ }
+ }
+ ]
}
}
# Try a basic join
@@ -51,24 +59,30 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t0.a is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t0.a"],
- "rows": 1,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t0.a"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
}
}
# Try range and index_merge
@@ -79,17 +93,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["a1"],
- "key": "a1",
- "key_length": "5",
- "used_key_parts": ["a1"],
- "rows": 5,
- "filtered": 100,
- "index_condition": "t2.a1 < 5"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["a1"],
+ "key": "a1",
+ "key_length": "5",
+ "used_key_parts": ["a1"],
+ "rows": 5,
+ "filtered": 100,
+ "index_condition": "t2.a1 < 5"
+ }
+ }
+ ]
}
}
explain format=json select * from t2 where a1=1 or b1=2;
@@ -97,27 +115,35 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "index_merge",
- "possible_keys": ["a1", "b1"],
- "key_length": "5,5",
- "index_merge": {
- "sort_union": {
- "range": {
- "key": "a1",
- "used_key_parts": ["a1"]
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "index_merge",
+ "possible_keys": ["a1", "b1"],
+ "key_length": "5,5",
+ "index_merge": {
+ "sort_union": [
+ {
+ "range": {
+ "key": "a1",
+ "used_key_parts": ["a1"]
+ }
+ },
+ {
+ "range": {
+ "key": "b1",
+ "used_key_parts": ["b1"]
+ }
+ }
+ ]
},
- "range": {
- "key": "b1",
- "used_key_parts": ["b1"]
- }
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.a1 = 1 or t2.b1 = 2"
}
- },
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.a1 = 1 or t2.b1 = 2"
- }
+ }
+ ]
}
}
explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
@@ -125,27 +151,35 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "index_merge",
- "possible_keys": ["a1", "b1"],
- "key_length": "5,10",
- "index_merge": {
- "sort_union": {
- "range": {
- "key": "a1",
- "used_key_parts": ["a1"]
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "index_merge",
+ "possible_keys": ["a1", "b1"],
+ "key_length": "5,10",
+ "index_merge": {
+ "sort_union": [
+ {
+ "range": {
+ "key": "a1",
+ "used_key_parts": ["a1"]
+ }
+ },
+ {
+ "range": {
+ "key": "b1",
+ "used_key_parts": ["b1", "b2"]
+ }
+ }
+ ]
},
- "range": {
- "key": "b1",
- "used_key_parts": ["b1", "b2"]
- }
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.a1 = 1 or t2.b1 = 2 and t2.b2 = 3"
}
- },
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.a1 = 1 or t2.b1 = 2 and t2.b2 = 3"
- }
+ }
+ ]
}
}
explain format=json select * from t2 where (a1=1 and a2=1) or
@@ -154,27 +188,35 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "index_merge",
- "possible_keys": ["a1", "b1"],
- "key_length": "10,10",
- "index_merge": {
- "union": {
- "range": {
- "key": "a1",
- "used_key_parts": ["a1", "a2"]
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "index_merge",
+ "possible_keys": ["a1", "b1"],
+ "key_length": "10,10",
+ "index_merge": {
+ "union": [
+ {
+ "range": {
+ "key": "a1",
+ "used_key_parts": ["a1", "a2"]
+ }
+ },
+ {
+ "range": {
+ "key": "b1",
+ "used_key_parts": ["b1", "b2"]
+ }
+ }
+ ]
},
- "range": {
- "key": "b1",
- "used_key_parts": ["b1", "b2"]
- }
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t2.a1 = 1 and t2.a2 = 1 or t2.b1 = 2 and t2.b2 = 1"
}
- },
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t2.a1 = 1 and t2.a2 = 1 or t2.b1 = 2 and t2.b2 = 1"
- }
+ }
+ ]
}
}
# Try ref access on two key components
@@ -183,24 +225,30 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t0.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["b1"],
- "key": "b1",
- "key_length": "10",
- "used_key_parts": ["b1", "b2"],
- "ref": ["test.t0.a", "const"],
- "rows": 1,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["b1"],
+ "key": "b1",
+ "key_length": "10",
+ "used_key_parts": ["b1", "b2"],
+ "ref": ["test.t0.a", "const"],
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ]
}
}
drop table t1,t2;
@@ -218,24 +266,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "A",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "A",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "B",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "B",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -253,24 +309,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "A",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "A",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "B",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "B",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -287,25 +351,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t1.b = t0.a"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t1.b = t0.a"
+ }
+ }
+ ]
}
}
}
@@ -319,26 +391,34 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t0.a > (subquery#2) or t0.a < 3"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a > (subquery#2) or t0.a < 3"
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t1.b = t0.a"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t1.b = t0.a"
+ }
+ }
+ ]
}
}
}
@@ -357,26 +437,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "tbl1",
- "access_type": "ALL",
- "rows": 100,
- "filtered": 100,
- "attached_condition": "tbl1.b < 3"
- },
- "block-nl-join": {
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "rows": 100,
- "filtered": 100,
- "attached_condition": "tbl2.b < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl1",
+ "access_type": "ALL",
+ "rows": 100,
+ "filtered": 100,
+ "attached_condition": "tbl1.b < 3"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "1Kb",
- "join_type": "BNL",
- "attached_condition": "tbl2.a = tbl1.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "rows": 100,
+ "filtered": 100,
+ "attached_condition": "tbl2.b < 5"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL",
+ "attached_condition": "tbl2.a = tbl1.a"
+ }
+ }
+ ]
}
}
drop table t1;
@@ -454,12 +540,16 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -478,30 +568,38 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "tbl.cnt > 0",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "cnt > 0",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "tbl.cnt > 0",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "cnt > 0",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
explain format=json
@@ -511,41 +609,51 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "tbl2.a is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "8",
- "used_key_parts": ["cnt"],
- "ref": ["test.tbl2.a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "tbl1.cnt = tbl2.a",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "tbl2.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "8",
+ "used_key_parts": ["cnt"],
+ "ref": ["test.tbl2.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "tbl1.cnt = tbl2.a",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
#
@@ -557,38 +665,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "4",
- "used_key_parts": ["max(a)"],
- "ref": ["test.t1.a"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "4",
+ "used_key_parts": ["max(a)"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
#
@@ -603,46 +721,58 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "4",
- "used_key_parts": ["a"],
- "ref": ["func"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "ref": ["func"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "block-nl-join": {
"table": {
- "table_name": "t0",
+ "table_name": "t2",
"access_type": "ALL",
"rows": 10,
"filtered": 100
- }
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL"
}
}
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "1Kb",
- "join_type": "BNL"
- }
+ ]
}
}
#
@@ -659,25 +789,31 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "first_match": "t2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "141",
- "join_type": "BNL",
- "attached_condition": "t1.b = t2.b and t1.a = t2.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "first_match": "t2"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "141",
+ "join_type": "BNL",
+ "attached_condition": "t1.b = t2.b and t1.a = t2.a"
+ }
+ }
+ ]
}
}
#
@@ -696,26 +832,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
- "duplicates_removal": {
- "block-nl-join": {
+ "nested_loop": [
+ {
"table": {
- "table_name": "t1",
+ "table_name": "t2",
"access_type": "ALL",
"rows": 10,
"filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "206",
- "join_type": "BNL",
- "attached_condition": "t1.b = t2.b and t1.a = t2.a"
+ }
+ },
+ {
+ "duplicates_removal": {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "206",
+ "join_type": "BNL",
+ "attached_condition": "t1.b = t2.b and t1.a = t2.a"
+ }
+ }
}
- }
+ ]
}
}
set optimizer_switch=@tmp;
@@ -732,18 +874,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t1.a < 3",
- "mrr_type": "Rowid-ordered scan"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t1.a < 3",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+ ]
}
}
# 'Range checked for each record'
@@ -754,22 +900,28 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "tbl1",
- "access_type": "ALL",
- "rows": 100,
- "filtered": 100
- },
- "range-checked-for-each-record": {
- "keys": ["a"],
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "possible_keys": ["a"],
- "rows": 100,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl1",
+ "access_type": "ALL",
+ "rows": 100,
+ "filtered": 100
+ }
+ },
+ {
+ "range-checked-for-each-record": {
+ "keys": ["a"],
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "possible_keys": ["a"],
+ "rows": 100,
+ "filtered": 100
+ }
+ }
}
- }
+ ]
}
}
drop table t1;
@@ -786,49 +938,59 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "outer_t1",
- "access_type": "index",
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "!<in_optimizer>(outer_t1.a,<exists>(subquery#2))",
- "using_index": true
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "outer_t1",
+ "access_type": "index",
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "!<in_optimizer>(outer_t1.a,<exists>(subquery#2))",
+ "using_index": true
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
"having_condition": "trigcond(t1.a is null)",
- "full-scan-on-null_key": {
- "table": {
- "table_name": "t1",
- "access_type": "ref_or_null",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["func"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)",
- "using_index": true
- }
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
+ "nested_loop": [
+ {
+ "full-scan-on-null_key": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref_or_null",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["func"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)",
+ "using_index": true
+ }
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "attached_condition": "t2.b <> outer_t1.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "attached_condition": "t2.b <> outer_t1.a"
+ }
+ }
+ ]
}
}
]
@@ -852,34 +1014,44 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "<not>(<in_optimizer>(20000,<max>(subquery#2) >= 20000))",
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "tbl1",
- "access_type": "ALL",
- "rows": 100,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "tbl2",
- "access_type": "ALL",
- "rows": 100,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl1",
+ "access_type": "ALL",
+ "rows": 100,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "1Kb",
- "join_type": "BNL",
- "attached_condition": "tbl2.b = tbl1.b"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "tbl2",
+ "access_type": "ALL",
+ "rows": 100,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "1Kb",
+ "join_type": "BNL",
+ "attached_condition": "tbl2.b = tbl1.b"
+ }
+ }
+ ]
}
}
]
@@ -899,23 +1071,31 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -949,16 +1129,20 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "key": "a",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "rows": 101,
- "filtered": 100,
- "using_index_for_group_by": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "key": "a",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "rows": 101,
+ "filtered": 100,
+ "using_index_for_group_by": true
+ }
+ }
+ ]
}
}
analyze format=json select count(distinct b) from t1 group by a;
@@ -968,21 +1152,25 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "key": "a",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "r_loops": 1,
- "rows": 101,
- "r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "using_index_for_group_by": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "key": "a",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "r_loops": 1,
+ "rows": 101,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "using_index_for_group_by": true
+ }
+ }
+ ]
}
}
drop table t1,t2;
@@ -1043,17 +1231,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "key": "idx_t1_1",
- "key_length": "147",
- "used_key_parts": ["a1", "a2", "b"],
- "rows": 17,
- "filtered": 100,
- "attached_condition": "t1.b = 'a' and t1.a2 >= 'b'",
- "using_index_for_group_by": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "key": "idx_t1_1",
+ "key_length": "147",
+ "used_key_parts": ["a1", "a2", "b"],
+ "rows": 17,
+ "filtered": 100,
+ "attached_condition": "t1.b = 'a' and t1.a2 >= 'b'",
+ "using_index_for_group_by": true
+ }
+ }
+ ]
}
}
explain format=json select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
@@ -1061,17 +1253,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "key": "idx_t1_1",
- "key_length": "163",
- "used_key_parts": ["a1", "a2", "b", "c"],
- "rows": 65,
- "filtered": 100,
- "attached_condition": "t1.b = 'a' and t1.c = 'i121' and t1.a2 >= 'b'",
- "using_index_for_group_by": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "key": "idx_t1_1",
+ "key_length": "163",
+ "used_key_parts": ["a1", "a2", "b", "c"],
+ "rows": 65,
+ "filtered": 100,
+ "attached_condition": "t1.b = 'a' and t1.c = 'i121' and t1.a2 >= 'b'",
+ "using_index_for_group_by": true
+ }
+ }
+ ]
}
}
drop table t1;
@@ -1085,13 +1281,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.a = _latin1'\xDF'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.a = _latin1'\xDF'"
+ }
+ }
+ ]
}
}
DROP TABLE t1;
@@ -1105,13 +1305,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "(case when convert(t1.a using utf8mb3) = <cache>(_utf8mb3'a' collate utf8mb3_bin) then NULL else t1.a end)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "(case when convert(t1.a using utf8mb3) = <cache>(_utf8mb3'a' collate utf8mb3_bin) then NULL else t1.a end)"
+ }
+ }
+ ]
}
}
DROP TABLE t1;
@@ -1138,12 +1342,16 @@ EXPLAIN
"filesort": {
"sort_key": "t2.a",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 256,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 256,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1157,12 +1365,16 @@ EXPLAIN
"filesort": {
"sort_key": "t2.a",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 256,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 256,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1187,12 +1399,16 @@ EXPLAIN
"filesort": {
"sort_key": "t2.a",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 256,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 256,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1213,13 +1429,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "system",
- "rows": 0,
- "filtered": 0,
- "const_row_not_found": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "system",
+ "rows": 0,
+ "filtered": 0,
+ "const_row_not_found": true
+ }
+ }
+ ]
}
}
analyze format=json
@@ -1251,20 +1471,26 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1",
- "table": {
- "table_name": "t2",
- "access_type": "const",
- "possible_keys": ["PRIMARY"],
- "rows": 1,
- "filtered": 100,
- "impossible_on_condition": true
- },
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "rows": 1,
+ "filtered": 100,
+ "impossible_on_condition": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
analyze format=json
@@ -1276,28 +1502,34 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "1",
- "table": {
- "table_name": "t2",
- "access_type": "const",
- "possible_keys": ["PRIMARY"],
- "r_loops": 0,
- "rows": 1,
- "r_rows": null,
- "filtered": 100,
- "r_filtered": null,
- "impossible_on_condition": true
- },
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "r_loops": 0,
+ "rows": 1,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "impossible_on_condition": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
# Check ET_NOT_EXISTS:
@@ -1312,26 +1544,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
- "table": {
- "table_name": "t2",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "ref": ["test.t1.a"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
- "using_index": true,
- "not_exists": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
+ "using_index": true,
+ "not_exists": true
+ }
+ }
+ ]
}
}
analyze format=json
@@ -1342,36 +1580,42 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "table": {
- "table_name": "t2",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "ref": ["test.t1.a"],
- "r_loops": 2,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
- "using_index": true,
- "not_exists": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "ref": ["test.t1.a"],
+ "r_loops": 2,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))",
+ "using_index": true,
+ "not_exists": true
+ }
+ }
+ ]
}
}
# Check ET_DISTINCT
@@ -1387,26 +1631,32 @@ EXPLAIN
"query_block": {
"select_id": 1,
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "ref": ["test.t1.a"],
- "rows": 1,
- "filtered": 100,
- "using_index": true,
- "distinct": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "ref": ["test.t1.a"],
+ "rows": 1,
+ "filtered": 100,
+ "using_index": true,
+ "distinct": true
+ }
+ }
+ ]
}
}
}
@@ -1419,36 +1669,42 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "ref": ["test.t1.a"],
- "r_loops": 2,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "using_index": true,
- "distinct": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "ref": ["test.t1.a"],
+ "r_loops": 2,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "using_index": true,
+ "distinct": true
+ }
+ }
+ ]
}
}
}
@@ -1477,31 +1733,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t3.a is not null"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.a"],
- "rows": 1,
- "filtered": 100,
- "index_condition_bka": "t4.b + 1 <= t3.b + 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t3.a is not null"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "400",
- "join_type": "BKA",
- "mrr_type": "Rowid-ordered scan"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.a"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition_bka": "t4.b + 1 <= t3.b + 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "400",
+ "join_type": "BKA",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+ ]
}
}
analyze format=json
@@ -1512,42 +1774,48 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t3.a is not null"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t4",
- "access_type": "ref",
- "possible_keys": ["a"],
- "key": "a",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.a"],
- "r_loops": 1,
- "rows": 1,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "index_condition_bka": "t4.b + 1 <= t3.b + 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t3.a is not null"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "400",
- "join_type": "BKA",
- "mrr_type": "Rowid-ordered scan",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t4",
+ "access_type": "ref",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.a"],
+ "r_loops": 1,
+ "rows": 1,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "index_condition_bka": "t4.b + 1 <= t3.b + 1"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "400",
+ "join_type": "BKA",
+ "mrr_type": "Rowid-ordered scan",
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
set optimizer_switch=@tmp_optimizer_switch;
@@ -1566,12 +1834,16 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -1579,13 +1851,17 @@ EXPLAIN
"query_block": {
"select_id": 2,
"outer_ref_condition": "t0.a < 5",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t1.b < t0.a"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t1.b < t0.a"
+ }
+ }
+ ]
}
}
}
@@ -1603,17 +1879,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a, t1.b desc",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a, t1.b desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
explain format=json select * from t1 order by a desc, b desc;
@@ -1621,17 +1901,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a desc, t1.b desc",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc, t1.b desc",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
explain format=json select * from t1 order by a desc, b ;
@@ -1639,17 +1923,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a desc, t1.b",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc, t1.b",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
drop table t1;
diff --git a/mysql-test/main/explain_json_format_partitions.result b/mysql-test/main/explain_json_format_partitions.result
index 0c7d9e93105..f164006d756 100644
--- a/mysql-test/main/explain_json_format_partitions.result
+++ b/mysql-test/main/explain_json_format_partitions.result
@@ -12,14 +12,18 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "partitions": ["p0"],
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "attached_condition": "t1.a in (2,3,4)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "partitions": ["p0"],
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t1.a in (2,3,4)"
+ }
+ }
+ ]
}
}
analyze format=json select * from t1 where a in (2,3,4);
@@ -29,19 +33,23 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "partitions": ["p0"],
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 30,
- "attached_condition": "t1.a in (2,3,4)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "partitions": ["p0"],
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "t1.a in (2,3,4)"
+ }
+ }
+ ]
}
}
analyze format=json update t1 set a=a+10 where a in (2,3,4);
diff --git a/mysql-test/main/explain_json_innodb.result b/mysql-test/main/explain_json_innodb.result
index 8cec65642b4..871c0d6a258 100644
--- a/mysql-test/main/explain_json_innodb.result
+++ b/mysql-test/main/explain_json_innodb.result
@@ -16,39 +16,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "tbl_alias1",
- "access_type": "ALL",
- "rows": 1,
- "filtered": 100,
- "attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null"
- },
- "table": {
- "table_name": "tbl_alias2",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "9",
- "used_key_parts": ["c", "b"],
- "ref": [
- "test.tbl_alias1.column_name_2",
- "test.tbl_alias1.column_name_1"
- ],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2",
- "using_index": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tbl_alias1",
+ "access_type": "ALL",
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "tbl_alias1.column_name_2 is not null and tbl_alias1.column_name_1 is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "tbl_alias2",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "9",
+ "used_key_parts": ["c", "b"],
+ "ref": [
+ "test.tbl_alias1.column_name_2",
+ "test.tbl_alias1.column_name_1"
+ ],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "tbl_alias2.c = tbl_alias1.column_name_2",
+ "using_index": true
+ }
+ }
+ ]
}
}
]
diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result
index 9b124296e3d..443745db643 100644
--- a/mysql-test/main/having_cond_pushdown.result
+++ b/mysql-test/main/having_cond_pushdown.result
@@ -37,13 +37,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2"
+ }
+ }
+ ]
}
}
}
@@ -59,13 +63,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2"
+ }
+ }
+ ]
}
}
}
@@ -97,13 +105,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b)
@@ -114,13 +126,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
}
}
# extracted AND formula
@@ -155,13 +171,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a < 4"
+ }
+ }
+ ]
}
}
}
@@ -177,13 +197,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a < 4"
+ }
+ }
+ ]
}
}
}
@@ -222,13 +246,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 or t1.a = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 or t1.a = 3"
+ }
+ }
+ ]
}
}
}
@@ -246,13 +274,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 or t1.a = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 or t1.a = 3"
+ }
+ }
+ ]
}
}
}
@@ -291,13 +323,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 2 or t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 or t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -315,13 +351,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 2 or t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 or t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -357,13 +397,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -381,13 +425,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -422,13 +470,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -446,13 +498,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -484,13 +540,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.a) = 3",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b)
@@ -503,13 +563,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.a) = 3",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for SELECT t1.a,MAX(t1.b)
@@ -539,13 +603,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b) > 12",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b)
@@ -558,13 +626,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b) > 12",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for SELECT t1.a,MAX(t1.b)
@@ -597,13 +669,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -621,13 +697,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -664,13 +744,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -688,13 +772,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -726,13 +814,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b) = 13 and min(t1.c) = 2",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MIN(t1.c)
@@ -745,13 +837,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b) = 13 and min(t1.c) = 2",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2"
+ }
+ }
+ ]
}
}
# conjunctive subformula : no stored function pushdown
@@ -785,13 +881,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -809,13 +909,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -858,41 +962,51 @@ EXPLAIN
"filesort": {
"sort_key": "v1.a",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x > 1 and t2.x is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.x"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x > 1 and t2.x is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.x"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
}
@@ -908,41 +1022,51 @@ EXPLAIN
"filesort": {
"sort_key": "v1.a",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x > 1 and t2.x is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.x"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 3,
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x > 1 and t2.x is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.x"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
}
@@ -985,42 +1109,52 @@ EXPLAIN
"filesort": {
"sort_key": "v1.c",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.x"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 2",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "t1.c > 2",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.x"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "t1.c > 2",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
}
@@ -1036,42 +1170,52 @@ EXPLAIN
"filesort": {
"sort_key": "v1.c",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x is not null"
- },
- "table": {
- "table_name": "<derived3>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.x"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "v1.c > 2",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "t1.c > 2",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.x"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "v1.c > 2",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "t1.c > 2",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
}
@@ -1115,39 +1259,49 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["x", "MAX(t2.y)"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x < 5 and t2.x > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["x", "MAX(t2.y)"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x < 5 and t2.x > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
}
@@ -1164,39 +1318,49 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<subquery3>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["x", "MAX(t2.y)"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x < 5 and t2.x > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["x", "MAX(t2.y)"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x < 5 and t2.x > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
}
@@ -1238,40 +1402,50 @@ EXPLAIN
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b < 14 and t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["x", "MAX(t2.y)"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.y)` < 14",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b < 14 and t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["x", "MAX(t2.y)"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.y)` < 14",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
}
@@ -1288,40 +1462,50 @@ EXPLAIN
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b < 14 and t1.a is not null and t1.b is not null"
- },
- "table": {
- "table_name": "<subquery3>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["x", "MAX(t2.y)"],
- "ref": ["test.t1.a", "test.t1.b"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "having_condition": "`MAX(t2.y)` < 14",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t2.x < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b < 14 and t1.a is not null and t1.b is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["x", "MAX(t2.y)"],
+ "ref": ["test.t1.a", "test.t1.b"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "`MAX(t2.y)` < 14",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t2.x < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
}
@@ -1358,13 +1542,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -1381,13 +1569,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -1419,13 +1611,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "t1.a = 2 and t1.c = 2",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 13"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 13"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT MAX(t1.a),t1.a,t1.b,t1.c
@@ -1438,13 +1634,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "t1.a = 2 and t1.c = 2",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 13"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 13"
+ }
+ }
+ ]
}
}
# extracted AND formula : using equalities
@@ -1477,13 +1677,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -1498,13 +1702,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -1535,13 +1743,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2 and t1.c = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2 and t1.c = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -1552,13 +1764,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2 and t1.c = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2 and t1.c = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for SELECT t1.a,MAX(t1.b),t1.c
@@ -1591,13 +1807,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a > 1 or t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a > 1 or t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -1615,13 +1835,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a > 1 or t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a > 1 or t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -1662,13 +1886,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -1684,13 +1912,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -1729,13 +1961,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a > 1 and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a > 1 and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -1751,13 +1987,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and t1.a > 1 and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and t1.a > 1 and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -1796,13 +2036,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4) and t1.a < 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4) and t1.a < 2"
+ }
+ }
+ ]
}
}
}
@@ -1820,13 +2064,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4) and t1.a < 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4) and t1.a < 2"
+ }
+ }
+ ]
}
}
}
@@ -1868,13 +2116,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4)"
+ }
+ }
+ ]
}
}
}
@@ -1892,13 +2144,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = t1.a and (t1.a > 1 or t1.a < 4)"
+ }
+ }
+ ]
}
}
}
@@ -1956,12 +2212,16 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1978,12 +2238,16 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -2020,13 +2284,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.b > 10) and t1.b < 14"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.b > 10) and t1.b < 14"
+ }
+ }
+ ]
}
}
}
@@ -2042,13 +2310,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.b > 10) and t1.b < 14"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.b > 10) and t1.b < 14"
+ }
+ }
+ ]
}
}
}
@@ -2086,13 +2358,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.b > 15)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.b > 15)"
+ }
+ }
+ ]
}
}
}
@@ -2108,13 +2384,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.b > 15)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.b > 15)"
+ }
+ }
+ ]
}
}
}
@@ -2151,13 +2431,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.a = 2 and t1.b > 15)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.a = 2 and t1.b > 15)"
+ }
+ }
+ ]
}
}
}
@@ -2173,13 +2457,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.a = 2 and t1.b > 15)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.b > 10) and (t1.b < 14 or t1.a = 2 and t1.b > 15)"
+ }
+ }
+ ]
}
}
}
@@ -2218,13 +2506,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.b = 13 and t1.a > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.b = 13 and t1.a > 2"
+ }
+ }
+ ]
}
}
}
@@ -2240,13 +2532,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.b = 13 and t1.a > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.b = 13 and t1.a > 2"
+ }
+ }
+ ]
}
}
}
@@ -2282,13 +2578,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a < 2 or t1.b = 13 and t1.a > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a < 2 or t1.b = 13 and t1.a > 2"
+ }
+ }
+ ]
}
}
}
@@ -2304,13 +2604,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a < 2 or t1.b = 13 and t1.a > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a < 2 or t1.b = 13 and t1.a > 2"
+ }
+ }
+ ]
}
}
}
@@ -2348,13 +2652,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a < 2 or t1.a > 2 and (t1.b = 13 or t1.b = 14)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a < 2 or t1.a > 2 and (t1.b = 13 or t1.b = 14)"
+ }
+ }
+ ]
}
}
}
@@ -2370,13 +2678,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a < 2 or t1.a > 2 and (t1.b = 13 or t1.b = 14)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a < 2 or t1.a > 2 and (t1.b = 13 or t1.b = 14)"
+ }
+ }
+ ]
}
}
}
@@ -2411,13 +2723,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.a = 1 or t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a = 1 or t1.a = 2"
+ }
+ }
+ ]
}
}
}
@@ -2435,13 +2751,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a < 2 or t1.a = 1 or t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 or t1.a = 1 or t1.a = 2"
+ }
+ }
+ ]
}
}
}
@@ -2478,13 +2798,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2 or t1.a = 1 or t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2 or t1.a = 1 or t1.a = 2"
+ }
+ }
+ ]
}
}
}
@@ -2502,13 +2826,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 2 or t1.a = 1 or t1.a = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 2 or t1.a = 1 or t1.a = 2"
+ }
+ }
+ ]
}
}
}
@@ -2541,13 +2869,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.c) = 3",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,t1.b,MAX(t1.c)
@@ -2560,13 +2892,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.c) = 3",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
}
}
# conjunctive subformula : equalities pushdown
@@ -2597,13 +2933,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b = 14)",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,t1.b,MAX(t1.c)
@@ -2616,13 +2956,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b) = 14",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 3"
+ }
+ }
+ ]
}
}
# conjunctive subformula : multiple equality consists of
@@ -2652,13 +2996,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b = 14)",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,t1.b,MAX(t1.c)
@@ -2671,13 +3019,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "max(t1.b) = 14",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
#
@@ -2719,13 +3071,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b > 2 and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b > 2 and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -2741,13 +3097,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b > 2 and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b > 2 and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -2783,13 +3143,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 3 and t1.b > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 3 and t1.b > 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,t1.b,MAX(t1.c)
@@ -2800,13 +3164,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 3 and t1.b > 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 3 and t1.b > 2"
+ }
+ }
+ ]
}
}
# inequality : equality in WHERE
@@ -2843,13 +3211,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -2865,13 +3237,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a < 3"
+ }
+ }
+ ]
}
}
}
@@ -2907,13 +3283,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.b = 14"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.b = 14"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,t1.b,MAX(t1.c)
@@ -2924,13 +3304,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.b = 14 and t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.b = 14 and t1.a = 1"
+ }
+ }
+ ]
}
}
# equality : equality in WHERE, impossible WHERE
@@ -3011,13 +3395,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -3028,13 +3416,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c = 1 and t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c = 1 and t1.a = 1"
+ }
+ }
+ ]
}
}
# inequality : AND formula in WHERE
@@ -3073,13 +3465,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c > 0 and t1.c < 3 and t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c > 0 and t1.c < 3 and t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -3095,13 +3491,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.c > 0 and t1.c < 3 and t1.a > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.c > 0 and t1.c < 3 and t1.a > 1"
+ }
+ }
+ ]
}
}
}
@@ -3137,13 +3537,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c > 0 and t1.c < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c > 0 and t1.c < 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -3154,13 +3558,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c > 0 and t1.c < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c > 0 and t1.c < 3"
+ }
+ }
+ ]
}
}
# equality : AND formula in WHERE, impossible WHERE
@@ -3195,13 +3603,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c < 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -3212,13 +3624,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c < 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c < 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for SELECT t1.a,MAX(t1.b)
@@ -3297,13 +3713,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.b = 2 and t3.d = 1 and t3.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.b = 2 and t3.d = 1 and t3.a = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t3.a,t3.b,MAX(t3.c),t3.d
@@ -3314,13 +3734,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.b = 2 and t3.d = 1 and t3.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.b = 2 and t3.d = 1 and t3.a = 1"
+ }
+ }
+ ]
}
}
# inequality : OR formula in WHERE
@@ -3357,13 +3781,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 2"
+ }
+ }
+ ]
}
}
}
@@ -3379,13 +3807,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 2"
+ }
+ }
+ ]
}
}
}
@@ -3472,13 +3904,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a < 4 and t1.a > 0"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a < 4 and t1.a > 0"
+ }
+ }
+ ]
}
}
}
@@ -3494,13 +3930,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a < 4 and t1.a > 0"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a < 4 and t1.a > 0"
+ }
+ }
+ ]
}
}
}
@@ -3537,13 +3977,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1 and 1",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -3554,13 +3998,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
}
}
# OR formula : inequality in WHERE
@@ -3599,13 +4047,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and (t1.a < 4 or t1.a > 0)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and (t1.a < 4 or t1.a > 0)"
+ }
+ }
+ ]
}
}
}
@@ -3621,13 +4073,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and (t1.a < 4 or t1.a > 0)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and (t1.a < 4 or t1.a > 0)"
+ }
+ }
+ ]
}
}
}
@@ -3664,13 +4120,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -3681,13 +4141,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1"
+ }
+ }
+ ]
}
}
# AND formula : AND formula in WHERE
@@ -3727,13 +4191,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.c < 3 and t1.a < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.c < 3 and t1.a < 4"
+ }
+ }
+ ]
}
}
}
@@ -3752,13 +4220,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.c < 3 and t1.a < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.c < 3 and t1.a < 4"
+ }
+ }
+ ]
}
}
}
@@ -3795,13 +4267,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.c",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c < 3 and t1.c > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c < 3 and t1.c > 1"
+ }
+ }
+ ]
}
}
}
@@ -3818,13 +4294,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.c",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c < 3 and t1.c > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c < 3 and t1.c > 1"
+ }
+ }
+ ]
}
}
}
@@ -3860,13 +4340,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1 and 1",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -3878,13 +4362,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 3"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 3"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for SELECT t3.a,t3.b,MAX(t3.c),t3.d
@@ -3918,13 +4406,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "t3.d > 0",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t3.a,t3.b,MAX(t3.c),t3.d
@@ -3938,13 +4430,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"having_condition": "t3.d > 0",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for SELECT t3.a,t3.b,MAX(t3.c),t3.d
@@ -3978,13 +4474,17 @@ EXPLAIN
"query_block": {
"select_id": 1,
"const_condition": "1",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t3.a,t3.b,MAX(t3.c),t3.d
@@ -3996,13 +4496,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.a = 1 and t3.d = 1 and t3.b = 2"
+ }
+ }
+ ]
}
}
# AND formula : OR formula in WHERE
@@ -4042,13 +4546,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4"
+ }
+ }
+ ]
}
}
}
@@ -4067,13 +4575,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4"
+ }
+ }
+ ]
}
}
}
@@ -4115,13 +4627,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.c",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4 and t1.c > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4 and t1.c > 1"
+ }
+ }
+ ]
}
}
}
@@ -4138,13 +4654,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.c",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4 and t1.c > 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a > 1 or t1.c < 3) and t1.a < 4 and t1.c > 1"
+ }
+ }
+ ]
}
}
}
@@ -4186,13 +4706,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.c",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.a = 3) and (t1.a = 4 or t1.c > 1)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.a = 3) and (t1.a = 4 or t1.c > 1)"
+ }
+ }
+ ]
}
}
}
@@ -4209,13 +4733,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.c",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a = 1 or t1.a = 3) and (t1.a = 4 or t1.c > 1)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 1 or t1.a = 3) and (t1.a = 4 or t1.c > 1)"
+ }
+ }
+ ]
}
}
}
@@ -4251,13 +4779,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -4268,13 +4800,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
# OR formula : pushdown through equality
@@ -4308,13 +4844,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='condition_pushdown_from_having=off' for explain format=json SELECT t1.a,MAX(t1.b),t1.c
@@ -4326,13 +4866,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.c = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.c = 1"
+ }
+ }
+ ]
}
}
# OR formula : pushdown through equality, impossible WHERE
@@ -4510,13 +5054,17 @@ EXPLAIN
"filesort": {
"sort_key": "t3.a",
"temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.a = 1 or t3.a > 1)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.a = 1 or t3.a > 1)"
+ }
+ }
+ ]
}
}
}
@@ -4533,13 +5081,17 @@ EXPLAIN
"filesort": {
"sort_key": "t3.a",
"temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.a = 1 or t3.a > 1)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.a = 1 or t3.a > 1)"
+ }
+ }
+ ]
}
}
}
@@ -4576,13 +5128,17 @@ EXPLAIN
"filesort": {
"sort_key": "t3.a",
"temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.c = t3.a and t3.c < 15 or t3.a > 1)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.c = t3.a and t3.c < 15 or t3.a > 1)"
+ }
+ }
+ ]
}
}
}
@@ -4599,13 +5155,17 @@ EXPLAIN
"filesort": {
"sort_key": "t3.a",
"temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.c = t3.a and t3.a < 15 or t3.a > 1)"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t3.d = t3.a and t3.a > 1 and (t3.c = 3 or t3.c < 2) and (t3.c = t3.a and t3.a < 15 or t3.a > 1)"
+ }
+ }
+ ]
}
}
}
@@ -4683,13 +5243,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.d1",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t1.d1 between <cache>(inet_aton('1978-04-27')) and <cache>('2018-08-26')"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t1.d1 between <cache>(inet_aton('1978-04-27')) and <cache>('2018-08-26')"
+ }
+ }
+ ]
}
}
}
@@ -4721,13 +5285,17 @@ EXPLAIN
"filesort": {
"sort_key": "t1.d1",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "t1.d1 not between <cache>(0) and <cache>(exp(0))"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "t1.d1 not between <cache>(0) and <cache>(exp(0))"
+ }
+ }
+ ]
}
}
}
@@ -4792,23 +5360,31 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a = 8 or t1.a = (subquery#2)"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8 or t1.a = (subquery#2)"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -4828,23 +5404,31 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a, t1.b",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "(t1.a = 8 or t1.a = (subquery#2)) and t1.b < 20"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "(t1.a = 8 or t1.a = (subquery#2)) and t1.b < 20"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -4865,23 +5449,31 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a = 8 or t1.a = (subquery#2)"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a = 8 or t1.a = (subquery#2)"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -4898,23 +5490,31 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100,
- "attached_condition": "t1.a = (subquery#2)"
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100,
+ "attached_condition": "t1.a = (subquery#2)"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result
index eef320d2d04..f114fc6824e 100644
--- a/mysql-test/main/in_subq_cond_pushdown.result
+++ b/mysql-test/main/in_subq_cond_pushdown.result
@@ -51,40 +51,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c < 25 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` < 25",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c < 25 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` < 25",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted AND formula : pushing into HAVING
@@ -140,40 +150,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c > 55 and t1.b < 4 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` > 55 and t2.f < 4",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c > 55 and t1.b < 4 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` > 55 and t2.f < 4",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted OR formula : pushing into HAVING
@@ -231,40 +251,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.c > 60 or t1.c < 25) and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` > 60 or `MAX(t2.g)` < 25",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.c > 60 or t1.c < 25) and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` > 60 or `MAX(t2.g)` < 25",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted AND-OR formula : pushing into HAVING
@@ -320,40 +350,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.c > 60 or t1.c < 25) and t1.b > 2 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "(`MAX(t2.g)` > 60 or `MAX(t2.g)` < 25) and t2.f > 2",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.c > 60 or t1.c < 25) and t1.b > 2 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "(`MAX(t2.g)` > 60 or `MAX(t2.g)` < 25) and t2.f > 2",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into HAVING
@@ -411,40 +451,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.a < 2 or t1.d > 3) and t1.b > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "t2.f > 1",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.a < 2 or t1.d > 3) and t1.b > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "t2.f > 1",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# using view IN subquery defINition : pushing into HAVING
@@ -500,40 +550,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c > 20 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["v1_x", "MAX(v1_y)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(v1_y)` > 20",
- "temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t3.x > 1 and t3.x <= 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c > 20 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["v1_x", "MAX(v1_y)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(v1_y)` > 20",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t3.x > 1 and t3.x <= 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# using equality : pushing into WHERE
@@ -590,52 +650,64 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t3.y > 20 and t3.x <= 3 and t3.y is not null"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t3.y > 20 and t3.x <= 3 and t3.y is not null"
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "attached_condition": "t1.c = t3.y and t1.a is not null"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "attached_condition": "t1.c = t3.y and t1.a is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t3.y"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` > 20",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t3.y"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` > 20",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -693,39 +765,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a < 2 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a < 2 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e < 2"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted AND formula : pushing into WHERE
@@ -783,39 +865,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 2 and t1.a < 5 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e > 2 and t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 2 and t1.a < 5 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e > 2 and t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted OR formula : pushing into WHERE
@@ -875,39 +967,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.a < 2 or t1.a >= 4) and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and (t2.e < 2 or t2.e >= 4)"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.a < 2 or t1.a >= 4) and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and (t2.e < 2 or t2.e >= 4)"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted AND-OR formula : pushing into WHERE
@@ -963,39 +1065,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.a < 2 or t1.a = 5) and t1.b > 3 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and (t2.e < 2 or t2.e = 5) and t2.f > 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.a < 2 or t1.a = 5) and t1.b > 3 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and (t2.e < 2 or t2.e = 5) and t2.f > 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# extracted AND-OR formula : pushing into WHERE
@@ -1051,39 +1163,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.a < 2 or t1.a = 5) and t1.b > 3 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and (t2.e < 2 or t2.e = 5) and t2.f > 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.a < 2 or t1.a = 5) and t1.b > 3 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and (t2.e < 2 or t2.e = 5) and t2.f > 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -1139,39 +1261,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.b < 3 or t1.d > 2) and t1.a < 2 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e < 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.b < 3 or t1.d > 2) and t1.a < 2 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e < 2"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# using equalities : pushing into WHERE
@@ -1227,37 +1359,47 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a = 1 and t1.d = 1 and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["const", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e = 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a = 1 and t1.d = 1 and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["const", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e = 1"
+ }
+ }
+ ]
+ }
}
}
}
- }
+ ]
}
}
# using equality : pushing into WHERE
@@ -1313,39 +1455,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.d = t1.a and t1.a > 1 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.d = t1.a and t1.a > 1 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# using view IN subquery definition : pushing into WHERE
@@ -1399,39 +1551,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a < 3 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["v1_x", "MAX(v1_y)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t3.x > 1 and t3.x <= 3 and t3.x < 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a < 3 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["v1_x", "MAX(v1_y)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t3.x > 1 and t3.x <= 3 and t3.x < 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# using equality : pushing into WHERE
@@ -1490,51 +1652,63 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t3.x < 2 and t3.y > 30 and t3.x <= 3 and t3.x is not null"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t3.x < 2 and t3.y > 30 and t3.x <= 3 and t3.x is not null"
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "119",
+ "join_type": "BNL",
+ "attached_condition": "t1.a = t3.x and t1.c is not null"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "119",
- "join_type": "BNL",
- "attached_condition": "t1.a = t3.x and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t3.x", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e <= 3"
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t3.x", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e <= 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -1591,40 +1765,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "(t1.b < 3 or t1.b = 4) and t1.a < 3 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "t2.f < 3 or t2.f = 4",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e < 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "(t1.b < 3 or t1.b = 4) and t1.a < 3 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "t2.f < 3 or t2.f = 4",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e < 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using addition : pushing into HAVING
@@ -1680,40 +1864,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a + t1.c > 41 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "t2.e + `MAX(t2.g)` > 41",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a + t1.c > 41 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "t2.e + `MAX(t2.g)` > 41",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using substitution : pushing into HAVING
@@ -1771,40 +1965,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c - t1.a < 35 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` - t2.e < 35",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c - t1.a < 35 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` - t2.e < 35",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using multiplication : pushing into HAVING
@@ -1860,40 +2064,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c * t1.a > 100 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` * t2.e > 100",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c * t1.a > 100 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` * t2.e > 100",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using division : pushing into HAVING
@@ -1953,40 +2167,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c / t1.a > 30 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` / t2.e > 30",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c / t1.a > 30 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` / t2.e > 30",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using BETWEEN : pushing into HAVING
@@ -2042,40 +2266,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c between 50 and 100 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "`MAX(t2.g)` between 50 and 100",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c between 50 and 100 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "`MAX(t2.g)` between 50 and 100",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using addition : pushing into WHERE
@@ -2131,39 +2365,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a + t1.b > 5 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e + t2.f > 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a + t1.b > 5 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e + t2.f > 5"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using substitution : pushing into WHERE
@@ -2219,39 +2463,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a - t1.b > 0 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e - t2.f > 0"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a - t1.b > 0 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e - t2.f > 0"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using multiplication : pushing into WHERE
@@ -2307,39 +2561,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a * t1.b > 6 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e * t2.f > 6"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a * t1.b > 6 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e * t2.f > 6"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using division : pushing into WHERE
@@ -2397,39 +2661,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.b / t1.a > 2 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.f / t2.e > 2"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.b / t1.a > 2 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.f / t2.e > 2"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula using BETWEEN : pushing into WHERE
@@ -2491,39 +2765,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a between 1 and 3 and t1.a is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["e", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e between 1 and 3"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a between 1 and 3 and t1.a is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["e", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e between 1 and 3"
+ }
+ }
+ ]
+ }
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into HAVING of the IN subquery
@@ -2583,58 +2867,72 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.c > 3 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "MAX(v2.f)", "max_g"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "v2.max_g > 3",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "v2.e < 5",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_g > 25",
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.c > 3 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "MAX(v2.f)", "max_g"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "v2.max_g > 3",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v2.e < 5",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_g > 25",
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE of the IN subquery
@@ -2693,57 +2991,71 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "MAX(v2.f)", "max_g"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "v2.e < 5 and v2.e > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_g > 25",
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "MAX(v2.f)", "max_g"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v2.e < 5 and v2.e > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_g > 25",
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e > 1"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE and HAVING
@@ -2803,58 +3115,72 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.c < 100 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "MAX(v2.f)", "max_g"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "having_condition": "v2.max_g < 100",
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "v2.e < 5 and v2.e > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_g > 25",
- "filesort": {
- "sort_key": "t2.e",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.e > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.c < 100 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "MAX(v2.f)", "max_g"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "v2.max_g < 100",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "v2.e < 5 and v2.e > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_g > 25",
+ "filesort": {
+ "sort_key": "t2.e",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.e > 1"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE of the IN subquery
@@ -2937,56 +3263,70 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "MAX(d_tab.f)", "max_g"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "d_tab.e < 5 and d_tab.e > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_g > 25 and t2.e < 5 and t2.e > 1",
- "filesort": {
- "sort_key": "t2.f",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "MAX(d_tab.f)", "max_g"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "d_tab.e < 5 and d_tab.e > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_g > 25 and t2.e < 5 and t2.e > 1",
+ "filesort": {
+ "sort_key": "t2.f",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into HAVING of the derived table
@@ -3088,56 +3428,70 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "MAX(d_tab.f)", "max_g"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "d_tab.e < 5 and d_tab.e > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_g > 25 and t2.e < 5 and t2.e > 1",
- "filesort": {
- "sort_key": "t2.f",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "MAX(d_tab.f)", "max_g"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "d_tab.e < 5 and d_tab.e > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_g > 25 and t2.e < 5 and t2.e > 1",
+ "filesort": {
+ "sort_key": "t2.f",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE of the derived table
@@ -3240,56 +3594,70 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "MAX(d_tab.f)", "max_g"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "temporary_table": {
- "table": {
- "table_name": "<derived3>",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "d_tab.e < 5 and d_tab.e > 1",
- "materialized": {
- "query_block": {
- "select_id": 3,
- "having_condition": "max_g > 25 and t2.e < 5 and t2.e > 1",
- "filesort": {
- "sort_key": "t2.f",
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "MAX(d_tab.f)", "max_g"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "d_tab.e < 5 and d_tab.e > 1",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "max_g > 25 and t2.e < 5 and t2.e > 1",
+ "filesort": {
+ "sort_key": "t2.f",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
}
- }
+ ]
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE and HAVING
@@ -3374,70 +3742,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t3.x < 5 and t3.x is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.x"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "d_tab.max_c < 70",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 70",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a < 5 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery3>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "having_condition": "t2.f < 5",
- "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t3.x < 5 and t3.x is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.x"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "d_tab.max_c < 70",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 70",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
"table": {
- "table_name": "t2",
+ "table_name": "t1",
"access_type": "ALL",
- "rows": 12,
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a < 5 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
"filtered": 100,
- "attached_condition": "t2.e > 1 and t2.e < 5"
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "t2.f < 5",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e > 1 and t2.e < 5"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
- }
+ ]
}
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE of the derived table
@@ -3543,70 +3927,86 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 8,
- "filtered": 100,
- "attached_condition": "t3.x < 5 and t3.x is not null"
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t3.x"],
- "rows": 2,
- "filtered": 100,
- "attached_condition": "d_tab.max_c < 70",
- "materialized": {
- "query_block": {
- "select_id": 2,
- "having_condition": "max_c < 70",
- "filesort": {
- "sort_key": "t1.a",
- "temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.a > 1 and t1.a < 5 and t1.a is not null and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery3>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["e", "f", "MAX(t2.g)"],
- "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 3,
- "having_condition": "t2.f < 5",
- "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 8,
+ "filtered": 100,
+ "attached_condition": "t3.x < 5 and t3.x is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t3.x"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "d_tab.max_c < 70",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "having_condition": "max_c < 70",
+ "filesort": {
+ "sort_key": "t1.a",
+ "temporary_table": {
+ "nested_loop": [
+ {
"table": {
- "table_name": "t2",
+ "table_name": "t1",
"access_type": "ALL",
- "rows": 12,
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.a > 1 and t1.a < 5 and t1.a is not null and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": ["e", "f", "MAX(t2.g)"],
+ "ref": ["test.t1.a", "test.t1.b", "test.t1.c"],
+ "rows": 1,
"filtered": 100,
- "attached_condition": "t2.e > 1 and t2.e < 5"
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "having_condition": "t2.f < 5",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e > 1 and t2.e < 5"
+ }
+ }
+ ]
+ }
+ }
+ }
}
}
- }
+ ]
}
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -3665,46 +4065,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.b > 1 and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "8",
- "used_key_parts": ["f", "MAX(t2.g) OVER (PARTITION BY t2.f)"],
- "ref": ["test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.f"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.f > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.b > 1 and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "8",
+ "used_key_parts": ["f", "MAX(t2.g) OVER (PARTITION BY t2.f)"],
+ "ref": ["test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.f"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.f > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
# conjunctive subformula : pushing into WHERE
@@ -3757,47 +4169,62 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 16,
- "filtered": 100,
- "attached_condition": "t1.b > 1 and t1.b is not null and t1.c is not null"
- },
- "table": {
- "table_name": "<subquery2>",
- "access_type": "eq_ref",
- "possible_keys": ["distinct_key"],
- "key": "distinct_key",
- "key_length": "12",
- "used_key_parts": ["f", "CAST(SUM(t2.g) OVER (PARTITION BY t2.f) AS INT)"],
- "ref": ["test.t1.b", "test.t1.c"],
- "rows": 1,
- "filtered": 100,
- "attached_condition": "t1.c = `<subquery2>`.`CAST(SUM(t2.g) OVER (PARTITION BY t2.f) AS INT)`",
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t2.f"
- }
- },
- "temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 12,
- "filtered": 100,
- "attached_condition": "t2.e < 5 and t2.f > 1"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 16,
+ "filtered": 100,
+ "attached_condition": "t1.b > 1 and t1.b is not null and t1.c is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "eq_ref",
+ "possible_keys": ["distinct_key"],
+ "key": "distinct_key",
+ "key_length": "12",
+ "used_key_parts": [
+ "f",
+ "CAST(SUM(t2.g) OVER (PARTITION BY t2.f) AS INT)"
+ ],
+ "ref": ["test.t1.b", "test.t1.c"],
+ "rows": 1,
+ "filtered": 100,
+ "attached_condition": "t1.c = `<subquery2>`.`CAST(SUM(t2.g) OVER (PARTITION BY t2.f) AS INT)`",
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "window_functions_computation": {
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t2.f"
+ }
+ }
+ ],
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 12,
+ "filtered": 100,
+ "attached_condition": "t2.e < 5 and t2.f > 1"
+ }
+ }
+ ]
+ }
}
}
}
}
}
- }
+ ]
}
}
DROP TABLE t1,t2,t3;
diff --git a/mysql-test/main/innodb_ext_key,off.rdiff b/mysql-test/main/innodb_ext_key,off.rdiff
index 4d6c65c9971..b334d006737 100644
--- a/mysql-test/main/innodb_ext_key,off.rdiff
+++ b/mysql-test/main/innodb_ext_key,off.rdiff
@@ -265,30 +265,30 @@
drop table t0,t1,t2;
#
# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
-@@ -755,11 +755,12 @@
- "select_id": 1,
- "table": {
- "table_name": "t1",
-- "access_type": "range",
-+ "access_type": "ref",
- "possible_keys": ["f2"],
- "key": "f2",
-- "key_length": "3070",
-- "used_key_parts": ["f2", "pk1"],
-+ "key_length": "3066",
-+ "used_key_parts": ["f2"],
-+ "ref": ["const"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
-@@ -788,8 +789,8 @@
- "access_type": "range",
- "possible_keys": ["k1"],
- "key": "k1",
-- "key_length": "3011",
-- "used_key_parts": ["pk1", "f2", "pk2"],
-+ "key_length": "3007",
-+ "used_key_parts": ["pk1", "f2"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
+@@ -768,11 +768,12 @@
+ {
+ "table": {
+ "table_name": "t1",
+- "access_type": "range",
++ "access_type": "ref",
+ "possible_keys": ["f2"],
+ "key": "f2",
+- "key_length": "3070",
+- "used_key_parts": ["f2", "pk1"],
++ "key_length": "3066",
++ "used_key_parts": ["f2"],
++ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
+@@ -805,8 +806,8 @@
+ "access_type": "range",
+ "possible_keys": ["k1"],
+ "key": "k1",
+- "key_length": "3011",
+- "used_key_parts": ["pk1", "f2", "pk2"],
++ "key_length": "3007",
++ "used_key_parts": ["pk1", "f2"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result
index 5b99fa4e30b..3025e3ec3f0 100644
--- a/mysql-test/main/innodb_ext_key.result
+++ b/mysql-test/main/innodb_ext_key.result
@@ -764,18 +764,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["f2"],
- "key": "f2",
- "key_length": "3070",
- "used_key_parts": ["f2", "pk1"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
- "attached_condition": "t1.f1 <= '3'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["f2"],
+ "key": "f2",
+ "key_length": "3070",
+ "used_key_parts": ["f2", "pk1"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
+ "attached_condition": "t1.f1 <= '3'"
+ }
+ }
+ ]
}
}
drop table t1;
@@ -794,18 +798,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["k1"],
- "key": "k1",
- "key_length": "3011",
- "used_key_parts": ["pk1", "f2", "pk2"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
- "attached_condition": "t1.f1 <= '3'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["k1"],
+ "key": "k1",
+ "key_length": "3011",
+ "used_key_parts": ["pk1", "f2", "pk2"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
+ "attached_condition": "t1.f1 <= '3'"
+ }
+ }
+ ]
}
}
drop table t1;
diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result
index 95a3c2f7db9..aa6d48553f1 100644
--- a/mysql-test/main/intersect.result
+++ b/mysql-test/main/intersect.result
@@ -51,36 +51,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -102,17 +114,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -121,17 +137,21 @@ ANALYZE
"operation": "INTERSECT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -140,17 +160,21 @@ ANALYZE
"operation": "INTERSECT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -164,85 +188,101 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3,4>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 1,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "INTERSECT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3,4>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 1,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
@@ -300,35 +340,45 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "256Kb",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
}
]
@@ -350,17 +400,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -369,91 +423,24 @@ ANALYZE
"operation": "INTERSECT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "256Kb",
- "join_type": "BNL",
- "r_filtered": 100
- }
- }
- }
- ]
- }
- }
-}
-ANALYZE format=json select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
-ANALYZE
-{
- "query_block": {
- "select_id": 1,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 1,
- "query_specifications": [
+ "nested_loop": [
{
- "query_block": {
- "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
"r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
}
},
{
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
+ "block-nl-join": {
"table": {
- "table_name": "t2",
+ "table_name": "t3",
"access_type": "ALL",
"r_loops": 1,
"rows": 3,
@@ -463,32 +450,119 @@ ANALYZE
"filtered": 100,
"r_filtered": 100
},
- "block-nl-join": {
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "256Kb",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "r_filtered": 100
}
}
]
}
}
- }
+ ]
}
}
}
+ANALYZE format=json select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 1,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
set @@optimizer_switch=@save_optimizer_switch;
select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
a b
diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result
index 7483e1df06e..243497ffc4f 100644
--- a/mysql-test/main/intersect_all.result
+++ b/mysql-test/main/intersect_all.result
@@ -63,36 +63,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 3,
"operation": "INTERSECT",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -114,17 +126,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -133,17 +149,21 @@ ANALYZE
"operation": "INTERSECT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -152,17 +172,21 @@ ANALYZE
"operation": "INTERSECT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -176,85 +200,101 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3,4>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 2,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "INTERSECT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3,4>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 2,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "INTERSECT",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a;
@@ -331,35 +371,45 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "INTERSECT",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
}
]
@@ -381,17 +431,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 6,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
},
{
@@ -400,34 +454,40 @@ ANALYZE
"operation": "INTERSECT",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 5,
- "r_rows": 5,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
]
@@ -441,83 +501,97 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 6,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3>",
- "access_type": "ALL",
- "r_loops": 1,
- "r_rows": 3,
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 6,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 5,
- "r_rows": 5,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "r_rows": 3,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
},
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
"r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "r_filtered": 100
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
}
select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a;
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index 0fbb73f56fe..36e045dc2bd 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -6195,36 +6195,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "a",
- "access_type": "range",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["a"],
- "rows": 10,
- "filtered": 100,
- "attached_condition": "a.a <= 10",
- "using_index": true
- },
- "block-nl-join": {
- "table": {
- "table_name": "b",
- "access_type": "range",
- "possible_keys": ["kp1"],
- "key": "kp1",
- "key_length": "10",
- "used_key_parts": ["kp1", "kp2"],
- "rows": 836,
- "filtered": 76.43428802,
- "index_condition": "b.kp2 <= 10",
- "attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "a.a <= 10",
+ "using_index": true
+ }
},
- "buffer_type": "flat",
- "buffer_size": "54",
- "join_type": "BNL",
- "attached_condition": "b.kp1 = a.a"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "b",
+ "access_type": "range",
+ "possible_keys": ["kp1"],
+ "key": "kp1",
+ "key_length": "10",
+ "used_key_parts": ["kp1", "kp2"],
+ "rows": 836,
+ "filtered": 76.43428802,
+ "index_condition": "b.kp2 <= 10",
+ "attached_condition": "b.kp2 <= 10 and b.col1 + 1 < 33333"
+ },
+ "buffer_type": "flat",
+ "buffer_size": "54",
+ "join_type": "BNL",
+ "attached_condition": "b.kp1 = a.a"
+ }
+ }
+ ]
}
}
drop table t1,t2,t3;
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index b0c2a9ca4d9..f7f5476ab23 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -1028,7 +1028,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"access_type": "ref",
"index": "a",
"used_range_estimates": false,
- "cause": "not available",
+ "reason": "not available",
"rows": 1,
"cost": 200.0585794,
"chosen": true
@@ -1084,7 +1084,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"access_type": "ref",
"index": "a",
"used_range_estimates": false,
- "cause": "not available",
+ "reason": "not available",
"rows": 1,
"cost": 200.0585794,
"chosen": true
@@ -4042,7 +4042,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"access_type": "ref",
"index": "a",
"used_range_estimates": false,
- "cause": "not better than ref estimates",
+ "reason": "not better than ref estimates",
"rows": 1,
"cost": 3.001757383,
"chosen": true
@@ -4098,7 +4098,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"index": "a",
"rec_per_key_stats_missing": true,
"used_range_estimates": false,
- "cause": "not better than ref estimates",
+ "reason": "not better than ref estimates",
"rows": 2,
"cost": 3.003514767,
"chosen": true
@@ -7980,17 +7980,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["start_date"],
- "key": "start_date",
- "key_length": "8",
- "used_key_parts": ["start_date", "end_date"],
- "rows": 1000,
- "filtered": 100,
- "index_condition": "t1.start_date >= '2019-02-10' and t1.end_date < '2019-04-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["start_date"],
+ "key": "start_date",
+ "key_length": "8",
+ "used_key_parts": ["start_date", "end_date"],
+ "rows": 1000,
+ "filtered": 100,
+ "index_condition": "t1.start_date >= '2019-02-10' and t1.end_date < '2019-04-01'"
+ }
+ }
+ ]
}
}
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
@@ -8214,7 +8218,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"access_type": "ref",
"index": "b",
"used_range_estimates": false,
- "cause": "not available",
+ "reason": "not available",
"rows": 1,
"cost": 20.00585794,
"chosen": true
@@ -8438,7 +8442,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"access_type": "ref",
"index": "a",
"used_range_estimates": false,
- "cause": "not available",
+ "reason": "not available",
"rows": 1,
"cost": 20.00585794,
"chosen": true
@@ -8513,7 +8517,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"access_type": "ref",
"index": "a",
"used_range_estimates": false,
- "cause": "not available",
+ "reason": "not available",
"rows": 1,
"cost": 200.0585794,
"chosen": true
@@ -9167,7 +9171,7 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
"access_type": "ref",
"index": "idx_a",
"used_range_estimates": false,
- "cause": "not available",
+ "reason": "not available",
"rows": 1.8367,
"cost": 2.000585794,
"chosen": true
diff --git a/mysql-test/main/opt_trace_ucs2.result b/mysql-test/main/opt_trace_ucs2.result
index 5de1fc5c3e9..d8ecefddd5e 100644
--- a/mysql-test/main/opt_trace_ucs2.result
+++ b/mysql-test/main/opt_trace_ucs2.result
@@ -7,17 +7,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["col1"],
- "key": "col1",
- "key_length": "21",
- "used_key_parts": ["col1"],
- "rows": 2,
- "filtered": 100,
- "index_condition": "t1.col1 >= 'a'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["col1"],
+ "key": "col1",
+ "key_length": "21",
+ "used_key_parts": ["col1"],
+ "rows": 2,
+ "filtered": 100,
+ "index_condition": "t1.col1 >= 'a'"
+ }
+ }
+ ]
}
}
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index e9f4b1d599a..81f173e764d 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -3401,30 +3401,34 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 5,
- "filesort": {
- "sort_key": "t1.a",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_limit": 5,
- "r_used_priority_queue": false,
- "r_output_rows": 100,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,packed_addon_fields",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 100,
- "r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "r_rows": 5,
+ "filesort": {
+ "sort_key": "t1.a",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_limit": 5,
+ "r_used_priority_queue": false,
+ "r_output_rows": 100,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
SELECT * FROM t1 ORDER BY a LIMIT 5;
@@ -3708,29 +3712,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 100,
- "filesort": {
- "sort_key": "t1.a, t1.b, t1.c",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 100,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,packed_addon_fields",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 100,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 100,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t1.a, t1.b, t1.c",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 100,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
select * from t1 order by a,b,c;
@@ -3867,29 +3875,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 5,
- "filesort": {
- "sort_key": "t1.b desc",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 5,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "packed_sort_key,rowid",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 5,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 5,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t1.b desc",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 5,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "packed_sort_key,rowid",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 5,
+ "r_rows": 5,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
drop table t1;
@@ -3909,29 +3921,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 6,
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 6,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "packed_sort_key,rowid",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 6,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 6,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "packed_sort_key,rowid",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
select a, b, c from t1 order by a, b;
@@ -3957,29 +3973,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 6,
- "filesort": {
- "sort_key": "t1.a, t1.b",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 6,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,packed_addon_fields",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 6,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t1.a, t1.b",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 6,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 6,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
select a, b, c from t1 order by a, b;
@@ -4019,29 +4039,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 10,
- "filesort": {
- "sort_key": "t1.a",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 10,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "packed_sort_key,packed_addon_fields",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t1.a",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "packed_sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
drop table t1;
@@ -4194,17 +4218,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 50,
- "r_rows": 50,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 50,
+ "r_rows": 50,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -4223,18 +4251,22 @@ ANALYZE
"r_buffer_size": "REPLACED" across executions)",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 50,
- "rows": 50,
- "r_rows": 50,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 2,
- "attached_condition": "t1.b = t2.b"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 50,
+ "rows": 50,
+ "r_rows": 50,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 2,
+ "attached_condition": "t1.b = t2.b"
+ }
+ }
+ ]
}
}
}
@@ -4324,43 +4356,53 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a desc",
- "table": {
- "table_name": "<subquery2>",
- "access_type": "ALL",
- "possible_keys": ["distinct_key"],
- "rows": 3,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t2.b = 3 and t2.a is not null"
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc",
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "ALL",
+ "possible_keys": ["distinct_key"],
+ "rows": 3,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t2.b = 3 and t2.a is not null"
+ }
+ }
+ ]
+ }
}
}
}
}
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 1,
+ "filtered": 100,
+ "using_index": true
+ }
}
- },
- "table": {
- "table_name": "t1",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 1,
- "filtered": 100,
- "using_index": true
- }
+ ]
}
}
SELECT t1.a
@@ -4387,42 +4429,52 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "read_sorted_file": {
- "filesort": {
- "sort_key": "t1.a desc",
- "table": {
- "table_name": "<subquery2>",
- "access_type": "ALL",
- "possible_keys": ["distinct_key"],
- "rows": 3,
- "filtered": 100,
- "materialized": {
- "unique": 1,
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100,
- "attached_condition": "t2.b = 3 and t2.a is not null"
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t1.a desc",
+ "table": {
+ "table_name": "<subquery2>",
+ "access_type": "ALL",
+ "possible_keys": ["distinct_key"],
+ "rows": 3,
+ "filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "t2.b = 3 and t2.a is not null"
+ }
+ }
+ ]
+ }
}
}
}
}
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.a"],
+ "rows": 1,
+ "filtered": 100
+ }
}
- },
- "table": {
- "table_name": "t1",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["a"],
- "ref": ["test.t2.a"],
- "rows": 1,
- "filtered": 100
- }
+ ]
}
}
SELECT t1.a, group_concat(t1.b)
diff --git a/mysql-test/main/order_by_pack_big.result b/mysql-test/main/order_by_pack_big.result
index a7cf2436bcc..e34b1a4a90a 100644
--- a/mysql-test/main/order_by_pack_big.result
+++ b/mysql-test/main/order_by_pack_big.result
@@ -93,29 +93,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 10000,
- "filesort": {
- "sort_key": "t3.`id` DIV 100",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 10000,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,packed_addon_fields",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10000,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 10000,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t3.`id` DIV 100",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10000,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10000,
+ "r_rows": 10000,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
flush status;
@@ -250,30 +254,34 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 10000,
- "filesort": {
- "sort_key": "t3.`id` DIV 100",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 10000,
- "r_sort_passes": 4,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,packed_addon_fields",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10000,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 10000,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t3.`id` DIV 100",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10000,
+ "r_sort_passes": 4,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10000,
+ "r_rows": 10000,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
flush status;
@@ -405,29 +413,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 10000,
- "filesort": {
- "sort_key": "t3.`names`, t3.address",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 10000,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "packed_sort_key,packed_addon_fields",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10000,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 10000,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t3.`names`, t3.address",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10000,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "packed_sort_key,packed_addon_fields",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10000,
+ "r_rows": 10000,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
flush status;
@@ -454,29 +466,33 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "read_sorted_file": {
- "r_rows": 10000,
- "filesort": {
- "sort_key": "t3.`names`, t3.address",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 10000,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "packed_sort_key,rowid",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10000,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
"r_rows": 10000,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
+ "filesort": {
+ "sort_key": "t3.`names`, t3.address",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 10000,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "packed_sort_key,rowid",
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10000,
+ "r_rows": 10000,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
}
}
- }
+ ]
}
}
flush status;
diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result
index d97cfb2b587..72f6ffd4b90 100644
--- a/mysql-test/main/range.result
+++ b/mysql-test/main/range.result
@@ -2412,17 +2412,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "rows": 6,
- "filtered": 100,
- "attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "rows": 6,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))"
+ }
+ }
+ ]
}
}
select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
@@ -2472,17 +2476,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))"
+ }
+ }
+ ]
}
}
select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
@@ -2498,17 +2506,21 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 5,
- "filtered": 100,
- "attached_condition": "(t1.a,t1.b) in ((4,t1.a - 1),(8,t1.a + 8),(7,t1.a + 7))"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "(t1.a,t1.b) in ((4,t1.a - 1),(8,t1.a + 8),(7,t1.a + 7))"
+ }
+ }
+ ]
}
}
select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
@@ -2538,37 +2550,43 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
- "key_length": "5",
- "used_key_parts": ["d"],
- "rowid_filter": {
- "range": {
- "key": "idx2",
- "used_key_parts": ["e"]
- },
- "rows": 12,
- "selectivity_pct": 60
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rowid_filter": {
+ "range": {
+ "key": "idx2",
+ "used_key_parts": ["e"]
+ },
+ "rows": 12,
+ "selectivity_pct": 60
+ },
+ "rows": 3,
+ "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)))"
+ }
},
- "rows": 3,
- "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)))"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 8,
- "filtered": 100
- }
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2618,37 +2636,43 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
- "key_length": "5",
- "used_key_parts": ["d"],
- "rowid_filter": {
- "range": {
- "key": "idx2",
- "used_key_parts": ["e"]
- },
- "rows": 15,
- "selectivity_pct": 14.42307692
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rowid_filter": {
+ "range": {
+ "key": "idx2",
+ "used_key_parts": ["e"]
+ },
+ "rows": 15,
+ "selectivity_pct": 14.42307692
+ },
+ "rows": 8,
+ "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"
+ }
},
- "rows": 8,
- "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"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 8,
- "filtered": 100
- }
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2723,37 +2747,43 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
- "key_length": "5",
- "used_key_parts": ["d"],
- "rowid_filter": {
- "range": {
- "key": "idx2",
- "used_key_parts": ["e"]
- },
- "rows": 7,
- "selectivity_pct": 6.730769231
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rowid_filter": {
+ "range": {
+ "key": "idx2",
+ "used_key_parts": ["e"]
+ },
+ "rows": 7,
+ "selectivity_pct": 6.730769231
+ },
+ "rows": 7,
+ "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"
+ }
},
- "rows": 7,
- "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"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 11,
- "filtered": 100
- }
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2781,29 +2811,35 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "10",
- "used_key_parts": ["d", "e"],
- "rows": 5,
- "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"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 11,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "10",
+ "used_key_parts": ["d", "e"],
+ "rows": 5,
+ "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"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2830,29 +2866,35 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 15,
- "filtered": 100,
- "index_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 15,
+ "filtered": 100,
+ "index_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2887,26 +2929,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 144,
- "filtered": 100,
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 144,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2935,30 +2983,36 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 12,
- "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"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "octet_length(t2.f) = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 12,
+ "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"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "octet_length(t2.f) = 1"
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -3012,41 +3066,49 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "const",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["id"],
- "ref": ["const"],
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 12,
- "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"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "octet_length(t2.f) = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 12,
+ "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"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "octet_length(t2.f) = 1"
+ }
+ }
+ ]
}
}
select * from t1,t2,t3
diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result
index 9fa7bd29851..39d1d8c66af 100644
--- a/mysql-test/main/range_mrr_icp.result
+++ b/mysql-test/main/range_mrr_icp.result
@@ -2415,18 +2415,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "10",
- "used_key_parts": ["a", "b"],
- "rows": 6,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "10",
+ "used_key_parts": ["a", "b"],
+ "rows": 6,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
@@ -2476,18 +2480,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 5,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
@@ -2503,18 +2511,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 5,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 5,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
@@ -2544,30 +2556,36 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
- "key_length": "5",
- "used_key_parts": ["d"],
- "rows": 3,
- "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)))",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 8,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rows": 3,
+ "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)))",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2617,30 +2635,36 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
- "key_length": "5",
- "used_key_parts": ["d"],
- "rows": 8,
- "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",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 8,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rows": 8,
+ "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",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 8,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2715,30 +2739,36 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx1", "idx2"],
- "key": "idx1",
- "key_length": "5",
- "used_key_parts": ["d"],
- "rows": 7,
- "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",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 11,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx1", "idx2"],
+ "key": "idx1",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "rows": 7,
+ "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",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2766,30 +2796,36 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "10",
- "used_key_parts": ["d", "e"],
- "rows": 5,
- "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",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "ref": ["test.t2.d"],
- "rows": 11,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "10",
+ "used_key_parts": ["d", "e"],
+ "rows": 5,
+ "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",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "ref": ["test.t2.d"],
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2816,30 +2852,36 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 15,
- "filtered": 100,
- "index_condition": "t1.a is not null",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 15,
+ "filtered": 100,
+ "index_condition": "t1.a is not null",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2874,26 +2916,32 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "possible_keys": ["idx"],
- "rows": 144,
- "filtered": 100,
- "attached_condition": "t1.a is not null"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "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"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["idx"],
+ "rows": 144,
+ "filtered": 100,
+ "attached_condition": "t1.a is not null"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "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"
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -2922,31 +2970,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 12,
- "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",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "octet_length(t2.f) = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 12,
+ "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",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "octet_length(t2.f) = 1"
+ }
+ }
+ ]
}
}
select * from t1,t2
@@ -3000,42 +3054,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "const",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["id"],
- "ref": ["const"],
- "rows": 1,
- "filtered": 100
- },
- "table": {
- "table_name": "t1",
- "access_type": "range",
- "possible_keys": ["idx"],
- "key": "idx",
- "key_length": "5",
- "used_key_parts": ["a"],
- "rows": 12,
- "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",
- "mrr_type": "Rowid-ordered scan"
- },
- "table": {
- "table_name": "t2",
- "access_type": "ref",
- "possible_keys": ["idx3"],
- "key": "idx3",
- "key_length": "5",
- "used_key_parts": ["d"],
- "ref": ["test.t1.a"],
- "rows": 3,
- "filtered": 100,
- "attached_condition": "octet_length(t2.f) = 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["id"],
+ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["idx"],
+ "key": "idx",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 12,
+ "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",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ },
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ref",
+ "possible_keys": ["idx3"],
+ "key": "idx3",
+ "key_length": "5",
+ "used_key_parts": ["d"],
+ "ref": ["test.t1.a"],
+ "rows": 3,
+ "filtered": 100,
+ "attached_condition": "octet_length(t2.f) = 1"
+ }
+ }
+ ]
}
}
select * from t1,t2,t3
diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result
index 376cb63944a..10662f0edfa 100644
--- a/mysql-test/main/rowid_filter.result
+++ b/mysql-test/main/rowid_filter.result
@@ -77,26 +77,30 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 702,
- "selectivity_pct": 11.69025812
- },
- "rows": 509,
- "filtered": 11.69025803,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 702,
+ "selectivity_pct": 11.69025812
+ },
+ "rows": 509,
+ "filtered": 11.69025803,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -113,35 +117,39 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 702,
- "selectivity_pct": 11.69025812,
- "r_rows": 605,
- "r_selectivity_pct": 11.76470588,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
- "r_loops": 1,
- "rows": 509,
- "r_rows": 60,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 11.69025803,
- "r_filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 702,
+ "selectivity_pct": 11.69025812,
+ "r_rows": 605,
+ "r_selectivity_pct": 11.76470588,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 1,
+ "rows": 509,
+ "r_rows": 60,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 11.69025803,
+ "r_filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -220,18 +228,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 509,
- "filtered": 11.69025803,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 509,
+ "filtered": 11.69025803,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -248,23 +260,27 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 509,
- "r_rows": 510,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 11.69025803,
- "r_filtered": 11.76470588,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 509,
+ "r_rows": 510,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 11.69025803,
+ "r_filtered": 11.76470588,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -346,42 +362,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 98,
- "filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 69,
- "selectivity_pct": 4.6
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 98,
+ "filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
+ }
},
- "rows": 1,
- "filtered": 4.599999905,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 69,
+ "selectivity_pct": 4.6
+ },
+ "rows": 1,
+ "filtered": 4.599999905,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -401,56 +423,62 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 98,
- "r_rows": 98,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 69,
- "selectivity_pct": 4.6,
- "r_rows": 71,
- "r_selectivity_pct": 10.41666667,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 98,
+ "r_rows": 98,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
+ }
},
- "r_loops": 98,
- "rows": 1,
- "r_rows": 0.112244898,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 4.599999905,
- "r_filtered": 100,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 69,
+ "selectivity_pct": 4.6,
+ "r_rows": 71,
+ "r_selectivity_pct": 10.41666667,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 98,
+ "rows": 1,
+ "r_rows": 0.112244898,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 4.599999905,
+ "r_filtered": 100,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -484,34 +512,40 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 98,
- "filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 4.599999905,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 98,
+ "filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 4.599999905,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -531,44 +565,50 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 98,
- "r_rows": 98,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 98,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 4.599999905,
- "r_filtered": 11.2244898,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 98,
+ "r_rows": 98,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 98,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 4.599999905,
+ "r_filtered": 11.2244898,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -604,52 +644,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 702,
- "selectivity_pct": 11.69025812
- },
- "rows": 509,
- "filtered": 11.69025803,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 139,
- "selectivity_pct": 9.266666667
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 702,
+ "selectivity_pct": 11.69025812
+ },
+ "rows": 509,
+ "filtered": 11.69025803,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
},
- "rows": 1,
- "filtered": 9.266666412,
- "attached_condition": "orders.o_totalprice between 180000 and 230000"
- }
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 139,
+ "selectivity_pct": 9.266666667
+ },
+ "rows": 1,
+ "filtered": 9.266666412,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -671,70 +717,76 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 702,
- "selectivity_pct": 11.69025812,
- "r_rows": 605,
- "r_selectivity_pct": 11.76470588,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
- "r_loops": 1,
- "rows": 509,
- "r_rows": 60,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 11.69025803,
- "r_filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 139,
- "selectivity_pct": 9.266666667,
- "r_rows": 144,
- "r_selectivity_pct": 25.42372881,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 702,
+ "selectivity_pct": 11.69025812,
+ "r_rows": 605,
+ "r_selectivity_pct": 11.76470588,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 1,
+ "rows": 509,
+ "r_rows": 60,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 11.69025803,
+ "r_filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
},
- "r_loops": 60,
- "rows": 1,
- "r_rows": 0.266666667,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 9.266666412,
- "r_filtered": 100,
- "attached_condition": "orders.o_totalprice between 180000 and 230000"
- }
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_o_totalprice",
+ "used_key_parts": ["o_totalprice"]
+ },
+ "rows": 139,
+ "selectivity_pct": 9.266666667,
+ "r_rows": 144,
+ "r_selectivity_pct": 25.42372881,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 60,
+ "rows": 1,
+ "r_rows": 0.266666667,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 9.266666412,
+ "r_filtered": 100,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -776,36 +828,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 509,
- "filtered": 11.69025803,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 9.266666412,
- "attached_condition": "orders.o_totalprice between 180000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 509,
+ "filtered": 11.69025803,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 9.266666412,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -827,46 +885,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 509,
- "r_rows": 510,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 11.69025803,
- "r_filtered": 11.76470588,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 60,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 9.266666412,
- "r_filtered": 26.66666667,
- "attached_condition": "orders.o_totalprice between 180000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 509,
+ "r_rows": 510,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 11.69025803,
+ "r_filtered": 11.76470588,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 60,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 9.266666412,
+ "r_filtered": 26.66666667,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -906,42 +970,48 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "rows": 69,
- "filtered": 100,
- "index_condition": "orders.o_totalprice between 200000 and 230000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_l_shipdate",
- "used_key_parts": ["l_shipDATE"]
- },
- "rows": 509,
- "selectivity_pct": 8.476269775
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "rows": 69,
+ "filtered": 100,
+ "index_condition": "orders.o_totalprice between 200000 and 230000"
+ }
},
- "rows": 4,
- "filtered": 8.476269722,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_shipdate",
+ "used_key_parts": ["l_shipDATE"]
+ },
+ "rows": 509,
+ "selectivity_pct": 8.476269775
+ },
+ "rows": 4,
+ "filtered": 8.476269722,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -961,56 +1031,62 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "r_loops": 1,
- "rows": 69,
- "r_rows": 71,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "index_condition": "orders.o_totalprice between 200000 and 230000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_l_shipdate",
- "used_key_parts": ["l_shipDATE"]
- },
- "rows": 509,
- "selectivity_pct": 8.476269775,
- "r_rows": 510,
- "r_selectivity_pct": 7.773109244,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "r_loops": 1,
+ "rows": 69,
+ "r_rows": 71,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "index_condition": "orders.o_totalprice between 200000 and 230000"
+ }
},
- "r_loops": 71,
- "rows": 4,
- "r_rows": 0.521126761,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 8.476269722,
- "r_filtered": 100,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_shipdate",
+ "used_key_parts": ["l_shipDATE"]
+ },
+ "rows": 509,
+ "selectivity_pct": 8.476269775,
+ "r_rows": 510,
+ "r_selectivity_pct": 7.773109244,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 71,
+ "rows": 4,
+ "r_rows": 0.521126761,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 8.476269722,
+ "r_filtered": 100,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -1070,34 +1146,40 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "rows": 69,
- "filtered": 100,
- "index_condition": "orders.o_totalprice between 200000 and 230000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 8.476269722,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "rows": 69,
+ "filtered": 100,
+ "index_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 8.476269722,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -1117,44 +1199,50 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "r_loops": 1,
- "rows": 69,
- "r_rows": 71,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "index_condition": "orders.o_totalprice between 200000 and 230000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 71,
- "rows": 4,
- "r_rows": 6.704225352,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 8.476269722,
- "r_filtered": 7.773109244,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "r_loops": 1,
+ "rows": 69,
+ "r_rows": 71,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "index_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 71,
+ "rows": 4,
+ "r_rows": 6.704225352,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 8.476269722,
+ "r_filtered": 7.773109244,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -1225,36 +1313,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "rows": 18,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 7.466666698,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "rows": 18,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 7.466666698,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1278,46 +1372,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "r_loops": 1,
- "rows": 18,
- "r_rows": 18,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 0.566194832,
- "r_filtered": 38.88888889,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 7,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 7.466666698,
- "r_filtered": 14.28571429,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "r_loops": 1,
+ "rows": 18,
+ "r_rows": 18,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 0.566194832,
+ "r_filtered": 38.88888889,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 7,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 7.466666698,
+ "r_filtered": 14.28571429,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1347,36 +1447,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "rows": 18,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 7.466666698,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "rows": 18,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 7.466666698,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1400,46 +1506,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "r_loops": 1,
- "rows": 18,
- "r_rows": 18,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 0.566194832,
- "r_filtered": 38.88888889,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 7,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 7.466666698,
- "r_filtered": 14.28571429,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "r_loops": 1,
+ "rows": 18,
+ "r_rows": 18,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 0.566194832,
+ "r_filtered": 38.88888889,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 7,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 7.466666698,
+ "r_filtered": 14.28571429,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1476,35 +1588,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 39,
- "filtered": 3.200000048,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 3.047460556,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 39,
+ "filtered": 3.200000048,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 3.047460556,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1528,45 +1646,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 39,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.200000048,
- "r_filtered": 2.43902439,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.047460556,
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 39,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.200000048,
+ "r_filtered": 2.43902439,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.047460556,
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1599,35 +1723,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 39,
- "filtered": 3.200000048,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 3.047460556,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 39,
+ "filtered": 3.200000048,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 3.047460556,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1651,45 +1781,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 39,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.200000048,
- "r_filtered": 2.43902439,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.047460556,
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 39,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.200000048,
+ "r_filtered": 2.43902439,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.047460556,
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1725,40 +1861,46 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 39,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": "REPLACED",
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 39,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": "REPLACED",
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1782,50 +1924,56 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 39,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 2.43902439,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 39,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 2.43902439,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1858,40 +2006,46 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 39,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": "REPLACED",
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 39,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": "REPLACED",
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1915,50 +2069,56 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 39,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 2.43902439,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_orderkey",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 39,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 2.43902439,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_orderkey",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -2093,48 +2253,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 101,
- "filtered": 100,
- "attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "b1"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk1"],
- "ref": ["test.t2.a2"],
- "rowid_filter": {
- "range": {
- "key": "b1",
- "used_key_parts": ["b1"]
- },
- "rows": 87,
- "selectivity_pct": 87
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 101,
+ "filtered": 100,
+ "attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null"
+ }
},
- "rows": 1,
- "filtered": 87,
- "attached_condition": "t1.b1 <= (subquery#2)"
- },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "b1"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk1"],
+ "ref": ["test.t2.a2"],
+ "rowid_filter": {
+ "range": {
+ "key": "b1",
+ "used_key_parts": ["b1"]
+ },
+ "rows": 87,
+ "selectivity_pct": 87
+ },
+ "rows": 1,
+ "filtered": 87,
+ "attached_condition": "t1.b1 <= (subquery#2)"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk2"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t2.pk2 <= 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t2.pk2 <= 1"
+ }
+ }
+ ]
}
}
]
diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result
index 44dd89fa722..b4385229151 100644
--- a/mysql-test/main/rowid_filter_innodb.result
+++ b/mysql-test/main/rowid_filter_innodb.result
@@ -80,26 +80,30 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 605,
- "selectivity_pct": 10.07493755
- },
- "rows": 510,
- "filtered": 10.07493782,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 605,
+ "selectivity_pct": 10.07493755
+ },
+ "rows": 510,
+ "filtered": 10.07493782,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -116,35 +120,39 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 605,
- "selectivity_pct": 10.07493755,
- "r_rows": 605,
- "r_selectivity_pct": 11.76470588,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
- "r_loops": 1,
- "rows": 510,
- "r_rows": 60,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 10.07493782,
- "r_filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 605,
+ "selectivity_pct": 10.07493755,
+ "r_rows": 605,
+ "r_selectivity_pct": 11.76470588,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 1,
+ "rows": 510,
+ "r_rows": 60,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10.07493782,
+ "r_filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -223,18 +231,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 510,
- "filtered": 10.07493782,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 510,
+ "filtered": 10.07493782,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -251,23 +263,27 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": ["i_l_shipdate", "i_l_quantity"],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 510,
- "r_rows": 510,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 10.07493782,
- "r_filtered": 11.76470588,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": ["i_l_shipdate", "i_l_quantity"],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 510,
+ "r_rows": 510,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10.07493782,
+ "r_filtered": 11.76470588,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem
@@ -349,35 +365,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 98,
- "filtered": 100,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
- "using_index": true
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 4.733333111,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 98,
+ "filtered": 100,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 4.733333111,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -397,45 +419,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 98,
- "r_rows": 98,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
- "using_index": true
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 98,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 4.733333111,
- "r_filtered": 11.2244898,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 98,
+ "r_rows": 98,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 98,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 4.733333111,
+ "r_filtered": 11.2244898,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -469,35 +497,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rows": 98,
- "filtered": 100,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
- "using_index": true
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 4.733333111,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rows": 98,
+ "filtered": 100,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 4.733333111,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -517,45 +551,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "r_loops": 1,
- "rows": 98,
- "r_rows": 98,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
- "using_index": true
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 98,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 4.733333111,
- "r_filtered": 11.2244898,
- "attached_condition": "orders.o_totalprice between 200000 and 230000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "r_loops": 1,
+ "rows": 98,
+ "r_rows": 98,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 98,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 4.733333111,
+ "r_filtered": 11.2244898,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -591,44 +631,50 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 605,
- "selectivity_pct": 10.07493755
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 605,
+ "selectivity_pct": 10.07493755
+ },
+ "rows": 510,
+ "filtered": 10.07493782,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
},
- "rows": 510,
- "filtered": 10.07493782,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 9.600000381,
- "attached_condition": "orders.o_totalprice between 180000 and 230000"
- }
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 9.600000381,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -650,58 +696,64 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "i_l_shipdate",
- "key_length": "4",
- "used_key_parts": ["l_shipDATE"],
- "rowid_filter": {
- "range": {
- "key": "i_l_quantity",
- "used_key_parts": ["l_quantity"]
- },
- "rows": 605,
- "selectivity_pct": 10.07493755,
- "r_rows": 605,
- "r_selectivity_pct": 11.76470588,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "i_l_shipdate",
+ "key_length": "4",
+ "used_key_parts": ["l_shipDATE"],
+ "rowid_filter": {
+ "range": {
+ "key": "i_l_quantity",
+ "used_key_parts": ["l_quantity"]
+ },
+ "rows": 605,
+ "selectivity_pct": 10.07493755,
+ "r_rows": 605,
+ "r_selectivity_pct": 11.76470588,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 1,
+ "rows": 510,
+ "r_rows": 60,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 10.07493782,
+ "r_filtered": 100,
+ "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
+ "attached_condition": "lineitem.l_quantity > 45"
+ }
},
- "r_loops": 1,
- "rows": 510,
- "r_rows": 60,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 10.07493782,
- "r_filtered": 100,
- "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'",
- "attached_condition": "lineitem.l_quantity > 45"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 60,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 9.600000381,
- "r_filtered": 26.66666667,
- "attached_condition": "orders.o_totalprice between 180000 and 230000"
- }
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 60,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 9.600000381,
+ "r_filtered": 26.66666667,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -743,36 +795,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "rows": 144,
- "filtered": 100,
- "attached_condition": "orders.o_totalprice between 180000 and 230000",
- "using_index": true
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 0.855656624,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "rows": 144,
+ "filtered": 100,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 0.855656624,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -794,46 +852,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "r_loops": 1,
- "rows": 144,
- "r_rows": 144,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "orders.o_totalprice between 180000 and 230000",
- "using_index": true
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity",
- "i_l_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 144,
- "rows": 4,
- "r_rows": 6.625,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 0.855656624,
- "r_filtered": 1.677148847,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "r_loops": 1,
+ "rows": 144,
+ "r_rows": 144,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "orders.o_totalprice between 180000 and 230000",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity",
+ "i_l_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 144,
+ "rows": 4,
+ "r_rows": 6.625,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 0.855656624,
+ "r_filtered": 1.677148847,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 45"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
@@ -873,35 +937,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "rows": 71,
- "filtered": 100,
- "attached_condition": "orders.o_totalprice between 200000 and 230000",
- "using_index": true
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 8.492922783,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "rows": 71,
+ "filtered": 100,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 8.492922783,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -921,45 +991,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "r_loops": 1,
- "rows": 71,
- "r_rows": 71,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "orders.o_totalprice between 200000 and 230000",
- "using_index": true
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 71,
- "rows": 4,
- "r_rows": 6.704225352,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 8.492922783,
- "r_filtered": 7.773109244,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "r_loops": 1,
+ "rows": 71,
+ "r_rows": 71,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 71,
+ "rows": 4,
+ "r_rows": 6.704225352,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 8.492922783,
+ "r_filtered": 7.773109244,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -1019,35 +1095,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "rows": 71,
- "filtered": 100,
- "attached_condition": "orders.o_totalprice between 200000 and 230000",
- "using_index": true
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 8.492922783,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "rows": 71,
+ "filtered": 100,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 8.492922783,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -1067,45 +1149,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "i_o_totalprice",
- "key_length": "9",
- "used_key_parts": ["o_totalprice"],
- "r_loops": 1,
- "rows": 71,
- "r_rows": 71,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "orders.o_totalprice between 200000 and 230000",
- "using_index": true
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 71,
- "rows": 4,
- "r_rows": 6.704225352,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 8.492922783,
- "r_filtered": 7.773109244,
- "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "i_o_totalprice",
+ "key_length": "9",
+ "used_key_parts": ["o_totalprice"],
+ "r_loops": 1,
+ "rows": 71,
+ "r_rows": 71,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "orders.o_totalprice between 200000 and 230000",
+ "using_index": true
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 71,
+ "rows": 4,
+ "r_rows": 6.704225352,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 8.492922783,
+ "r_filtered": 7.773109244,
+ "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
@@ -1176,36 +1264,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "rows": 18,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 5.666666508,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "rows": 18,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 5.666666508,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1229,46 +1323,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "r_loops": 1,
- "rows": 18,
- "r_rows": 18,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 0.566194832,
- "r_filtered": 38.88888889,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 7,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 5.666666508,
- "r_filtered": 14.28571429,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "r_loops": 1,
+ "rows": 18,
+ "r_rows": 18,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 0.566194832,
+ "r_filtered": 38.88888889,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 7,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 5.666666508,
+ "r_filtered": 14.28571429,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1298,36 +1398,42 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "rows": 18,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rows": 1,
- "filtered": 5.666666508,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "rows": 18,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "rows": 1,
+ "filtered": 5.666666508,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1351,46 +1457,52 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "lineitem",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_receiptdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "i_l_receiptdate",
- "key_length": "4",
- "used_key_parts": ["l_receiptDATE"],
- "r_loops": 1,
- "rows": 18,
- "r_rows": 18,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 0.566194832,
- "r_filtered": 38.88888889,
- "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'"
- },
- "table": {
- "table_name": "orders",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "i_o_totalprice"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["o_orderkey"],
- "ref": ["dbt3_s001.lineitem.l_orderkey"],
- "r_loops": 7,
- "rows": 1,
- "r_rows": 1,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 5.666666508,
- "r_filtered": 14.28571429,
- "attached_condition": "orders.o_totalprice between 200000 and 250000"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_receiptdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "i_l_receiptdate",
+ "key_length": "4",
+ "used_key_parts": ["l_receiptDATE"],
+ "r_loops": 1,
+ "rows": 18,
+ "r_rows": 18,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 0.566194832,
+ "r_filtered": 38.88888889,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "i_o_totalprice"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["o_orderkey"],
+ "ref": ["dbt3_s001.lineitem.l_orderkey"],
+ "r_loops": 7,
+ "rows": 1,
+ "r_rows": 1,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 5.666666508,
+ "r_filtered": 14.28571429,
+ "attached_condition": "orders.o_totalprice between 200000 and 250000"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT l_shipdate, l_receiptdate, o_totalprice
@@ -1427,35 +1539,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 41,
- "filtered": 3.333333254,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 3.047460556,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 41,
+ "filtered": 3.333333254,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 3.047460556,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1479,45 +1597,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 41,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.333333254,
- "r_filtered": 2.43902439,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.047460556,
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 41,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.333333254,
+ "r_filtered": 2.43902439,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.047460556,
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1550,35 +1674,41 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 41,
- "filtered": 3.333333254,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": 3.047460556,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 41,
+ "filtered": 3.333333254,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": 3.047460556,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1602,45 +1732,51 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 41,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.333333254,
- "r_filtered": 2.43902439,
- "index_condition": "orders.o_totaldiscount between 18000 and 20000",
- "attached_condition": "orders.o_totalprice between 200000 and 220000"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 3.047460556,
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY", "i_o_totalprice", "i_o_totaldiscount"],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 41,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.333333254,
+ "r_filtered": 2.43902439,
+ "index_condition": "orders.o_totaldiscount between 18000 and 20000",
+ "attached_condition": "orders.o_totalprice between 200000 and 220000"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 3.047460556,
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1676,40 +1812,46 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 41,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": "REPLACED",
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 41,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": "REPLACED",
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1733,50 +1875,56 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 41,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 2.43902439,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 41,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 2.43902439,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=on' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1809,40 +1957,46 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "rows": 41,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "rows": 4,
- "filtered": "REPLACED",
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "rows": 41,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "rows": 4,
+ "filtered": "REPLACED",
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -1866,50 +2020,56 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "orders",
- "access_type": "range",
- "possible_keys": [
- "PRIMARY",
- "i_o_orderdate",
- "i_o_totalprice",
- "i_o_totaldiscount"
- ],
- "key": "i_o_totaldiscount",
- "key_length": "9",
- "used_key_parts": ["o_totaldiscount"],
- "r_loops": 1,
- "rows": 41,
- "r_rows": 41,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 2.43902439,
- "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'"
- },
- "table": {
- "table_name": "lineitem",
- "access_type": "ref",
- "possible_keys": [
- "PRIMARY",
- "i_l_shipdate",
- "i_l_orderkey",
- "i_l_orderkey_quantity"
- ],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["l_orderkey"],
- "ref": ["dbt3_s001.orders.o_orderkey"],
- "r_loops": 1,
- "rows": 4,
- "r_rows": 6,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": "REPLACED",
- "r_filtered": 66.66666667,
- "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "orders",
+ "access_type": "range",
+ "possible_keys": [
+ "PRIMARY",
+ "i_o_orderdate",
+ "i_o_totalprice",
+ "i_o_totaldiscount"
+ ],
+ "key": "i_o_totaldiscount",
+ "key_length": "9",
+ "used_key_parts": ["o_totaldiscount"],
+ "r_loops": 1,
+ "rows": 41,
+ "r_rows": 41,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 2.43902439,
+ "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'"
+ }
+ },
+ {
+ "table": {
+ "table_name": "lineitem",
+ "access_type": "ref",
+ "possible_keys": [
+ "PRIMARY",
+ "i_l_shipdate",
+ "i_l_orderkey",
+ "i_l_orderkey_quantity"
+ ],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["l_orderkey"],
+ "ref": ["dbt3_s001.orders.o_orderkey"],
+ "r_loops": 1,
+ "rows": 4,
+ "r_rows": 6,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": "REPLACED",
+ "r_filtered": 66.66666667,
+ "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'"
+ }
+ }
+ ]
}
}
set statement optimizer_switch='rowid_filter=off' for SELECT o_totaldiscount, o_totalprice, l_shipdate
@@ -2044,48 +2204,58 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 101,
- "filtered": 100,
- "attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null"
- },
- "table": {
- "table_name": "t1",
- "access_type": "eq_ref",
- "possible_keys": ["PRIMARY", "b1"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk1"],
- "ref": ["test.t2.a2"],
- "rowid_filter": {
- "range": {
- "key": "b1",
- "used_key_parts": ["b1"]
- },
- "rows": 87,
- "selectivity_pct": 87
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 101,
+ "filtered": 100,
+ "attached_condition": "t2.a2 <> t2.pk2 and t2.a2 is not null"
+ }
},
- "rows": 1,
- "filtered": 87,
- "attached_condition": "t1.b1 <= (subquery#2)"
- },
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "eq_ref",
+ "possible_keys": ["PRIMARY", "b1"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk1"],
+ "ref": ["test.t2.a2"],
+ "rowid_filter": {
+ "range": {
+ "key": "b1",
+ "used_key_parts": ["b1"]
+ },
+ "rows": 87,
+ "selectivity_pct": 87
+ },
+ "rows": 1,
+ "filtered": 87,
+ "attached_condition": "t1.b1 <= (subquery#2)"
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "range",
- "possible_keys": ["PRIMARY"],
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk2"],
- "rows": 1,
- "filtered": 100,
- "index_condition": "t2.pk2 <= 1"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "range",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk2"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t2.pk2 <= 1"
+ }
+ }
+ ]
}
}
]
@@ -2200,54 +2370,62 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["f1", "f2"],
- "key": "f1",
- "key_length": "13",
- "used_key_parts": ["f1"],
- "ref": ["const"],
- "rowid_filter": {
- "range": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["f1", "f2"],
"key": "f1",
- "used_key_parts": ["f1"]
- },
- "rows": 1,
- "selectivity_pct": 1.587301587
- },
- "rows": 1,
- "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')"
- }
+ "key_length": "13",
+ "used_key_parts": ["f1"],
+ "ref": ["const"],
+ "rowid_filter": {
+ "range": {
+ "key": "f1",
+ "used_key_parts": ["f1"]
+ },
+ "rows": 1,
+ "selectivity_pct": 1.587301587
+ },
+ "rows": 1,
+ "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')"
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 2,
"operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ref",
- "possible_keys": ["f1", "f2"],
- "key": "f1",
- "key_length": "13",
- "used_key_parts": ["f1"],
- "ref": ["const"],
- "rowid_filter": {
- "range": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ref",
+ "possible_keys": ["f1", "f2"],
"key": "f1",
- "used_key_parts": ["f1"]
- },
- "rows": 1,
- "selectivity_pct": 1.587301587
- },
- "rows": 1,
- "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')"
- }
+ "key_length": "13",
+ "used_key_parts": ["f1"],
+ "ref": ["const"],
+ "rowid_filter": {
+ "range": {
+ "key": "f1",
+ "used_key_parts": ["f1"]
+ },
+ "rows": 1,
+ "selectivity_pct": 1.587301587
+ },
+ "rows": 1,
+ "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')"
+ }
+ }
+ ]
}
}
]
@@ -2878,93 +3056,105 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t",
- "access_type": "index_merge",
- "possible_keys": ["PRIMARY", "acli_rid", "acli_tp"],
- "key_length": "2,767",
- "index_merge": {
- "intersect": {
- "range": {
- "key": "acli_tp",
- "used_key_parts": ["tp"]
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t",
+ "access_type": "index_merge",
+ "possible_keys": ["PRIMARY", "acli_rid", "acli_tp"],
+ "key_length": "2,767",
+ "index_merge": {
+ "intersect": [
+ {
+ "range": {
+ "key": "acli_tp",
+ "used_key_parts": ["tp"]
+ }
+ },
+ {
+ "range": {
+ "key": "acli_rid",
+ "used_key_parts": ["rid"]
+ }
+ }
+ ]
},
- "range": {
- "key": "acli_rid",
- "used_key_parts": ["rid"]
- }
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "attached_condition": "t.tp = 121 and t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2'",
+ "using_index": true
}
},
- "r_loops": 1,
- "rows": 2,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "attached_condition": "t.tp = 121 and t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2'",
- "using_index": true
- },
- "block-nl-join": {
- "table": {
- "table_name": "a",
- "access_type": "ref",
- "possible_keys": ["PRIMARY", "acei_aclid"],
- "key": "acei_aclid",
- "key_length": "8",
- "used_key_parts": ["aclid"],
- "ref": ["test.t.id"],
- "r_loops": 1,
- "rows": 1,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "flat",
- "buffer_size": "8Kb",
- "join_type": "BKA",
- "mrr_type": "Rowid-ordered scan",
- "attached_condition": "a.atp = 1",
- "r_filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "fi",
- "access_type": "ref",
- "possible_keys": ["filt_aceid", "filt_fh"],
- "key": "filt_aceid",
- "key_length": "8",
- "used_key_parts": ["aceid"],
- "ref": ["test.a.id"],
- "rowid_filter": {
- "range": {
- "key": "filt_fh",
- "used_key_parts": ["fh"]
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "a",
+ "access_type": "ref",
+ "possible_keys": ["PRIMARY", "acei_aclid"],
+ "key": "acei_aclid",
+ "key_length": "8",
+ "used_key_parts": ["aclid"],
+ "ref": ["test.t.id"],
+ "r_loops": 1,
+ "rows": 1,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
},
- "rows": 6,
- "selectivity_pct": 17.14285714,
- "r_rows": 5,
- "r_selectivity_pct": 40,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
- "r_loops": 1,
- "rows": 1,
- "r_rows": 2,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 17.1428566,
- "r_filtered": 100
+ "buffer_type": "flat",
+ "buffer_size": "8Kb",
+ "join_type": "BKA",
+ "mrr_type": "Rowid-ordered scan",
+ "attached_condition": "a.atp = 1",
+ "r_filtered": 100
+ }
},
- "buffer_type": "incremental",
- "buffer_size": "603",
- "join_type": "BKA",
- "mrr_type": "Rowid-ordered scan",
- "attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)",
- "r_filtered": 100
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "fi",
+ "access_type": "ref",
+ "possible_keys": ["filt_aceid", "filt_fh"],
+ "key": "filt_aceid",
+ "key_length": "8",
+ "used_key_parts": ["aceid"],
+ "ref": ["test.a.id"],
+ "rowid_filter": {
+ "range": {
+ "key": "filt_fh",
+ "used_key_parts": ["fh"]
+ },
+ "rows": 6,
+ "selectivity_pct": 17.14285714,
+ "r_rows": 5,
+ "r_selectivity_pct": 40,
+ "r_buffer_size": "REPLACED",
+ "r_filling_time_ms": "REPLACED"
+ },
+ "r_loops": 1,
+ "rows": 1,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 17.1428566,
+ "r_filtered": 100
+ },
+ "buffer_type": "incremental",
+ "buffer_size": "603",
+ "join_type": "BKA",
+ "mrr_type": "Rowid-ordered scan",
+ "attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)",
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
set optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/main/set_operation.result b/mysql-test/main/set_operation.result
index 24d2c7fbdd6..c74179afe41 100644
--- a/mysql-test/main/set_operation.result
+++ b/mysql-test/main/set_operation.result
@@ -571,194 +571,246 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 8,
"operation": "UNION",
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<intersect2,3,4>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
- }
- },
- {
- "query_block": {
- "select_id": 3,
- "operation": "INTERSECT",
- "table": {
- "message": "No tables used"
- }
- }
- },
- {
- "query_block": {
- "select_id": 4,
- "operation": "INTERSECT",
- "table": {
- "table_name": "<derived5>",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "union_result": {
- "table_name": "<union5,6>",
- "access_type": "ALL",
- "query_specifications": [
- {
- "query_block": {
- "select_id": 5,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
- }
- },
- {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "union_result": {
+ "table_name": "<intersect2,3,4>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 3,
+ "operation": "INTERSECT",
+ "table": {
+ "message": "No tables used"
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 4,
+ "operation": "INTERSECT",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "<derived5>",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "materialized": {
"query_block": {
- "select_id": 6,
- "operation": "UNION",
- "table": {
- "table_name": "t1",
+ "union_result": {
+ "table_name": "<union5,6>",
"access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 5,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 6,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ ]
}
}
}
- ]
+ }
}
- }
+ ]
}
}
- }
+ ]
}
- ]
+ }
}
}
}
- }
+ ]
}
},
{
"query_block": {
"select_id": 7,
"operation": "EXCEPT",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 9,
"operation": "UNION",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 10,
"operation": "UNION",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 11,
"operation": "EXCEPT",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 12,
"operation": "UNION",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100,
- "attached_condition": "t1.a < 4"
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100,
+ "attached_condition": "t1.a < 4"
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL"
- }
+ {
+ "block-nl-join": {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL"
+ }
+ }
+ ]
}
},
{
"query_block": {
"select_id": 13,
"operation": "UNION",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ }
+ }
+ ]
}
}
]
diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result
index e12facf8b8c..132e870a860 100644
--- a/mysql-test/main/subselect_cache.result
+++ b/mysql-test/main/subselect_cache.result
@@ -48,17 +48,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -68,18 +72,22 @@ ANALYZE
"select_id": 2,
"r_loops": 4,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 4,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 18.75,
- "attached_condition": "t1.b = t2.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 18.75,
+ "attached_condition": "t1.b = t2.c"
+ }
+ }
+ ]
}
}
}
@@ -94,17 +102,21 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 10,
- "r_rows": 10,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -122,18 +134,22 @@ ANALYZE
"select_id": 3,
"r_loops": 4,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 4,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 18.75,
- "attached_condition": "t1.b = t2.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 18.75,
+ "attached_condition": "t1.b = t2.c"
+ }
+ }
+ ]
}
},
{
@@ -158,18 +174,22 @@ ANALYZE
"select_id": 2,
"r_loops": 4,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 4,
- "rows": 4,
- "r_rows": 4,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 18.75,
- "attached_condition": "t1.b = t2.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 4,
+ "rows": 4,
+ "r_rows": 4,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 18.75,
+ "attached_condition": "t1.b = t2.c"
+ }
+ }
+ ]
}
}
}
@@ -182,25 +202,33 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t1.b = t2.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t1.b = t2.c"
+ }
+ }
+ ]
}
}
}
@@ -213,12 +241,16 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"expression_cache": {
@@ -231,13 +263,17 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t1.b = t2.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t1.b = t2.c"
+ }
+ }
+ ]
}
},
{
@@ -259,13 +295,17 @@ EXPLAIN
"state": "uninitialized",
"query_block": {
"select_id": 2,
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "rows": 4,
- "filtered": 100,
- "attached_condition": "t1.b = t2.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 4,
+ "filtered": 100,
+ "attached_condition": "t1.b = t2.c"
+ }
+ }
+ ]
}
}
}
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index 1abdde5ff7f..d4aad3e1d32 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -7404,34 +7404,46 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 2,
"pseudo_bits_condition": "1 = t1.a or <in_optimizer>(1,<exists>(subquery#3))",
- "table": {
- "table_name": "t2",
- "access_type": "system",
- "rows": 1,
- "filtered": 100
- },
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "system",
+ "rows": 1,
+ "filtered": 100
+ }
+ }
+ ],
"subqueries": [
{
"query_block": {
"select_id": 3,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100,
- "attached_condition": "1 = t3.c"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "1 = t3.c"
+ }
+ }
+ ]
}
}
]
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 095936f8b82..b1e04fadb3a 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -1403,18 +1403,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t0.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t0.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1434,18 +1440,24 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "sum(t1.b)"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1463,18 +1475,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "sum(t1.b)"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1497,18 +1515,24 @@ EXPLAIN
"filesort": {
"sort_key": "t1.b",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.b"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.b"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1642,18 +1666,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.c, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1668,18 +1698,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1694,18 +1730,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.c, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1720,18 +1762,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.c, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1776,18 +1824,24 @@ EXPLAIN
"filesort": {
"sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.s1, t1.s2"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.s1, t1.s2"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1929,18 +1983,24 @@ EXPLAIN
"select_id": 1,
"duplicate_removal": {
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.part_id, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.part_id, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -2102,18 +2162,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.a, t1.pk"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.a, t1.pk"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -2163,18 +2229,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.a, t1.b"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.a, t1.b"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -3755,29 +3827,35 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "`row_number() OVER()`",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 3,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,rowid"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "`row_number() OVER()`",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 3,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,rowid"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
}
diff --git a/mysql-test/main/win_empty_over.result b/mysql-test/main/win_empty_over.result
index a5ee74b943a..4fa53bb4eae 100644
--- a/mysql-test/main/win_empty_over.result
+++ b/mysql-test/main/win_empty_over.result
@@ -37,22 +37,28 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "pk"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "pk"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "index",
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "rows": 11,
- "filtered": 100,
- "using_index": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "index",
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "rows": 11,
+ "filtered": 100,
+ "using_index": true
+ }
+ }
+ ]
}
}
}
@@ -63,22 +69,28 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "`row_number() over ()`"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "`row_number() over ()`"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "index",
- "key": "PRIMARY",
- "key_length": "4",
- "used_key_parts": ["pk"],
- "rows": 11,
- "filtered": 100,
- "using_index": true
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "index",
+ "key": "PRIMARY",
+ "key_length": "4",
+ "used_key_parts": ["pk"],
+ "rows": 11,
+ "filtered": 100,
+ "using_index": true
+ }
+ }
+ ]
}
}
}
diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
index 4cf31200ee2..75369d5da72 100644
--- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result
+++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
@@ -1409,18 +1409,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t0.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t0.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t0",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1440,18 +1446,24 @@ EXPLAIN
"filesort": {
"sort_key": "t1.a",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "sum(t1.b)"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1469,18 +1481,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "sum(t1.b)"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1503,18 +1521,24 @@ EXPLAIN
"filesort": {
"sort_key": "t1.b",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.b"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.b"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 10,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1648,18 +1672,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.c, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1674,18 +1704,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1700,18 +1736,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.c, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1726,18 +1768,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.c, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 3,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1782,18 +1830,24 @@ EXPLAIN
"filesort": {
"sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.s1, t1.s2"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.s1, t1.s2"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -1935,18 +1989,24 @@ EXPLAIN
"select_id": 1,
"duplicate_removal": {
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.part_id, t1.a"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.part_id, t1.a"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 9,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -2108,18 +2168,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.a, t1.pk"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.a, t1.pk"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 11,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -2169,18 +2235,24 @@ EXPLAIN
"query_block": {
"select_id": 1,
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "t1.a, t1.b"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "t1.a, t1.b"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "rows": 6,
- "filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ ]
}
}
}
@@ -3761,29 +3833,35 @@ ANALYZE
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"window_functions_computation": {
- "sorts": {
- "filesort": {
- "sort_key": "`row_number() OVER()`",
- "r_loops": 1,
- "r_total_time_ms": "REPLACED",
- "r_used_priority_queue": false,
- "r_output_rows": 3,
- "r_buffer_size": "REPLACED",
- "r_sort_mode": "sort_key,rowid"
+ "sorts": [
+ {
+ "filesort": {
+ "sort_key": "`row_number() OVER()`",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 3,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,rowid"
+ }
}
- },
+ ],
"temporary_table": {
- "table": {
- "table_name": "t1",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 3,
- "r_rows": 3,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
}
}
}
diff --git a/mysql-test/suite/federated/federatedx_create_handlers.result b/mysql-test/suite/federated/federatedx_create_handlers.result
index 28736515327..6dcd53e77c7 100644
--- a/mysql-test/suite/federated/federatedx_create_handlers.result
+++ b/mysql-test/suite/federated/federatedx_create_handlers.result
@@ -157,31 +157,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "rows": 7,
- "filtered": 100
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "18",
- "used_key_parts": ["name"],
- "ref": ["federated.t3.name"],
- "rows": 2,
- "filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "message": "Pushed derived"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "rows": 7,
+ "filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "18",
+ "used_key_parts": ["name"],
+ "ref": ["federated.t3.name"],
+ "rows": 2,
+ "filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Pushed derived"
+ }
+ }
}
}
}
- }
+ ]
}
}
ANALYZE
@@ -221,41 +227,47 @@ ANALYZE
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
- "table": {
- "table_name": "t3",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 7,
- "r_rows": 7,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "table": {
- "table_name": "<derived2>",
- "access_type": "ref",
- "possible_keys": ["key0"],
- "key": "key0",
- "key_length": "18",
- "used_key_parts": ["name"],
- "ref": ["federated.t3.name"],
- "r_loops": 7,
- "rows": 2,
- "r_rows": 0,
- "r_table_time_ms": "REPLACED",
- "r_other_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100,
- "materialized": {
- "query_block": {
- "select_id": 2,
- "table": {
- "message": "Pushed derived"
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 7,
+ "r_rows": 7,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ },
+ {
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "18",
+ "used_key_parts": ["name"],
+ "ref": ["federated.t3.name"],
+ "r_loops": 7,
+ "rows": 2,
+ "r_rows": 0,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Pushed derived"
+ }
+ }
}
}
}
- }
+ ]
}
}
SELECT t.id, federated.t3.name
@@ -346,31 +358,37 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t5",
- "access_type": "ALL",
- "rows": 2,
- "filtered": 100
- },
- "block-nl-join": {
- "table": {
- "table_name": "<derived2>",
- "access_type": "ALL",
- "rows": 5,
- "filtered": 100
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t5",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
},
- "buffer_type": "flat",
- "buffer_size": "65",
- "join_type": "BNL",
- "materialized": {
- "query_block": {
- "select_id": 2,
+ {
+ "block-nl-join": {
"table": {
- "message": "Pushed derived"
+ "table_name": "<derived2>",
+ "access_type": "ALL",
+ "rows": 5,
+ "filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "65",
+ "join_type": "BNL",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "message": "Pushed derived"
+ }
+ }
}
}
}
- }
+ ]
}
}
drop table t5;
diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result
index 6f017c34133..444f7441e4b 100644
--- a/mysql-test/suite/json/r/json_table.result
+++ b/mysql-test/suite/json/r/json_table.result
@@ -211,13 +211,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "tt",
- "access_type": "ALL",
- "rows": 40,
- "filtered": 100,
- "table_function": "json_table"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tt",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "table_function": "json_table"
+ }
+ }
+ ]
}
}
explain select * from
diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result
index ec21f18523f..ca9ef4793a5 100644
--- a/mysql-test/suite/json/r/json_table_mysql.result
+++ b/mysql-test/suite/json/r/json_table_mysql.result
@@ -189,13 +189,17 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "tt",
- "access_type": "ALL",
- "rows": 40,
- "filtered": 100,
- "table_function": "json_table"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "tt",
+ "access_type": "ALL",
+ "rows": 40,
+ "filtered": 100,
+ "table_function": "json_table"
+ }
+ }
+ ]
}
}
select * from
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 1dd525b7345..44654dc2e3d 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -25,6 +25,8 @@
#include "opt_range.h"
#include "sql_expression_cache.h"
+#include <stack>
+
const char * STR_DELETING_ALL_ROWS= "Deleting all rows";
const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE";
const char * STR_NO_ROWS_AFTER_PRUNING= "No matching rows after partition pruning";
@@ -41,7 +43,7 @@ static void write_item(Json_writer *writer, Item *item);
static void append_item_to_str(String *out, Item *item);
Explain_query::Explain_query(THD *thd_arg, MEM_ROOT *root) :
- mem_root(root), upd_del_plan(NULL), insert_plan(NULL),
+ mem_root(root), upd_del_plan(nullptr), insert_plan(nullptr),
unions(root), selects(root), thd(thd_arg), apc_enabled(false),
operations(0)
{
@@ -1062,14 +1064,13 @@ void Explain_aggr_window_funcs::print_json_members(Json_writer *writer,
{
Explain_aggr_filesort *srt;
List_iterator<Explain_aggr_filesort> it(sorts);
- writer->add_member("sorts").start_object();
+ Json_writer_array sorts(writer, "sorts");
while ((srt= it++))
{
- writer->add_member("filesort").start_object();
+ Json_writer_object sort(writer);
+ Json_writer_object filesort(writer, "filesort");
srt->print_json_members(writer, is_analyze);
- writer->end_object(); // filesort
}
- writer->end_object(); // sorts
}
@@ -1091,17 +1092,22 @@ print_explain_json_interns(Explain_query *query,
Json_writer *writer,
bool is_analyze)
{
- Json_writer_nesting_guard guard(writer);
- for (uint i=0; i< n_join_tabs; i++)
{
- if (join_tabs[i]->start_dups_weedout)
- writer->add_member("duplicates_removal").start_object();
+ Json_writer_array loop(writer, "nested_loop");
+ for (uint i=0; i< n_join_tabs; i++)
+ {
+ if (join_tabs[i]->start_dups_weedout)
+ {
+ writer->start_object();
+ writer->add_member("duplicates_removal");
+ }
- join_tabs[i]->print_explain_json(query, writer, is_analyze);
+ join_tabs[i]->print_explain_json(query, writer, is_analyze);
- if (join_tabs[i]->end_dups_weedout)
- writer->end_object();
- }
+ if (join_tabs[i]->end_dups_weedout)
+ writer->end_object();
+ }
+ } // "nested_loop"
print_explain_json_for_children(query, writer, is_analyze);
}
@@ -1685,7 +1691,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
Json_writer *writer,
bool is_analyze)
{
- Json_writer_nesting_guard guard(writer);
+ Json_writer_object jsobj(writer);
if (pre_join_sort)
{
@@ -2081,14 +2087,15 @@ void Explain_quick_select::print_json(Json_writer *writer)
}
else
{
- writer->add_member(get_name_by_type()).start_object();
+ Json_writer_array ranges(writer, get_name_by_type());
List_iterator_fast<Explain_quick_select> it (children);
Explain_quick_select* child;
while ((child = it++))
+ {
+ Json_writer_object obj(writer);
child->print_json(writer);
-
- writer->end_object();
+ }
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 0dfe95e81b0..2830e65a49e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7922,16 +7922,14 @@ best_access_path(JOIN *join,
}
else
{
+ trace_access_idx.add("used_range_estimates", false);
if (table->opt_range_keys.is_set(key))
{
- trace_access_idx.add("used_range_estimates",false)
- .add("cause",
- "not better than ref estimates");
+ trace_access_idx.add("reason", "not better than ref estimates");
}
else
{
- trace_access_idx.add("used_range_estimates", false)
- .add("cause", "not available");
+ trace_access_idx.add("reason", "not available");
}
}
}
@@ -8169,7 +8167,7 @@ best_access_path(JOIN *join,
trace_access_idx.add("chosen", false)
.add("cause", cause ? cause : "cost");
}
- cause= NULL;
+ cause= nullptr;
} /* for each key */
records= best_records;
}
@@ -8191,7 +8189,6 @@ best_access_path(JOIN *join,
(!(s->table->map & join->outer_join) ||
join->allowed_outer_join_with_cache)) // (2)
{
- Json_writer_object trace_access_hash(thd);
double join_sel= 0.1;
/* Estimate the cost of the hash join access to the table */
double rnd_records= matching_candidates_in_table(s, found_constraint,
@@ -8217,9 +8214,10 @@ best_access_path(JOIN *join,
best_uses_jbuf= TRUE;
best_filter= 0;
best_type= JT_HASH;
+ Json_writer_object trace_access_hash(thd);
trace_access_hash.add("type", "hash");
trace_access_hash.add("index", "hj-key");
- trace_access_hash.add("cost", rnd_records);
+ trace_access_hash.add("rnd_records", rnd_records);
trace_access_hash.add("cost", best);
trace_access_hash.add("chosen", true);
}
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result
index 101e159eaf3..f9e3129c73f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result
@@ -47,18 +47,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["kp1"],
- "key": "kp1",
- "key_length": "5",
- "used_key_parts": ["kp1"],
- "rows": 1000,
- "filtered": 100,
- "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
- "attached_condition": "t3.kp2 like '%foo%'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["kp1"],
+ "key": "kp1",
+ "key_length": "5",
+ "used_key_parts": ["kp1"],
+ "rows": 1000,
+ "filtered": 100,
+ "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
+ "attached_condition": "t3.kp2 like '%foo%'"
+ }
+ }
+ ]
}
}
# Check that we handle the case where out-of-range is encountered sooner
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result
index b00e0e14e46..3634f8c023e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result
@@ -47,18 +47,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["kp1"],
- "key": "kp1",
- "key_length": "5",
- "used_key_parts": ["kp1"],
- "rows": 1000,
- "filtered": 100,
- "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
- "attached_condition": "t3.kp2 like '%foo%'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["kp1"],
+ "key": "kp1",
+ "key_length": "5",
+ "used_key_parts": ["kp1"],
+ "rows": 1000,
+ "filtered": 100,
+ "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
+ "attached_condition": "t3.kp2 like '%foo%'"
+ }
+ }
+ ]
}
}
# Check that we handle the case where out-of-range is encountered sooner