mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge branch '10.1' into bb-10.1-merge
This commit is contained in:
172
mysql-test/r/analyze_format_json.result
Normal file
172
mysql-test/r/analyze_format_json.result
Normal file
@ -0,0 +1,172 @@
|
||||
drop table if exists t0,t1,t2,t3;
|
||||
create table t0 (a int);
|
||||
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
# r_filtered=30%, because 3 rows match: 0,1,2
|
||||
analyze format=json select * from t0 where a<3;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 10,
|
||||
"r_rows": 10,
|
||||
"filtered": 100,
|
||||
"r_filtered": 30,
|
||||
"attached_condition": "(t0.a < 3)"
|
||||
}
|
||||
}
|
||||
}
|
||||
create table t1 (a int, b int, c int, key(a));
|
||||
insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B;
|
||||
analyze
|
||||
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10 100.00 0.00 Using where
|
||||
1 SIMPLE t1 ref a a 5 test.t0.a 1 NULL 100.00 NULL
|
||||
analyze format=json
|
||||
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 10,
|
||||
"r_rows": 10,
|
||||
"filtered": 100,
|
||||
"r_filtered": 0,
|
||||
"attached_condition": "((t0.a > 9) and (t0.a is not null))"
|
||||
},
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ref",
|
||||
"possible_keys": ["a"],
|
||||
"key": "a",
|
||||
"key_length": "5",
|
||||
"used_key_parts": ["a"],
|
||||
"ref": ["test.t0.a"],
|
||||
"r_loops": 0,
|
||||
"rows": 1,
|
||||
"r_rows": null,
|
||||
"filtered": 100,
|
||||
"r_filtered": null
|
||||
}
|
||||
}
|
||||
}
|
||||
analyze
|
||||
select * from t0, t1 where t1.a=t0.a and t1.b<4;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10 100.00 100.00 Using where
|
||||
1 SIMPLE t1 ref a a 5 test.t0.a 1 1 100.00 40.00 Using where
|
||||
analyze format=json
|
||||
select * from t0, t1 where t1.a=t0.a and t1.b<4;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 10,
|
||||
"r_rows": 10,
|
||||
"filtered": 100,
|
||||
"r_filtered": 100,
|
||||
"attached_condition": "(t0.a is not null)"
|
||||
},
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ref",
|
||||
"possible_keys": ["a"],
|
||||
"key": "a",
|
||||
"key_length": "5",
|
||||
"used_key_parts": ["a"],
|
||||
"ref": ["test.t0.a"],
|
||||
"r_loops": 10,
|
||||
"rows": 1,
|
||||
"r_rows": 1,
|
||||
"filtered": 100,
|
||||
"r_filtered": 40,
|
||||
"attached_condition": "(t1.b < 4)"
|
||||
}
|
||||
}
|
||||
}
|
||||
analyze
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE tbl1 ALL NULL NULL NULL NULL 100 100 100.00 2.00 Using where
|
||||
1 SIMPLE tbl2 ALL NULL NULL NULL NULL 100 100 100.00 94.00 Using where; Using join buffer (flat, BNL join)
|
||||
analyze format=json
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "tbl1",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 100,
|
||||
"r_rows": 100,
|
||||
"filtered": 100,
|
||||
"r_filtered": 20,
|
||||
"attached_condition": "(tbl1.b < 20)"
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "tbl2",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 100,
|
||||
"r_rows": 100,
|
||||
"filtered": 100,
|
||||
"r_filtered": 60,
|
||||
"attached_condition": "(tbl2.b < 60)"
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"join_type": "BNL",
|
||||
"r_filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
analyze format=json
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "tbl1",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 100,
|
||||
"r_rows": 100,
|
||||
"filtered": 100,
|
||||
"r_filtered": 20,
|
||||
"attached_condition": "(tbl1.b < 20)"
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "tbl2",
|
||||
"access_type": "ALL",
|
||||
"r_loops": 1,
|
||||
"rows": 100,
|
||||
"r_rows": 100,
|
||||
"filtered": 100,
|
||||
"r_filtered": 60,
|
||||
"attached_condition": "(tbl2.b < 60)"
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "(tbl1.c > tbl2.c)",
|
||||
"r_filtered": 15.833
|
||||
}
|
||||
}
|
||||
}
|
||||
drop table t1;
|
||||
drop table t0;
|
668
mysql-test/r/explain_json.result
Normal file
668
mysql-test/r/explain_json.result
Normal file
@ -0,0 +1,668 @@
|
||||
drop table if exists t0,t1;
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
explain format=json select * from t0;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json select * from t0 where 1>2;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"message": "Impossible WHERE"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json select * from t0 where a<3;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(t0.a < 3)"
|
||||
}
|
||||
}
|
||||
}
|
||||
# Try a basic join
|
||||
create table t1 (a int, b int, filler char(32), key(a));
|
||||
insert into t1
|
||||
select
|
||||
a.a + b.a* 10 + c.a * 100,
|
||||
a.a + b.a* 10 + c.a * 100,
|
||||
'filler'
|
||||
from t0 a, t0 b, t0 c;
|
||||
explain format=json select * from t0,t1 where t1.a=t0.a;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(t0.a is not null)"
|
||||
},
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ref",
|
||||
"possible_keys": ["a"],
|
||||
"key": "a",
|
||||
"key_length": "5",
|
||||
"used_key_parts": ["a"],
|
||||
"ref": ["test.t0.a"],
|
||||
"rows": 1,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
# Try range and index_merge
|
||||
create table t2 (a1 int, a2 int, b1 int, b2 int, key(a1,a2), key(b1,b2));
|
||||
insert into t2 select a,a,a,a from t1;
|
||||
explain format=json select * from t2 where a1<5;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "range",
|
||||
"possible_keys": ["a1"],
|
||||
"key": "a1",
|
||||
"key_length": "5",
|
||||
"used_key_parts": ["a1"],
|
||||
"rows": 5,
|
||||
"filtered": 100,
|
||||
"index_condition": "(t2.a1 < 5)"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json select * from t2 where a1=1 or b1=2;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "index_merge",
|
||||
"possible_keys": ["a1", "b1"],
|
||||
"key_length": "5,5",
|
||||
"index_merge": {
|
||||
"sort_union": {
|
||||
"range": {
|
||||
"key": "a1",
|
||||
"used_key_parts": ["a1"]
|
||||
},
|
||||
"range": {
|
||||
"key": "b1",
|
||||
"used_key_parts": ["b1"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "((t2.a1 = 1) or (t2.b1 = 2))"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "index_merge",
|
||||
"possible_keys": ["a1", "b1"],
|
||||
"key_length": "5,10",
|
||||
"index_merge": {
|
||||
"sort_union": {
|
||||
"range": {
|
||||
"key": "a1",
|
||||
"used_key_parts": ["a1"]
|
||||
},
|
||||
"range": {
|
||||
"key": "b1",
|
||||
"used_key_parts": ["b1", "b2"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rows": 2,
|
||||
"filtered": 100,
|
||||
"attached_condition": "((t2.a1 = 1) or ((t2.b1 = 2) and (t2.b2 = 3)))"
|
||||
}
|
||||
}
|
||||
}
|
||||
# Try ref access on two key components
|
||||
explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(t0.a is not null)"
|
||||
},
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "ref",
|
||||
"possible_keys": ["b1"],
|
||||
"key": "b1",
|
||||
"key_length": "10",
|
||||
"used_key_parts": ["b1", "b2"],
|
||||
"ref": ["test.t0.a", "const"],
|
||||
"rows": 1,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Try a UNION
|
||||
#
|
||||
explain format=json select * from t0 A union select * from t0 B;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"union_result": {
|
||||
"table_name": "<union1,2>",
|
||||
"access_type": "ALL",
|
||||
"query_specifications": [
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "A",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "B",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json select * from t0 A union all select * from t0 B;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"union_result": {
|
||||
"table_name": "<union1,2>",
|
||||
"access_type": "ALL",
|
||||
"query_specifications": [
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "A",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "B",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# Subqueries
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 select a,a from t0;
|
||||
explain format=json select a, a > (select max(b) from t1 where t1.b=t0.a) from t0;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
},
|
||||
"subqueries": [
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(t1.b = t0.a)"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
explain format=json
|
||||
select * from t0 where
|
||||
a > (select max(b) from t1 where t1.b=t0.a) or a < 3 ;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "((t0.a > (subquery#2)) or (t0.a < 3))"
|
||||
},
|
||||
"subqueries": [
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(t1.b = t0.a)"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
drop table t1;
|
||||
#
|
||||
# Join buffering
|
||||
#
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 select tbl1.a+10*tbl2.a, tbl1.a+10*tbl2.a from t0 tbl1, t0 tbl2;
|
||||
explain format=json
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.a=tbl2.a and tbl1.b < 3 and tbl2.b < 5;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "tbl1",
|
||||
"access_type": "ALL",
|
||||
"rows": 100,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(tbl1.b < 3)"
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "tbl2",
|
||||
"access_type": "ALL",
|
||||
"rows": 100,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(tbl2.b < 5)"
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "(tbl2.a = tbl1.a)"
|
||||
}
|
||||
}
|
||||
}
|
||||
drop table t1;
|
||||
#
|
||||
# Single-table UPDATE/DELETE, INSERT
|
||||
#
|
||||
explain format=json delete from t0;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"message": "Deleting all rows"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json delete from t0 where 1 > 2;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"message": "Impossible WHERE"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json delete from t0 where a < 3;
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"delete": 1,
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"attached_condition": "(t0.a < 3)"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json update t0 set a=3 where a in (2,3,4);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"update": 1,
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"attached_condition": "(t0.a in (2,3,4))"
|
||||
}
|
||||
}
|
||||
}
|
||||
explain format=json insert into t0 values (1);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t0"
|
||||
}
|
||||
}
|
||||
}
|
||||
create table t1 like t0;
|
||||
explain format=json insert into t1 values ((select max(a) from t0));
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t1"
|
||||
},
|
||||
"subqueries": [
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
drop table t1;
|
||||
#
|
||||
# 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# Non-merged semi-join (aka JTBM)
|
||||
#
|
||||
explain format=json
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"attached_condition": "(t1.a is not null)"
|
||||
},
|
||||
"table": {
|
||||
"table_name": "<subquery2>",
|
||||
"access_type": "eq_ref",
|
||||
"possible_keys": ["distinct_key"],
|
||||
"key": "distinct_key",
|
||||
"key_length": "4",
|
||||
"used_key_parts": ["max(a)"],
|
||||
"ref": ["test.t1.a"],
|
||||
"rows": 1,
|
||||
"filtered": 100,
|
||||
"materialized": {
|
||||
"unique": 1,
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# Semi-join Materialization
|
||||
#
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
explain format=json
|
||||
select * from t1,t2 where t1.a in ( select a from t0);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
},
|
||||
"table": {
|
||||
"table_name": "<subquery2>",
|
||||
"access_type": "eq_ref",
|
||||
"possible_keys": ["distinct_key"],
|
||||
"key": "distinct_key",
|
||||
"key_length": "4",
|
||||
"used_key_parts": ["a"],
|
||||
"ref": ["func"],
|
||||
"rows": 1,
|
||||
"filtered": 100,
|
||||
"materialized": {
|
||||
"unique": 1,
|
||||
"query_block": {
|
||||
"select_id": 2,
|
||||
"table": {
|
||||
"table_name": "t0",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"join_type": "BNL"
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# First-Match
|
||||
#
|
||||
explain
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; FirstMatch(t2); Using join buffer (flat, BNL join)
|
||||
explain format=json
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
},
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100,
|
||||
"first_match": "t2"
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# Duplicate Weedout
|
||||
#
|
||||
set @tmp= @@optimizer_switch;
|
||||
set optimizer_switch='firstmatch=off';
|
||||
explain
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
|
||||
explain format=json
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
EXPLAIN
|
||||
{
|
||||
"query_block": {
|
||||
"select_id": 1,
|
||||
"table": {
|
||||
"table_name": "t2",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
},
|
||||
"duplicates_removal": {
|
||||
"block-nl-join": {
|
||||
"table": {
|
||||
"table_name": "t1",
|
||||
"access_type": "ALL",
|
||||
"rows": 10,
|
||||
"filtered": 100
|
||||
},
|
||||
"buffer_type": "flat",
|
||||
"join_type": "BNL",
|
||||
"attached_condition": "((t1.b = t2.b) and (t1.a = t2.a))"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
set optimizer_switch=@tmp;
|
||||
drop table t1,t2;
|
||||
drop table t0;
|
@ -872,7 +872,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
|
||||
Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',@@default_week_format) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
|
||||
SET @TMP='2007-08-01 12:22:49';
|
||||
CREATE TABLE t1 (d DATETIME);
|
||||
INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
|
||||
|
@ -130,7 +130,8 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio
|
||||
create table t1 (col1 datetime)
|
||||
partition by range(week(col1))
|
||||
(partition p0 values less than (10), partition p1 values less than (30));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
|
||||
(partition p0 values less than (10), partition p1 values less than (30))' at line 2
|
||||
create table t1 (col1 varchar(25))
|
||||
partition by range(cast(col1 as signed))
|
||||
(partition p0 values less than (10), partition p1 values less than (30));
|
||||
|
@ -1070,11 +1070,71 @@ set statement character_set_filesystem=default for select 1;
|
||||
ERROR 42000: The system variable character_set_filesystem cannot be set in SET STATEMENT.
|
||||
set statement collation_connection=default for select 1;
|
||||
ERROR 42000: The system variable collation_connection cannot be set in SET STATEMENT.
|
||||
set statement old_passwords=default for select 1;
|
||||
ERROR 42000: The system variable old_passwords cannot be set in SET STATEMENT.
|
||||
set statement query_cache_type=default for select 1;
|
||||
ERROR 42000: The system variable query_cache_type cannot be set in SET STATEMENT.
|
||||
set statement wait_timeout=default for select 1;
|
||||
ERROR 42000: The system variable wait_timeout cannot be set in SET STATEMENT.
|
||||
set statement interactive_timeout=default for select 1;
|
||||
ERROR 42000: The system variable interactive_timeout cannot be set in SET STATEMENT.
|
||||
set @save_week_format=@@default_week_format;
|
||||
set @@default_week_format=0;
|
||||
SET STATEMENT default_week_format = 2 FOR SELECT WEEK('2000-01-01');
|
||||
WEEK('2000-01-01')
|
||||
52
|
||||
create table t1 (a date);
|
||||
insert t1 values ('2000-01-01');
|
||||
explain extended select week(a) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select week('2000-01-01',@@default_week_format) AS `week(a)` from dual
|
||||
prepare stmt1 from "select week(a) from t1";
|
||||
execute stmt1;
|
||||
week(a)
|
||||
0
|
||||
set default_week_format = 2;
|
||||
execute stmt1;
|
||||
week(a)
|
||||
52
|
||||
alter table t1 engine=myisam;
|
||||
execute stmt1;
|
||||
week(a)
|
||||
52
|
||||
deallocate prepare stmt1;
|
||||
drop table t1;
|
||||
set @@default_week_format=@save_week_format;
|
||||
set @save_old_passwords=@@old_passwords;
|
||||
set @@old_passwords=0;
|
||||
set statement OLD_PASSWORDS = 0 for select password('test');
|
||||
password('test')
|
||||
*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
set statement OLD_PASSWORDS = 1 for select password('test');
|
||||
password('test')
|
||||
378b243e220ca493
|
||||
set statement OLD_PASSWORDS = 0 for explain extended select password('test');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select password('test') AS `password('test')`
|
||||
set statement OLD_PASSWORDS = 1 for explain extended select password('test');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select password('test') AS `password('test')`
|
||||
create table t1 (a char(10));
|
||||
insert t1 values ('qwertyuiop');
|
||||
prepare stmt1 from "select password(a) from t1";
|
||||
execute stmt1;
|
||||
password(a)
|
||||
*6063C78456BB048BAF36BE1104D12D547834DFEA
|
||||
set old_passwords=1;
|
||||
execute stmt1;
|
||||
password(a)
|
||||
2013610f6aac2950
|
||||
alter table t1 engine=myisam;
|
||||
execute stmt1;
|
||||
password(a)
|
||||
2013610f6aac2950
|
||||
deallocate prepare stmt1;
|
||||
drop table t1;
|
||||
set @@old_passwords=@save_old_passwords;
|
||||
|
@ -1617,7 +1617,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
|
||||
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))
|
||||
# Should not crash
|
||||
SELECT * FROM t1 UNION SELECT * FROM t1
|
||||
ORDER BY (SELECT a FROM t2 WHERE b = 12);
|
||||
|
@ -181,7 +181,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
|
||||
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12)))
|
||||
# Should not crash
|
||||
SELECT * FROM t1 UNION SELECT * FROM t1
|
||||
ORDER BY (SELECT a FROM t2 WHERE b = 12);
|
||||
|
38
mysql-test/t/analyze_format_json.test
Normal file
38
mysql-test/t/analyze_format_json.test
Normal file
@ -0,0 +1,38 @@
|
||||
#
|
||||
# Tests for "ANALYZE FORMAT=JSON $statement" syntax
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1,t2,t3;
|
||||
--enable_warnings
|
||||
|
||||
create table t0 (a int);
|
||||
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
--echo # r_filtered=30%, because 3 rows match: 0,1,2
|
||||
analyze format=json select * from t0 where a<3;
|
||||
|
||||
create table t1 (a int, b int, c int, key(a));
|
||||
insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B;
|
||||
|
||||
analyze
|
||||
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
|
||||
analyze format=json
|
||||
select * from t0, t1 where t1.a=t0.a and t0.a > 9;
|
||||
|
||||
analyze
|
||||
select * from t0, t1 where t1.a=t0.a and t1.b<4;
|
||||
|
||||
analyze format=json
|
||||
select * from t0, t1 where t1.a=t0.a and t1.b<4;
|
||||
|
||||
analyze
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5;
|
||||
|
||||
analyze format=json
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;
|
||||
|
||||
analyze format=json
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;
|
||||
|
||||
drop table t1;
|
||||
drop table t0;
|
138
mysql-test/t/explain_json.test
Normal file
138
mysql-test/t/explain_json.test
Normal file
@ -0,0 +1,138 @@
|
||||
#
|
||||
# EXPLAIN FORMAT=JSON tests. These are tests developed for MariaDB.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t0(a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
explain format=json select * from t0;
|
||||
|
||||
explain format=json select * from t0 where 1>2;
|
||||
|
||||
explain format=json select * from t0 where a<3;
|
||||
|
||||
--echo # Try a basic join
|
||||
create table t1 (a int, b int, filler char(32), key(a));
|
||||
insert into t1
|
||||
select
|
||||
a.a + b.a* 10 + c.a * 100,
|
||||
a.a + b.a* 10 + c.a * 100,
|
||||
'filler'
|
||||
from t0 a, t0 b, t0 c;
|
||||
|
||||
explain format=json select * from t0,t1 where t1.a=t0.a;
|
||||
|
||||
--echo # Try range and index_merge
|
||||
create table t2 (a1 int, a2 int, b1 int, b2 int, key(a1,a2), key(b1,b2));
|
||||
insert into t2 select a,a,a,a from t1;
|
||||
|
||||
explain format=json select * from t2 where a1<5;
|
||||
|
||||
explain format=json select * from t2 where a1=1 or b1=2;
|
||||
explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
|
||||
|
||||
--echo # Try ref access on two key components
|
||||
|
||||
explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Try a UNION
|
||||
--echo #
|
||||
explain format=json select * from t0 A union select * from t0 B;
|
||||
explain format=json select * from t0 A union all select * from t0 B;
|
||||
|
||||
--echo #
|
||||
--echo # Subqueries
|
||||
--echo #
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 select a,a from t0;
|
||||
explain format=json select a, a > (select max(b) from t1 where t1.b=t0.a) from t0;
|
||||
|
||||
explain format=json
|
||||
select * from t0 where
|
||||
a > (select max(b) from t1 where t1.b=t0.a) or a < 3 ;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Join buffering
|
||||
--echo #
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 select tbl1.a+10*tbl2.a, tbl1.a+10*tbl2.a from t0 tbl1, t0 tbl2;
|
||||
|
||||
explain format=json
|
||||
select * from t1 tbl1, t1 tbl2 where tbl1.a=tbl2.a and tbl1.b < 3 and tbl2.b < 5;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Single-table UPDATE/DELETE, INSERT
|
||||
--echo #
|
||||
explain format=json delete from t0;
|
||||
explain format=json delete from t0 where 1 > 2;
|
||||
|
||||
explain format=json delete from t0 where a < 3;
|
||||
|
||||
explain format=json update t0 set a=3 where a in (2,3,4);
|
||||
|
||||
explain format=json insert into t0 values (1);
|
||||
|
||||
create table t1 like t0;
|
||||
explain format=json insert into t1 values ((select max(a) from t0));
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # A derived table
|
||||
--echo #
|
||||
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 format=json
|
||||
select * from (select a, count(*) as cnt from t1 group by a) as tbl1, t1 as
|
||||
tbl2 where cnt=tbl2.a;
|
||||
|
||||
--echo #
|
||||
--echo # Non-merged semi-join (aka JTBM)
|
||||
--echo #
|
||||
explain format=json
|
||||
select * from t1 where a in (select max(a) from t1 group by b);
|
||||
|
||||
--echo #
|
||||
--echo # Semi-join Materialization
|
||||
--echo #
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
explain format=json
|
||||
select * from t1,t2 where t1.a in ( select a from t0);
|
||||
|
||||
--echo #
|
||||
--echo # First-Match
|
||||
--echo #
|
||||
explain
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
explain format=json
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
|
||||
--echo #
|
||||
--echo # Duplicate Weedout
|
||||
--echo #
|
||||
set @tmp= @@optimizer_switch;
|
||||
set optimizer_switch='firstmatch=off';
|
||||
explain
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
explain format=json
|
||||
select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
|
||||
set optimizer_switch=@tmp;
|
||||
|
||||
drop table t1,t2;
|
||||
drop table t0;
|
||||
|
@ -163,7 +163,7 @@ create table t1 (col1 date)
|
||||
partition by range(unix_timestamp(col1))
|
||||
(partition p0 values less than (10), partition p1 values less than (30));
|
||||
|
||||
-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
|
||||
-- error ER_PARSE_ERROR
|
||||
create table t1 (col1 datetime)
|
||||
partition by range(week(col1))
|
||||
(partition p0 values less than (10), partition p1 values less than (30));
|
||||
|
@ -1025,11 +1025,44 @@ set statement character_set_filesystem=default for select 1;
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement collation_connection=default for select 1;
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement old_passwords=default for select 1;
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement query_cache_type=default for select 1;
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement wait_timeout=default for select 1;
|
||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||
set statement interactive_timeout=default for select 1;
|
||||
|
||||
# MDEV-6996: SET STATEMENT default_week_format = .. has no effect
|
||||
set @save_week_format=@@default_week_format;
|
||||
set @@default_week_format=0;
|
||||
SET STATEMENT default_week_format = 2 FOR SELECT WEEK('2000-01-01');
|
||||
create table t1 (a date);
|
||||
insert t1 values ('2000-01-01');
|
||||
explain extended select week(a) from t1;
|
||||
prepare stmt1 from "select week(a) from t1";
|
||||
execute stmt1;
|
||||
set default_week_format = 2;
|
||||
execute stmt1;
|
||||
alter table t1 engine=myisam;
|
||||
execute stmt1;
|
||||
deallocate prepare stmt1;
|
||||
drop table t1;
|
||||
set @@default_week_format=@save_week_format;
|
||||
|
||||
# MDEV-7015: SET STATEMENT old_passwords has no effect
|
||||
set @save_old_passwords=@@old_passwords;
|
||||
set @@old_passwords=0;
|
||||
set statement OLD_PASSWORDS = 0 for select password('test');
|
||||
set statement OLD_PASSWORDS = 1 for select password('test');
|
||||
set statement OLD_PASSWORDS = 0 for explain extended select password('test');
|
||||
set statement OLD_PASSWORDS = 1 for explain extended select password('test');
|
||||
create table t1 (a char(10));
|
||||
insert t1 values ('qwertyuiop');
|
||||
prepare stmt1 from "select password(a) from t1";
|
||||
execute stmt1;
|
||||
set old_passwords=1;
|
||||
execute stmt1;
|
||||
alter table t1 engine=myisam;
|
||||
execute stmt1;
|
||||
deallocate prepare stmt1;
|
||||
drop table t1;
|
||||
set @@old_passwords=@save_old_passwords;
|
||||
|
Reference in New Issue
Block a user