forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexplain_shard_index.test
22 lines (19 loc) · 1.27 KB
/
explain_shard_index.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
set tidb_cost_model_version=1;
drop table if exists test3, test5;
create table test3(id int primary key clustered, a int, b int, unique key uk_expr((tidb_shard(a)),a));
create table test5(id int primary key clustered, a int, b int, unique key uk_expr((tidb_shard(a)),a,b));
explain format=brief select * from test3 where a=100;
explain format=brief select * from test3 where a=100 and (b = 100 or b = 200);
explain format=brief select * from test3 where tidb_shard(a) = 8;
explain format=brief select * from test3 where a=100 or b = 200;
explain format=brief select * from test3 where a=100 or a = 300;
explain format=brief select * from test3 where a=100 or a = 300 or a > 997;
explain format=brief select * from test3 where ((a=100 and b = 100) or a = 200) and b = 300;
explain format=brief select * from test3 where a = b;
explain format=brief select * from test3 where a = b and b = 100;
explain format=brief select * from test5 where a=100 and b = 100;
explain format=brief select * from test5 where (a=100 and b = 100) or (a=200 and b = 200);
explain format=brief select a+b from test5 where (a, b) in ((100, 100), (200, 200));
explain format=brief SELECT * FROM test3 WHERE a IN (100);
explain format=brief SELECT * FROM test3 WHERE a IN (100, 200, 300);
drop table if exists test3, test5;