diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2014-11-28 22:23:29 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2014-11-28 22:23:29 +0300 |
commit | 2ac3b39e68bf6bf1b56e6eafd290c0a78368d0be (patch) | |
tree | 4b02aba6761e6fa6291f8ce70578ea3377c848fc /mysql-test/r/explain_json.result | |
parent | 3a5e080d4dbe58675e6324eaa807bc2c7aa8795d (diff) | |
download | mariadb-git-2ac3b39e68bf6bf1b56e6eafd290c0a78368d0be.tar.gz |
EXPLAIN FORMAT=JSON: support derived tables
Diffstat (limited to 'mysql-test/r/explain_json.result')
-rw-r--r-- | mysql-test/r/explain_json.result | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index d97abbaa2e3..416f432f21d 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -393,4 +393,75 @@ EXPLAIN } } } +# +# A derived table +# +create table t1 (a int, b int); +insert into t1 select a,a from t0; +explain format=json +select * from (select a, count(*) as cnt from t1 group by a) as tbl +where cnt>0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(tbl.cnt > 0)", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } +} +explain format=json +select * from (select a, count(*) as cnt from t1 group by a) as tbl1, t1 as +tbl2 where cnt=tbl2.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "tbl2", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(tbl2.a is not null)" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "8", + "used_key_parts": ["cnt"], + "ref": ["test.tbl2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "(tbl1.cnt = tbl2.a)", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } +} drop table t0; |