diff options
Diffstat (limited to 'mysql-test/main/derived_cond_pushdown.result')
-rw-r--r-- | mysql-test/main/derived_cond_pushdown.result | 18746 |
1 files changed, 10597 insertions, 8149 deletions
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 5b0cc4a08f5..9bbd32a9c84 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": "<derived2>", - "access_type": "ALL", - "rows": 20, - "filtered": 100, - "attached_condition": "v1.max_c < 500" }, - "buffer_type": "flat", - "buffer_size": "715", - "join_type": "BNL", - "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": "flat", + "buffer_size": "715", + "join_type": "BNL", + "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 + } + } + ] + } } } } } - } - }, - "block-nl-join": { - "table": { - "table_name": "<derived3>", - "access_type": "ALL", - "rows": 20, - "filtered": 100, - "attached_condition": "v2.max_c > 300" }, - "buffer_type": "incremental", - "buffer_size": "9Kb", - "join_type": "BNL", - "attached_condition": "v2.a = v1.a or v1.a = t2.a", - "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": "incremental", + "buffer_size": "9Kb", + "join_type": "BNL", + "attached_condition": "v2.a = v1.a or v1.a = t2.a", + "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 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,41 +11117,51 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "1 in (0,t1.a) 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": { - "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": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 in (0,t1.a) 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": { + "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)" + } + } + ] + } } } } } } - } + ] } } SELECT * FROM @@ -9741,41 +11185,51 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.a in (1,t1.a) 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": { - "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": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a in (1,t1.a) 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": { + "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)" + } + } + ] + } } } } } } - } + ] } } DROP TABLE t1; @@ -9862,30 +11316,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 @@ -9900,42 +11362,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 @@ -9953,31 +11425,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 @@ -10017,30 +11499,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 * @@ -10066,30 +11556,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 * @@ -10115,30 +11613,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 * @@ -10164,30 +11670,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; @@ -10233,47 +11747,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; @@ -10302,48 +11830,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; @@ -10373,36 +11915,46 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.f2 < 2 and t1.f2 is not null" - }, - "table": { - "table_name": "<derived3>", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["f2"], - "ref": ["test.t1.f2"], - "rows": 2, - "filtered": 100, - "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": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2 and t1.f2 is not null" + } + }, + { + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["f2"], + "ref": ["test.t1.f2"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2" + } + } + ] + } } } } - } + ] } } SELECT * FROM t1; @@ -10418,38 +11970,48 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.f2 < 2 and t1.f2 is not null" - }, - "table": { - "table_name": "<derived3>", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["f2"], - "ref": ["test.t1.f2"], - "rows": 1, - "filtered": 100, - "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": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2 and t1.f2 is not null" + } + }, + { + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["f2"], + "ref": ["test.t1.f2"], + "rows": 1, + "filtered": 100, + "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" + } + } + ] + } } } } } - } + ] } } DROP VIEW v1,v2; @@ -10488,39 +12050,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; @@ -10690,54 +12256,66 @@ 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": { - "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": { + "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; @@ -10762,31 +12340,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 @@ -10807,41 +12393,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; @@ -10894,71 +12490,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 @@ -10982,72 +12592,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 @@ -11070,72 +12694,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 @@ -11160,72 +12798,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 @@ -11251,72 +12903,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 @@ -11343,72 +13009,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 @@ -11441,72 +13121,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 @@ -11561,72 +13255,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 @@ -11710,72 +13418,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; @@ -11811,71 +13533,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 @@ -11901,72 +13637,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 @@ -11991,72 +13741,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 @@ -12085,72 +13849,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 @@ -12176,72 +13954,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 @@ -12270,72 +14062,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 @@ -12368,72 +14174,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 @@ -12486,72 +14306,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 @@ -12631,72 +14465,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; @@ -12734,113 +14582,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; @@ -12878,91 +14748,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; @@ -12998,91 +14886,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; @@ -13120,91 +15026,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; @@ -13240,91 +15164,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; @@ -13360,113 +15302,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; @@ -13506,99 +15470,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" } } ] @@ -13606,32 +15615,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; @@ -13668,90 +15658,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; @@ -13788,90 +15796,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; @@ -13904,72 +15930,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; @@ -14002,72 +16042,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; @@ -14102,72 +16156,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; @@ -14204,91 +16272,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; @@ -14330,41 +16416,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; @@ -14399,68 +16495,82 @@ 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 < 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": "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 < 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" + } + } + ] + } } - } + ] } - ] + } } } } - } + ] } } drop view v1; @@ -14495,70 +16605,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; @@ -14614,35 +16738,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 @@ -14719,66 +16853,82 @@ 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": { - "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": { + "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 * @@ -14811,45 +16961,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 @@ -14939,86 +17101,106 @@ 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": { - "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": { + "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, @@ -15068,35 +17250,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, @@ -15146,35 +17338,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, @@ -15224,37 +17426,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; @@ -15327,47 +17541,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 @@ -15438,43 +17662,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 @@ -15543,41 +17777,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; @@ -15634,47 +17878,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 @@ -15713,42 +17967,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 @@ -15787,47 +18051,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 @@ -15866,42 +18140,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; @@ -15951,59 +18235,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 @@ -16086,7 +18382,7 @@ explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 90 63.28 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 90 60.00 Using where 1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort @@ -16099,53 +18395,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": 60, + "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 * @@ -16199,68 +18507,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 * @@ -16583,7 +18905,7 @@ explain extended select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 90 63.28 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 90 60.00 Using where 1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary @@ -16596,57 +18918,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": 60, + "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; @@ -16699,84 +19035,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; @@ -16851,43 +19205,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; @@ -17283,58 +19647,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; @@ -17381,73 +19753,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"; @@ -17471,78 +19861,96 @@ 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, - "attached_condition": "cp2.a = t3.`id`", - "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, + "attached_condition": "cp2.a = t3.`id`", + "using_index": true + } + } + ] + } } } } - } + ] } } prepare stmt from "select * from t1, (select a from t1 cp2 group by a) dt, t3 @@ -17664,60 +20072,72 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t3", - "access_type": "range", - "possible_keys": ["t1_id"], - "key": "t1_id", - "key_length": "5", - "used_key_parts": ["t1_id"], - "rows": 47, - "filtered": 100, - "attached_condition": "t3.t1_id between 200 and 100000 and t3.t1_id is not null", - "using_index": true - }, - "table": { - "table_name": "t1", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY"], - "key": "PRIMARY", - "key_length": "4", - "used_key_parts": ["id"], - "ref": ["test.t3.t1_id"], - "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": ["t1_id"], - "ref": ["test.t3.t1_id"], - "rows": 2, - "filtered": 100, - "materialized": { - "lateral": 1, - "query_block": { - "select_id": 2, - "table": { - "table_name": "t2", - "access_type": "ref", - "possible_keys": ["t1_id"], - "key": "t1_id", - "key_length": "5", - "used_key_parts": ["t1_id"], - "ref": ["test.t1.id"], - "rows": 3, - "filtered": 58.59375, - "index_condition": "t2.t1_id between 200 and 100000 and t2.t1_id = t3.t1_id", - "attached_condition": "t2.reporting_person = 1" + "nested_loop": [ + { + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["t1_id"], + "key": "t1_id", + "key_length": "5", + "used_key_parts": ["t1_id"], + "rows": 47, + "filtered": 100, + "attached_condition": "t3.t1_id between 200 and 100000 and t3.t1_id is not null", + "using_index": true + } + }, + { + "table": { + "table_name": "t1", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["id"], + "ref": ["test.t3.t1_id"], + "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": ["t1_id"], + "ref": ["test.t3.t1_id"], + "rows": 2, + "filtered": 100, + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["t1_id"], + "key": "t1_id", + "key_length": "5", + "used_key_parts": ["t1_id"], + "ref": ["test.t1.id"], + "rows": 3, + "filtered": 59.09090805, + "index_condition": "t2.t1_id between 200 and 100000 and t2.t1_id = t3.t1_id", + "attached_condition": "t2.reporting_person = 1" + } + } + ] + } } } } - } + ] } } set optimizer_switch='split_materialized=off'; @@ -17877,54 +20297,70 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "charges", - "access_type": "ALL", - "possible_keys": ["PRIMARY", "fk_charge_from_ledger", "fk_charge_to_ledger"], - "rows": 20, - "filtered": 40, - "attached_condition": "charges.to_ledger_id = 2" - }, - "table": { - "table_name": "<derived2>", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "17", - "used_key_parts": ["ledger_id", "charge_id"], - "ref": ["test.charges.from_ledger_id", "test.charges.id"], - "rows": 2, - "filtered": 100, - "materialized": { - "lateral": 1, - "query_block": { - "select_id": 2, - "table": { - "table_name": "transaction_items", - "access_type": "ref", - "possible_keys": ["fk_items_transaction", "fk_items_charge"], - "key": "fk_items_charge", - "key_length": "9", - "used_key_parts": ["charge_id"], - "ref": ["test.charges.id"], - "rows": 2, - "filtered": 100 - }, - "table": { - "table_name": "transactions", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY", "fk_transactions_ledger"], - "key": "PRIMARY", - "key_length": "8", - "used_key_parts": ["id"], - "ref": ["test.transaction_items.transaction_id"], - "rows": 1, - "filtered": 100, - "attached_condition": "transactions.ledger_id = charges.from_ledger_id" + "nested_loop": [ + { + "table": { + "table_name": "charges", + "access_type": "ALL", + "possible_keys": [ + "PRIMARY", + "fk_charge_from_ledger", + "fk_charge_to_ledger" + ], + "rows": 20, + "filtered": 40, + "attached_condition": "charges.to_ledger_id = 2" + } + }, + { + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "17", + "used_key_parts": ["ledger_id", "charge_id"], + "ref": ["test.charges.from_ledger_id", "test.charges.id"], + "rows": 2, + "filtered": 100, + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "transaction_items", + "access_type": "ref", + "possible_keys": ["fk_items_transaction", "fk_items_charge"], + "key": "fk_items_charge", + "key_length": "9", + "used_key_parts": ["charge_id"], + "ref": ["test.charges.id"], + "rows": 2, + "filtered": 100 + } + }, + { + "table": { + "table_name": "transactions", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY", "fk_transactions_ledger"], + "key": "PRIMARY", + "key_length": "8", + "used_key_parts": ["id"], + "ref": ["test.transaction_items.transaction_id"], + "rows": 1, + "filtered": 100, + "attached_condition": "transactions.ledger_id = charges.from_ledger_id" + } + } + ] + } } } } - } + ] } } set optimizer_switch='split_materialized=off'; @@ -18055,54 +20491,66 @@ EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "charges", - "access_type": "ALL", - "possible_keys": ["fk_charge_to_ledger"], - "rows": 20, - "filtered": 50, - "attached_condition": "charges.to_ledger_id = 2" - }, - "table": { - "table_name": "<derived2>", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "18", - "used_key_parts": ["ledger_id", "charge_id"], - "ref": ["test.charges.from_ledger_id", "test.charges.id"], - "rows": 2, - "filtered": 100, - "materialized": { - "lateral": 1, - "query_block": { - "select_id": 2, - "table": { - "table_name": "transaction_items", - "access_type": "ref", - "possible_keys": ["fk_items_transaction", "fk_items_charge"], - "key": "fk_items_charge", - "key_length": "9", - "used_key_parts": ["charge_id"], - "ref": ["test.charges.id"], - "rows": 2, - "filtered": 100 - }, - "table": { - "table_name": "transactions", - "access_type": "eq_ref", - "possible_keys": ["PRIMARY", "fk_transactions_ledger"], - "key": "PRIMARY", - "key_length": "8", - "used_key_parts": ["id"], - "ref": ["test.transaction_items.transaction_id"], - "rows": 1, - "filtered": 100, - "attached_condition": "transactions.ledger_id = charges.from_ledger_id" + "nested_loop": [ + { + "table": { + "table_name": "charges", + "access_type": "ALL", + "possible_keys": ["fk_charge_to_ledger"], + "rows": 20, + "filtered": 50, + "attached_condition": "charges.to_ledger_id = 2" + } + }, + { + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "18", + "used_key_parts": ["ledger_id", "charge_id"], + "ref": ["test.charges.from_ledger_id", "test.charges.id"], + "rows": 2, + "filtered": 100, + "materialized": { + "lateral": 1, + "query_block": { + "select_id": 2, + "nested_loop": [ + { + "table": { + "table_name": "transaction_items", + "access_type": "ref", + "possible_keys": ["fk_items_transaction", "fk_items_charge"], + "key": "fk_items_charge", + "key_length": "9", + "used_key_parts": ["charge_id"], + "ref": ["test.charges.id"], + "rows": 2, + "filtered": 100 + } + }, + { + "table": { + "table_name": "transactions", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY", "fk_transactions_ledger"], + "key": "PRIMARY", + "key_length": "8", + "used_key_parts": ["id"], + "ref": ["test.transaction_items.transaction_id"], + "rows": 1, + "filtered": 100, + "attached_condition": "transactions.ledger_id = charges.from_ledger_id" + } + } + ] + } } } } - } + ] } } set optimizer_switch='split_materialized=off'; |