mark some file to been opensource for ce-farm

This commit is contained in:
niyuhang
2023-11-15 11:44:43 +00:00
committed by ob-robot
parent 4900683cff
commit c8ace58297
685 changed files with 1080566 additions and 111051 deletions

View File

@ -0,0 +1,655 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
drop table if exists t1;
create table t1(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b) partitions 2;
create index gkey on t1(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t2;
create table t2(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(c+1) partitions 3;
create index gkey on t2(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t3;
create table t3(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b+c) partitions 4;
create index gkey on t3(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t4;
create table t4(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b+c+d) partitions 5;
create index gkey on t4(b,c,d) global partition by hash(b) partitions 5;
## 1.2 test key partition
drop table if exists t5;
create table t5(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by key(b) partitions 2;
create index gkey on t5(b,c,d) global partition by hash(b) partitions 5;
use muhangtest;
## build tables
## part one 测试各种分区方式下,能否正确的将index rowkey发送到正确的主表分区。
## 注意,目前list column分区相关的case插入可能会出现ERROR 6002 (40000): Transaction rollbacked, 这里需要被修复.
## part tow 测试多轮的读取是否会出错
## part three 生成列
## part one
## 1.1 test hash partition
EXPLAIN select /*+index(t1 gkey)*/ * from t1 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |349 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t1(gkey)|5 |348 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
sort_keys([t1.a, ASC], [t1.b, ASC], [t1.c, ASC], [t1.d, ASC])
1 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter([t1.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t1.b], [t1.c], [t1.d], [t1.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t1 gkey)*/ * from t1 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t1 gkey)*/ * from t1 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t1(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
sort_keys([t1.a, ASC], [t1.b, ASC], [t1.c, ASC], [t1.d, ASC])
1 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t1.b], [t1.c], [t1.d], [t1.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t1.b IN (1, 2, 3, 4, 5)])
select /*+index(t1 gkey)*/ * from t1 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t1 gkey)*/ * from t1 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t1(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
sort_keys([t1.a, ASC], [t1.b, ASC], [t1.c, ASC], [t1.d, ASC])
1 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t1.b], [t1.c], [t1.d], [t1.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t1.c, t1.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t1 gkey)*/ * from t1 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t1 gkey)*/ * from t1 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t1(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
sort_keys([t1.a, ASC], [t1.b, ASC], [t1.c, ASC], [t1.d, ASC])
1 - output([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), filter(nil), rowset=16
access([t1.a], [t1.b], [t1.c], [t1.d], [t1.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t1.b], [t1.c], [t1.d], [t1.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t1.c, t1.d, t1.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t1 gkey)*/ * from t1 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t2 gkey)*/ * from t2 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t2(gkey)|5 |239 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
sort_keys([t2.a, ASC], [t2.b, ASC], [t2.c, ASC], [t2.d, ASC])
1 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter([t2.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t2.b], [t2.c], [t2.d], [t2.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t2 gkey)*/ * from t2 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t2 gkey)*/ * from t2 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t2(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
sort_keys([t2.a, ASC], [t2.b, ASC], [t2.c, ASC], [t2.d, ASC])
1 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
access([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t2.b], [t2.c], [t2.d], [t2.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t2.b IN (1, 2, 3, 4, 5)])
select /*+index(t2 gkey)*/ * from t2 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t2 gkey)*/ * from t2 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t2(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
sort_keys([t2.a, ASC], [t2.b, ASC], [t2.c, ASC], [t2.d, ASC])
1 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
access([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t2.b], [t2.c], [t2.d], [t2.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t2.c, t2.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t2 gkey)*/ * from t2 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t2 gkey)*/ * from t2 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t2(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
sort_keys([t2.a, ASC], [t2.b, ASC], [t2.c, ASC], [t2.d, ASC])
1 - output([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), filter(nil), rowset=16
access([t2.a], [t2.b], [t2.c], [t2.d], [t2.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t2.b], [t2.c], [t2.d], [t2.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t2.c, t2.d, t2.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t2 gkey)*/ * from t2 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t3 gkey)*/ * from t3 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t3(gkey)|5 |185 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
sort_keys([t3.a, ASC], [t3.b, ASC], [t3.c, ASC], [t3.d, ASC])
1 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter([t3.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t3.b], [t3.c], [t3.d], [t3.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t3 gkey)*/ * from t3 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t3 gkey)*/ * from t3 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t3(gkey)|5 |269 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
sort_keys([t3.a, ASC], [t3.b, ASC], [t3.c, ASC], [t3.d, ASC])
1 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
access([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t3.b], [t3.c], [t3.d], [t3.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t3.b IN (1, 2, 3, 4, 5)])
select /*+index(t3 gkey)*/ * from t3 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t3 gkey)*/ * from t3 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t3(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
sort_keys([t3.a, ASC], [t3.b, ASC], [t3.c, ASC], [t3.d, ASC])
1 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
access([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t3.b], [t3.c], [t3.d], [t3.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t3.c, t3.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t3 gkey)*/ * from t3 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t3 gkey)*/ * from t3 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t3(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
sort_keys([t3.a, ASC], [t3.b, ASC], [t3.c, ASC], [t3.d, ASC])
1 - output([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), filter(nil), rowset=16
access([t3.a], [t3.b], [t3.c], [t3.d], [t3.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t3.b], [t3.c], [t3.d], [t3.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t3.c, t3.d, t3.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t3 gkey)*/ * from t3 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t4 gkey)*/ * from t4 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |153 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t4(gkey)|5 |152 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
sort_keys([t4.a, ASC], [t4.b, ASC], [t4.c, ASC], [t4.d, ASC])
1 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter([t4.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t4.b], [t4.c], [t4.d], [t4.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t4 gkey)*/ * from t4 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t4 gkey)*/ * from t4 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |237 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t4(gkey)|5 |236 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
sort_keys([t4.a, ASC], [t4.b, ASC], [t4.c, ASC], [t4.d, ASC])
1 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
access([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t4.b], [t4.c], [t4.d], [t4.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t4.b IN (1, 2, 3, 4, 5)])
select /*+index(t4 gkey)*/ * from t4 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t4 gkey)*/ * from t4 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |237 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t4(gkey)|5 |236 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
sort_keys([t4.a, ASC], [t4.b, ASC], [t4.c, ASC], [t4.d, ASC])
1 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
access([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t4.b], [t4.c], [t4.d], [t4.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t4.c, t4.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t4 gkey)*/ * from t4 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t4 gkey)*/ * from t4 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |237 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t4(gkey)|5 |236 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
sort_keys([t4.a, ASC], [t4.b, ASC], [t4.c, ASC], [t4.d, ASC])
1 - output([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), filter(nil), rowset=16
access([t4.a], [t4.b], [t4.c], [t4.d], [t4.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t4.b], [t4.c], [t4.d], [t4.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t4.c, t4.d, t4.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t4 gkey)*/ * from t4 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t5 gkey)*/ * from t5 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |349 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t5(gkey)|5 |348 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
sort_keys([t5.a, ASC], [t5.b, ASC], [t5.c, ASC], [t5.d, ASC])
1 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter([t5.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t5.b], [t5.c], [t5.d], [t5.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t5 gkey)*/ * from t5 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t5 gkey)*/ * from t5 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |759 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t5(gkey)|5 |759 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
sort_keys([t5.a, ASC], [t5.b, ASC], [t5.c, ASC], [t5.d, ASC])
1 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
access([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t5.b], [t5.c], [t5.d], [t5.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t5.b IN (1, 2, 3, 4, 5)])
select /*+index(t5 gkey)*/ * from t5 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t5 gkey)*/ * from t5 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |759 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t5(gkey)|5 |759 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
sort_keys([t5.a, ASC], [t5.b, ASC], [t5.c, ASC], [t5.d, ASC])
1 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
access([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t5.b], [t5.c], [t5.d], [t5.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t5.c, t5.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t5 gkey)*/ * from t5 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t5 gkey)*/ * from t5 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |759 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t5(gkey)|5 |759 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
sort_keys([t5.a, ASC], [t5.b, ASC], [t5.c, ASC], [t5.d, ASC])
1 - output([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), filter(nil), rowset=16
access([t5.a], [t5.b], [t5.c], [t5.d], [t5.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t5.b], [t5.c], [t5.d], [t5.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t5.c, t5.d, t5.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t5 gkey)*/ * from t5 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
drop table t1;
drop table t2;
create table t1(a int, b int);
create table t2(a int primary key, b int, c int, d int) partition by hash(a) partitions 2;
create index i1 on t2(b) global;
EXPLAIN insert into t1 values(1, 1), (2, 2);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |2 |20 |
|1 |└─EXPRESSION | |2 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t1: ({t1: (t1.__pk_increment, t1.a, t1.b)})}]),
column_values([T_HIDDEN_PK], [column_conv(INT,PS:(11,0),NULL,__values.a)], [column_conv(INT,PS:(11,0),NULL,__values.b)])
1 - output([__values.a], [__values.b]), filter(nil)
values({1, 1}, {2, 2})
insert into t1 values(1, 1), (2, 2);
EXPLAIN insert into t2 values(1, 1, 1, 1), (3, 3, 3, 3);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |2 |26 |
|1 |└─EXPRESSION | |2 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t2: ({t2: (t2.a, t2.b, t2.c, t2.d)}, {i1: (t2.b, t2.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NULL,__values.b)], [column_conv(INT,PS:(11,0),NULL,__values.c)],
[column_conv(INT,PS:(11,0),NULL,__values.d)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d]), filter(nil)
values({1, 1, 1, 1}, {3, 3, 3, 3})
insert into t2 values(1, 1, 1, 1), (3, 3, 3, 3);
EXPLAIN select /*+no_rewrite, leading(t1)*/ * from t1 where exists (select /*+index(t2 i1)*/ 1 from t2 where t1.b=t2.b and t2.c>0);
Query Plan
================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------
|0 |SUBPLAN FILTER | |1 |68 |
|1 |├─TABLE FULL SCAN |t1 |2 |3 |
|2 |└─DISTRIBUTED TABLE RANGE SCAN|t2(i1)|1 |33 |
================================================================
Outputs & filters:
-------------------------------------
0 - output([t1.a], [t1.b]), filter([(T_OP_EXISTS, subquery(1))]), rowset=16
exec_params_([t1.b(:0)]), onetime_exprs_(nil), init_plan_idxs_(nil), use_batch=false
1 - output([t1.b], [t1.a]), filter(nil), rowset=16
access([t1.b], [t1.a]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
2 - output([1]), filter([t2.c > 0]), rowset=16
access([t2.a], [t2.c]), partitions(p0)
is_index_back=true, is_global_index=true, filter_before_indexback[false],
range_key([t2.b], [t2.a]), range(MIN,MIN ; MAX,MAX)always true,
range_cond([:0 = t2.b])
select /*+no_rewrite, leading(t1)*/ * from t1 where exists (select /*+index(t2 i1)*/ 1 from t2 where t1.b=t2.b and t2.c>0);
+------+------+
| a | b |
+------+------+
| 1 | 1 |
+------+------+
drop database muhangtest;

View File

@ -0,0 +1,588 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
drop table if exists t6;
create table t6(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by key(b,c) partitions 3;
create index gkey on t6(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t7;
create table t7(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by key(b,c,d) partitions 4;
create index gkey on t7(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t8;
create table t8(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range(b) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t8(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t9;
create table t9(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range(b+1) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t9(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t10;
create table t10(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range(b+c) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t10(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN select /*+index(t6 gkey)*/ * from t6 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t6(gkey)|5 |239 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
sort_keys([t6.a, ASC], [t6.b, ASC], [t6.c, ASC], [t6.d, ASC])
1 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter([t6.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t6.b], [t6.c], [t6.d], [t6.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t6 gkey)*/ * from t6 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t6 gkey)*/ * from t6 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t6(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
sort_keys([t6.a, ASC], [t6.b, ASC], [t6.c, ASC], [t6.d, ASC])
1 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
access([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t6.b], [t6.c], [t6.d], [t6.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t6.b IN (1, 2, 3, 4, 5)])
select /*+index(t6 gkey)*/ * from t6 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t6 gkey)*/ * from t6 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t6(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
sort_keys([t6.a, ASC], [t6.b, ASC], [t6.c, ASC], [t6.d, ASC])
1 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
access([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t6.b], [t6.c], [t6.d], [t6.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t6.c, t6.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t6 gkey)*/ * from t6 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t6 gkey)*/ * from t6 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |433 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t6(gkey)|5 |432 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
sort_keys([t6.a, ASC], [t6.b, ASC], [t6.c, ASC], [t6.d, ASC])
1 - output([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), filter(nil), rowset=16
access([t6.a], [t6.b], [t6.c], [t6.d], [t6.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t6.b], [t6.c], [t6.d], [t6.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t6.c, t6.d, t6.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t6 gkey)*/ * from t6 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t7 gkey)*/ * from t7 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t7(gkey)|5 |185 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
sort_keys([t7.a, ASC], [t7.b, ASC], [t7.c, ASC], [t7.d, ASC])
1 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter([t7.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t7.b], [t7.c], [t7.d], [t7.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t7 gkey)*/ * from t7 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t7 gkey)*/ * from t7 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t7(gkey)|5 |269 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
sort_keys([t7.a, ASC], [t7.b, ASC], [t7.c, ASC], [t7.d, ASC])
1 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
access([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t7.b], [t7.c], [t7.d], [t7.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t7.b IN (1, 2, 3, 4, 5)])
select /*+index(t7 gkey)*/ * from t7 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t7 gkey)*/ * from t7 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t7(gkey)|5 |269 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
sort_keys([t7.a, ASC], [t7.b, ASC], [t7.c, ASC], [t7.d, ASC])
1 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
access([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t7.b], [t7.c], [t7.d], [t7.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t7.c, t7.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t7 gkey)*/ * from t7 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t7 gkey)*/ * from t7 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t7(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
sort_keys([t7.a, ASC], [t7.b, ASC], [t7.c, ASC], [t7.d, ASC])
1 - output([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), filter(nil), rowset=16
access([t7.a], [t7.b], [t7.c], [t7.d], [t7.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t7.b], [t7.c], [t7.d], [t7.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t7.c, t7.d, t7.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t7 gkey)*/ * from t7 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
## 1.3 test range partitioning
EXPLAIN select /*+index(t8 gkey)*/ * from t8 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t8(gkey)|5 |239 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
sort_keys([t8.a, ASC], [t8.b, ASC], [t8.c, ASC], [t8.d, ASC])
1 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter([t8.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t8.b], [t8.c], [t8.d], [t8.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t8 gkey)*/ * from t8 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t8 gkey)*/ * from t8 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t8(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
sort_keys([t8.a, ASC], [t8.b, ASC], [t8.c, ASC], [t8.d, ASC])
1 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
access([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t8.b], [t8.c], [t8.d], [t8.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t8.b IN (1, 2, 3, 4, 5)])
select /*+index(t8 gkey)*/ * from t8 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t8 gkey)*/ * from t8 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t8(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
sort_keys([t8.a, ASC], [t8.b, ASC], [t8.c, ASC], [t8.d, ASC])
1 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
access([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t8.b], [t8.c], [t8.d], [t8.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t8.c, t8.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t8 gkey)*/ * from t8 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t8 gkey)*/ * from t8 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t8(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
sort_keys([t8.a, ASC], [t8.b, ASC], [t8.c, ASC], [t8.d, ASC])
1 - output([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), filter(nil), rowset=16
access([t8.a], [t8.b], [t8.c], [t8.d], [t8.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t8.b], [t8.c], [t8.d], [t8.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t8.c, t8.d, t8.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t8 gkey)*/ * from t8 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t9 gkey)*/ * from t9 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
=================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t9(gkey)|5 |239 |
=================================================================
Outputs & filters:
-------------------------------------
0 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
sort_keys([t9.a, ASC], [t9.b, ASC], [t9.c, ASC], [t9.d, ASC])
1 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter([t9.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t9.b], [t9.c], [t9.d], [t9.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t9 gkey)*/ * from t9 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t9 gkey)*/ * from t9 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t9(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
sort_keys([t9.a, ASC], [t9.b, ASC], [t9.c, ASC], [t9.d, ASC])
1 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
access([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t9.b], [t9.c], [t9.d], [t9.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t9.b IN (1, 2, 3, 4, 5)])
select /*+index(t9 gkey)*/ * from t9 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t9 gkey)*/ * from t9 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t9(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
sort_keys([t9.a, ASC], [t9.b, ASC], [t9.c, ASC], [t9.d, ASC])
1 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
access([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t9.b], [t9.c], [t9.d], [t9.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,MIN
; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t9.c, t9.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t9 gkey)*/ * from t9 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t9 gkey)*/ * from t9 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t9(gkey)|5 |323 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
sort_keys([t9.a, ASC], [t9.b, ASC], [t9.c, ASC], [t9.d, ASC])
1 - output([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), filter(nil), rowset=16
access([t9.a], [t9.b], [t9.c], [t9.d], [t9.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t9.b], [t9.c], [t9.d], [t9.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,MAX),
(5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t9.c, t9.d, t9.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t9 gkey)*/ * from t9 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t10 gkey)*/ * from t10 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t10(gkey)|5 |239 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
sort_keys([t10.a, ASC], [t10.b, ASC], [t10.c, ASC], [t10.d, ASC])
1 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter([t10.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t10.b], [t10.c], [t10.d], [t10.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t10 gkey)*/ * from t10 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t10 gkey)*/ * from t10 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t10(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
sort_keys([t10.a, ASC], [t10.b, ASC], [t10.c, ASC], [t10.d, ASC])
1 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
access([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t10.b], [t10.c], [t10.d], [t10.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t10.b IN (1, 2, 3, 4, 5)])
select /*+index(t10 gkey)*/ * from t10 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t10 gkey)*/ * from t10 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t10(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
sort_keys([t10.a, ASC], [t10.b, ASC], [t10.c, ASC], [t10.d, ASC])
1 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
access([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t10.b], [t10.c], [t10.d], [t10.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t10.c, t10.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t10 gkey)*/ * from t10 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t10 gkey)*/ * from t10 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t10(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
sort_keys([t10.a, ASC], [t10.b, ASC], [t10.c, ASC], [t10.d, ASC])
1 - output([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), filter(nil), rowset=16
access([t10.a], [t10.b], [t10.c], [t10.d], [t10.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t10.b], [t10.c], [t10.d], [t10.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t10.c, t10.d, t10.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t10 gkey)*/ * from t10 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+

View File

@ -0,0 +1,631 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
drop table if exists t11;
create table t11(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range columns(b) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t11(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t12;
create table t12(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range columns(b, c) (
partition p0 values less than (3,3),
partition p1 values less than (5,5),
partition p2 values less than (100,100));
create index gkey on t12(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t13;
create table t13(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range columns(b, c, d) (
partition p0 values less than (3,3,3),
partition p1 values less than (5,5,5),
partition p2 values less than (100,100,100));
create index gkey on t13(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t14;
create table t14(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list(b) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t14(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t14 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t14: ({t14: (t14.a, t14.b, t14.c, t14.d, t14.e)}, {gkey: (t14.b, t14.c, t14.d, t14.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t14 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop table if exists t15;
create table t15(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list(b+1) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t15(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t15 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t15: ({t15: (t15.a, t15.b, t15.c, t15.d, t15.e)}, {gkey: (t15.b, t15.c, t15.d, t15.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t15 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
## 1.4 test range columns partitioning
EXPLAIN select /*+index(t11 gkey)*/ * from t11 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t11(gkey)|5 |239 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
sort_keys([t11.a, ASC], [t11.b, ASC], [t11.c, ASC], [t11.d, ASC])
1 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter([t11.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t11.b], [t11.c], [t11.d], [t11.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t11 gkey)*/ * from t11 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t11 gkey)*/ * from t11 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t11(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
sort_keys([t11.a, ASC], [t11.b, ASC], [t11.c, ASC], [t11.d, ASC])
1 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
access([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t11.b], [t11.c], [t11.d], [t11.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t11.b IN (1, 2, 3, 4, 5)])
select /*+index(t11 gkey)*/ * from t11 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t11 gkey)*/ * from t11 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t11(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
sort_keys([t11.a, ASC], [t11.b, ASC], [t11.c, ASC], [t11.d, ASC])
1 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
access([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t11.b], [t11.c], [t11.d], [t11.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t11.c, t11.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t11 gkey)*/ * from t11 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t11 gkey)*/ * from t11 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t11(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
sort_keys([t11.a, ASC], [t11.b, ASC], [t11.c, ASC], [t11.d, ASC])
1 - output([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), filter(nil), rowset=16
access([t11.a], [t11.b], [t11.c], [t11.d], [t11.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t11.b], [t11.c], [t11.d], [t11.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t11.c, t11.d, t11.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t11 gkey)*/ * from t11 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t12 gkey)*/ * from t12 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t12(gkey)|5 |239 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
sort_keys([t12.a, ASC], [t12.b, ASC], [t12.c, ASC], [t12.d, ASC])
1 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter([t12.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t12.b], [t12.c], [t12.d], [t12.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t12 gkey)*/ * from t12 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t12 gkey)*/ * from t12 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t12(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
sort_keys([t12.a, ASC], [t12.b, ASC], [t12.c, ASC], [t12.d, ASC])
1 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
access([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t12.b], [t12.c], [t12.d], [t12.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t12.b IN (1, 2, 3, 4, 5)])
select /*+index(t12 gkey)*/ * from t12 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t12 gkey)*/ * from t12 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t12(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
sort_keys([t12.a, ASC], [t12.b, ASC], [t12.c, ASC], [t12.d, ASC])
1 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
access([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t12.b], [t12.c], [t12.d], [t12.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t12.c, t12.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t12 gkey)*/ * from t12 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t12 gkey)*/ * from t12 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t12(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
sort_keys([t12.a, ASC], [t12.b, ASC], [t12.c, ASC], [t12.d, ASC])
1 - output([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), filter(nil), rowset=16
access([t12.a], [t12.b], [t12.c], [t12.d], [t12.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t12.b], [t12.c], [t12.d], [t12.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t12.c, t12.d, t12.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t12 gkey)*/ * from t12 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t13 gkey)*/ * from t13 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t13(gkey)|5 |239 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
sort_keys([t13.a, ASC], [t13.b, ASC], [t13.c, ASC], [t13.d, ASC])
1 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter([t13.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t13.b], [t13.c], [t13.d], [t13.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t13 gkey)*/ * from t13 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t13 gkey)*/ * from t13 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t13(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
sort_keys([t13.a, ASC], [t13.b, ASC], [t13.c, ASC], [t13.d, ASC])
1 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
access([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t13.b], [t13.c], [t13.d], [t13.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t13.b IN (1, 2, 3, 4, 5)])
select /*+index(t13 gkey)*/ * from t13 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t13 gkey)*/ * from t13 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t13(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
sort_keys([t13.a, ASC], [t13.b, ASC], [t13.c, ASC], [t13.d, ASC])
1 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
access([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t13.b], [t13.c], [t13.d], [t13.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t13.c, t13.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t13 gkey)*/ * from t13 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t13 gkey)*/ * from t13 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t13(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
sort_keys([t13.a, ASC], [t13.b, ASC], [t13.c, ASC], [t13.d, ASC])
1 - output([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), filter(nil), rowset=16
access([t13.a], [t13.b], [t13.c], [t13.d], [t13.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t13.b], [t13.c], [t13.d], [t13.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t13.c, t13.d, t13.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t13 gkey)*/ * from t13 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
## 1.5 test list partitioning
EXPLAIN select /*+index(t14 gkey)*/ * from t14 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t14(gkey)|5 |239 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
sort_keys([t14.a, ASC], [t14.b, ASC], [t14.c, ASC], [t14.d, ASC])
1 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter([t14.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t14.b], [t14.c], [t14.d], [t14.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t14 gkey)*/ * from t14 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t14 gkey)*/ * from t14 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t14(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
sort_keys([t14.a, ASC], [t14.b, ASC], [t14.c, ASC], [t14.d, ASC])
1 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
access([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t14.b], [t14.c], [t14.d], [t14.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t14.b IN (1, 2, 3, 4, 5)])
select /*+index(t14 gkey)*/ * from t14 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t14 gkey)*/ * from t14 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t14(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
sort_keys([t14.a, ASC], [t14.b, ASC], [t14.c, ASC], [t14.d, ASC])
1 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
access([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t14.b], [t14.c], [t14.d], [t14.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t14.c, t14.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t14 gkey)*/ * from t14 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t14 gkey)*/ * from t14 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t14(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
sort_keys([t14.a, ASC], [t14.b, ASC], [t14.c, ASC], [t14.d, ASC])
1 - output([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), filter(nil), rowset=16
access([t14.a], [t14.b], [t14.c], [t14.d], [t14.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t14.b], [t14.c], [t14.d], [t14.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t14.c, t14.d, t14.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t14 gkey)*/ * from t14 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t15 gkey)*/ * from t15 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |240 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t15(gkey)|5 |239 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
sort_keys([t15.a, ASC], [t15.b, ASC], [t15.c, ASC], [t15.d, ASC])
1 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter([t15.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t15.b], [t15.c], [t15.d], [t15.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t15 gkey)*/ * from t15 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t15 gkey)*/ * from t15 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t15(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
sort_keys([t15.a, ASC], [t15.b, ASC], [t15.c, ASC], [t15.d, ASC])
1 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
access([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t15.b], [t15.c], [t15.d], [t15.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t15.b IN (1, 2, 3, 4, 5)])
select /*+index(t15 gkey)*/ * from t15 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t15 gkey)*/ * from t15 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t15(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
sort_keys([t15.a, ASC], [t15.b, ASC], [t15.c, ASC], [t15.d, ASC])
1 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
access([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t15.b], [t15.c], [t15.d], [t15.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t15.c, t15.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t15 gkey)*/ * from t15 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t15 gkey)*/ * from t15 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t15(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
sort_keys([t15.a, ASC], [t15.b, ASC], [t15.c, ASC], [t15.d, ASC])
1 - output([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), filter(nil), rowset=16
access([t15.a], [t15.b], [t15.c], [t15.d], [t15.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t15.b], [t15.c], [t15.d], [t15.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t15.c, t15.d, t15.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t15 gkey)*/ * from t15 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+

View File

@ -0,0 +1,114 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
drop table if exists t16;
create table t16(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list(b+c) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t16(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t16 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t16: ({t16: (t16.a, t16.b, t16.c, t16.d, t16.e)}, {gkey: (t16.b, t16.c, t16.d, t16.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t16 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop table if exists t17;
create table t17(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list columns(b) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t17(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t17 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t17: ({t17: (t17.a, t17.b, t17.c, t17.d, t17.e)}, {gkey: (t17.b, t17.c, t17.d, t17.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t17 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop table if exists t18;
create table t18(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list columns(b,c) (
partition p0 values in ((1,1),(2,2),(3,3)),
partition p1 values in ((5,5),(9,9)),
partition p2 values in (default));
create index gkey on t18(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t18 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t18: ({t18: (t18.a, t18.b, t18.c, t18.d, t18.e)}, {gkey: (t18.b, t18.c, t18.d, t18.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t18 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop table if exists t19;
create table t19(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list columns(b,c,d) (
partition p0 values in ((1,1,1)),
partition p1 values in ((5,5,5)),
partition p2 values in (default));
create index gkey on t19(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t19 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t19: ({t19: (t19.a, t19.b, t19.c, t19.d, t19.e)}, {gkey: (t19.b, t19.c, t19.d, t19.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t19 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop database if exists muhangtest1;
create database muhangtest1;
use muhangtest1;
drop table if exists t20;
create table t20(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b)
subpartition by range columns(c)
subpartition template (
subpartition p0 values less than (5),
subpartition p1 values less than (100)) partitions 2;
create index gkey on t20(b,c,d) global partition by hash(b) partitions 5;

View File

@ -0,0 +1,671 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
drop table if exists t21;
create table t21(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b)
subpartition by range columns(c,d)
subpartition template (
subpartition p0 values less than (5,5),
subpartition p1 values less than (100,100)) partitions 2;
create index gkey on t21(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t22;
create table t22(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by range columns(b) subpartition by hash(c) subpartitions 2 (
partition p0 values less than (5),
partition p1 values less than (maxvalue)
);
create index gkey on t22(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t23;
Warnings:
Note 1051 Unknown table 'muhangtest.t23'
create table t23(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by range columns(b,d) subpartition by hash(c) subpartitions 2 (
partition p0 values less than (5,5),
partition p1 values less than (maxvalue,maxvalue)
);
create index gkey on t23(b,c,d) global partition by hash(b) partitions 5;
drop table if exists t24;
create table t24(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b)
subpartition by list columns(c)
subpartition template (
subpartition p0 values in (1,2,3,4),
subpartition p1 values in (default)) partitions 2;
create index gkey on t24(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t24 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t24: ({t24: (t24.a, t24.b, t24.c, t24.d, t24.e)}, {gkey: (t24.b, t24.c, t24.d, t24.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t24 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop table if exists t25;
create table t25(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by hash(b)
subpartition by list columns(c,d)
subpartition template (
subpartition p0 values in ((1,1),(2,2),(3,3),(4,4)),
subpartition p1 values in (default)) partitions 2;
create index gkey on t25(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t25 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t25: ({t25: (t25.a, t25.b, t25.c, t25.d, t25.e)}, {gkey: (t25.b, t25.c, t25.d, t25.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t25 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
EXPLAIN select /*+index(t21 gkey)*/ * from t21 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t21(gkey)|5 |185 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
sort_keys([t21.a, ASC], [t21.b, ASC], [t21.c, ASC], [t21.d, ASC])
1 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter([t21.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t21.b], [t21.c], [t21.d], [t21.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t21 gkey)*/ * from t21 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t21 gkey)*/ * from t21 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t21(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
sort_keys([t21.a, ASC], [t21.b, ASC], [t21.c, ASC], [t21.d, ASC])
1 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
access([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t21.b], [t21.c], [t21.d], [t21.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t21.b IN (1, 2, 3, 4, 5)])
select /*+index(t21 gkey)*/ * from t21 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t21 gkey)*/ * from t21 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t21(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
sort_keys([t21.a, ASC], [t21.b, ASC], [t21.c, ASC], [t21.d, ASC])
1 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
access([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t21.b], [t21.c], [t21.d], [t21.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t21.c, t21.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t21 gkey)*/ * from t21 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t21 gkey)*/ * from t21 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t21(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
sort_keys([t21.a, ASC], [t21.b, ASC], [t21.c, ASC], [t21.d, ASC])
1 - output([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), filter(nil), rowset=16
access([t21.a], [t21.b], [t21.c], [t21.d], [t21.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t21.b], [t21.c], [t21.d], [t21.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t21.c, t21.d, t21.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t21 gkey)*/ * from t21 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
### test range columns partitioning followed by hash partitioning
EXPLAIN select /*+index(t22 gkey)*/ * from t22 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t22(gkey)|5 |185 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
sort_keys([t22.a, ASC], [t22.b, ASC], [t22.c, ASC], [t22.d, ASC])
1 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter([t22.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t22.b], [t22.c], [t22.d], [t22.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t22 gkey)*/ * from t22 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t22 gkey)*/ * from t22 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t22(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
sort_keys([t22.a, ASC], [t22.b, ASC], [t22.c, ASC], [t22.d, ASC])
1 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
access([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t22.b], [t22.c], [t22.d], [t22.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t22.b IN (1, 2, 3, 4, 5)])
select /*+index(t22 gkey)*/ * from t22 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t22 gkey)*/ * from t22 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t22(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
sort_keys([t22.a, ASC], [t22.b, ASC], [t22.c, ASC], [t22.d, ASC])
1 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
access([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t22.b], [t22.c], [t22.d], [t22.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t22.c, t22.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t22 gkey)*/ * from t22 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t22 gkey)*/ * from t22 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t22(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
sort_keys([t22.a, ASC], [t22.b, ASC], [t22.c, ASC], [t22.d, ASC])
1 - output([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), filter(nil), rowset=16
access([t22.a], [t22.b], [t22.c], [t22.d], [t22.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t22.b], [t22.c], [t22.d], [t22.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t22.c, t22.d, t22.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t22 gkey)*/ * from t22 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t23 gkey)*/ * from t23 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t23(gkey)|5 |185 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
sort_keys([t23.a, ASC], [t23.b, ASC], [t23.c, ASC], [t23.d, ASC])
1 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter([t23.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t23.b], [t23.c], [t23.d], [t23.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t23 gkey)*/ * from t23 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t23 gkey)*/ * from t23 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t23(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
sort_keys([t23.a, ASC], [t23.b, ASC], [t23.c, ASC], [t23.d, ASC])
1 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
access([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t23.b], [t23.c], [t23.d], [t23.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t23.b IN (1, 2, 3, 4, 5)])
select /*+index(t23 gkey)*/ * from t23 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t23 gkey)*/ * from t23 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t23(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
sort_keys([t23.a, ASC], [t23.b, ASC], [t23.c, ASC], [t23.d, ASC])
1 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
access([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t23.b], [t23.c], [t23.d], [t23.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t23.c, t23.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t23 gkey)*/ * from t23 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t23 gkey)*/ * from t23 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t23(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
sort_keys([t23.a, ASC], [t23.b, ASC], [t23.c, ASC], [t23.d, ASC])
1 - output([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), filter(nil), rowset=16
access([t23.a], [t23.b], [t23.c], [t23.d], [t23.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t23.b], [t23.c], [t23.d], [t23.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t23.c, t23.d, t23.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t23 gkey)*/ * from t23 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t24 gkey)*/ * from t24 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t24(gkey)|5 |185 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
sort_keys([t24.a, ASC], [t24.b, ASC], [t24.c, ASC], [t24.d, ASC])
1 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter([t24.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t24.b], [t24.c], [t24.d], [t24.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t24 gkey)*/ * from t24 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t24 gkey)*/ * from t24 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t24(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
sort_keys([t24.a, ASC], [t24.b, ASC], [t24.c, ASC], [t24.d, ASC])
1 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
access([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t24.b], [t24.c], [t24.d], [t24.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t24.b IN (1, 2, 3, 4, 5)])
select /*+index(t24 gkey)*/ * from t24 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t24 gkey)*/ * from t24 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t24(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
sort_keys([t24.a, ASC], [t24.b, ASC], [t24.c, ASC], [t24.d, ASC])
1 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
access([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t24.b], [t24.c], [t24.d], [t24.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t24.c, t24.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t24 gkey)*/ * from t24 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t24 gkey)*/ * from t24 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |324 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t24(gkey)|5 |323 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
sort_keys([t24.a, ASC], [t24.b, ASC], [t24.c, ASC], [t24.d, ASC])
1 - output([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), filter(nil), rowset=16
access([t24.a], [t24.b], [t24.c], [t24.d], [t24.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t24.b], [t24.c], [t24.d], [t24.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t24.c, t24.d, t24.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t24 gkey)*/ * from t24 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t25 gkey)*/ * from t25 where a in (1,2,3,4,5) order by a,b,c,d;
Query Plan
==================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------
|0 |SORT | |5 |186 |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t25(gkey)|5 |185 |
==================================================================
Outputs & filters:
-------------------------------------
0 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
sort_keys([t25.a, ASC], [t25.b, ASC], [t25.c, ASC], [t25.d, ASC])
1 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter([t25.a IN (1, 2, 3, 4, 5)]), rowset=16
access([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true, filter_before_indexback[true],
range_key([t25.b], [t25.c], [t25.d], [t25.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t25 gkey)*/ * from t25 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t25 gkey)*/ * from t25 where b in (1,2,3,4,5) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t25(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
sort_keys([t25.a, ASC], [t25.b, ASC], [t25.c, ASC], [t25.d, ASC])
1 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
access([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t25.b], [t25.c], [t25.d], [t25.a]), range(1,MIN,MIN,MIN ; 1,MAX,MAX,MAX), (2,MIN,MIN,MIN ; 2,MAX,MAX,MAX), (3,MIN,MIN,MIN ; 3,MAX,MAX,MAX),
(4,MIN,MIN,MIN ; 4,MAX,MAX,MAX), (5,MIN,MIN,MIN ; 5,MAX,MAX,MAX),
range_cond([t25.b IN (1, 2, 3, 4, 5)])
select /*+index(t25 gkey)*/ * from t25 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t25 gkey)*/ * from t25 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t25(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
sort_keys([t25.a, ASC], [t25.b, ASC], [t25.c, ASC], [t25.d, ASC])
1 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
access([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t25.b], [t25.c], [t25.d], [t25.a]), range(1,1,MIN,MIN ; 1,1,MAX,MAX), (2,2,MIN,MIN ; 2,2,MAX,MAX), (3,3,MIN,MIN ; 3,3,MAX,MAX), (4,4,MIN,
MIN ; 4,4,MAX,MAX), (5,5,MIN,MIN ; 5,5,MAX,MAX),
range_cond([(t25.c, t25.b) IN ((1, 1), (2, 2), (3, 3), (4, 4), (5, 5))])
select /*+index(t25 gkey)*/ * from t25 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
EXPLAIN select /*+index(t25 gkey)*/ * from t25 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
Query Plan
===================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------
|0 |SORT | |5 |270 |
|1 |└─DISTRIBUTED TABLE RANGE SCAN|t25(gkey)|5 |269 |
===================================================================
Outputs & filters:
-------------------------------------
0 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
sort_keys([t25.a, ASC], [t25.b, ASC], [t25.c, ASC], [t25.d, ASC])
1 - output([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), filter(nil), rowset=16
access([t25.a], [t25.b], [t25.c], [t25.d], [t25.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t25.b], [t25.c], [t25.d], [t25.a]), range(1,1,1,MIN ; 1,1,1,MAX), (2,2,2,MIN ; 2,2,2,MAX), (3,3,3,MIN ; 3,3,3,MAX), (4,4,4,MIN ; 4,4,4,
MAX), (5,5,5,MIN ; 5,5,5,MAX),
range_cond([(t25.c, t25.d, t25.b) IN ((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5))])
select /*+index(t25 gkey)*/ * from t25 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
drop table if exists t26;
drop table if exists t27;
drop function if exists n_1;
create table t26(c1 int , c2 int , c3 int);
create index gkey on t26(c1) global partition by hash(c1) partitions 5;
EXPLAIN insert into t26 values(1,1,1),(2,2,2),(3,3,3),(999,999,999),(1111,1111,1111);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |5 |45 |
|1 |└─EXPRESSION | |5 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t26: ({t26: (t26.__pk_increment, t26.c1, t26.c2, t26.c3)}, {gkey: (t26.c1, t26.__pk_increment)})}]),
column_values([T_HIDDEN_PK], [column_conv(INT,PS:(11,0),NULL,__values.c1)], [column_conv(INT,PS:(11,0),NULL,__values.c2)], [column_conv(INT,PS:(11,
0),NULL,__values.c3)])
1 - output([__values.c1], [__values.c2], [__values.c3]), filter(nil)
values({1, 1, 1}, {2, 2, 2}, {3, 3, 3}, {999, 999, 999}, {1111, 1111, 1111})
insert into t26 values(1,1,1),(2,2,2),(3,3,3),(999,999,999),(1111,1111,1111);
create table t27(c1 int ,c2 int, c3 int);
create function n_1() returns int not deterministic
begin
insert into t27 values(1,0,1);
return 1;
end/
select/*+ index(t26 gkey) */ * from t26 where c2=n_1();
+------+------+------+
| c1 | c2 | c3 |
+------+------+------+
| 1 | 1 | 1 |
+------+------+------+

View File

@ -0,0 +1,553 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
drop table if exists t26;
create table t26(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by list columns(b) subpartition by hash(c) subpartitions 2 (
partition p0 values in (1,2,3,4),
partition p1 values in (default)
);
create index gkey on t26(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t26 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t26: ({t26: (t26.a, t26.b, t26.c, t26.d, t26.e)}, {gkey: (t26.b, t26.c, t26.d, t26.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t26 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
drop table if exists t27;
Warnings:
Note 1051 Unknown table 'muhangtest.t27'
create table t27(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by list columns(b,d) subpartition by hash(c) subpartitions 2 (
partition p0 values in ((1,1),(2,2),(3,3),(4,4)),
partition p1 values in (default)
);
create index gkey on t27(b,c,d) global partition by hash(b) partitions 5;
EXPLAIN insert into t27 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
Query Plan
==================================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
--------------------------------------------------
|0 |DISTRIBUTED INSERT| |10 |77 |
|1 |└─EXPRESSION | |10 |1 |
==================================================
Outputs & filters:
-------------------------------------
0 - output(nil), filter(nil)
columns([{t27: ({t27: (t27.a, t27.b, t27.c, t27.d, t27.e)}, {gkey: (t27.b, t27.c, t27.d, t27.a)})}]),
column_values([column_conv(INT,PS:(11,0),NOT NULL,__values.a)], [column_conv(INT,PS:(11,0),NOT NULL,__values.b)], [column_conv(INT,PS:(11,0),NOT NULL,
__values.c)], [column_conv(INT,PS:(11,0),NOT NULL,__values.d)], [column_conv(INT,PS:(11,0),NULL,__values.e)])
1 - output([__values.a], [__values.b], [__values.c], [__values.d], [__values.e]), filter(nil)
values({1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}, {6, 6, 6, 6, 6}, {7, 7, 7, 7, 7}, {8, 8, 8, 8, 8}, {9,
9, 9, 9, 9}, {10, 10, 10, 10, 10})
insert into t27 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
set autocommit=1;
drop table if exists t28;
create table t28(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b) partitions 2;
create index gkey on t28(b,c,d) global partition by hash(b) partitions 5;
explain_protocol: 0
use muhangtest;
select /*+index(t26 gkey)*/ * from t26 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t26 gkey)*/ * from t26 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t26 gkey)*/ * from t26 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t26 gkey)*/ * from t26 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t27 gkey)*/ * from t27 where a in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t27 gkey)*/ * from t27 where b in (1,2,3,4,5) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t27 gkey)*/ * from t27 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
select /*+index(t27 gkey)*/ * from t27 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
+---+---+---+---+------+
| a | b | c | d | e |
+---+---+---+---+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
+---+---+---+---+------+
## part two
explain basic select /*+index(t28 gkey)*/ * from t28 order by a,b;
Query Plan
============================================
|ID|OPERATOR |NAME |
--------------------------------------------
|0 |SORT | |
|1 |└─DISTRIBUTED TABLE FULL SCAN|t28(gkey)|
============================================
Outputs & filters:
-------------------------------------
0 - output([t28.a], [t28.b], [t28.c], [t28.d], [t28.e]), filter(nil), rowset=256
sort_keys([t28.a, ASC], [t28.b, ASC])
1 - output([t28.a], [t28.b], [t28.c], [t28.d], [t28.e]), filter(nil), rowset=256
access([t28.a], [t28.b], [t28.c], [t28.d], [t28.e]), partitions(p[0-4])
is_index_back=true, is_global_index=true,
range_key([t28.b], [t28.c], [t28.d], [t28.a]), range(MIN,MIN,MIN,MIN ; MAX,MAX,MAX,MAX)always true
select /*+index(t28 gkey)*/ * from t28 order by a,b;
+-----+-----+-----+-----+------+
| a | b | c | d | e |
+-----+-----+-----+-----+------+
| 1 | 1 | 1 | 1 | 1 |
| 2 | 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 | 3 |
| 4 | 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 | 5 |
| 6 | 6 | 6 | 6 | 6 |
| 7 | 7 | 7 | 7 | 7 |
| 8 | 8 | 8 | 8 | 8 |
| 9 | 9 | 9 | 9 | 9 |
| 10 | 10 | 10 | 10 | 10 |
| 11 | 11 | 11 | 11 | 11 |
| 12 | 12 | 12 | 12 | 12 |
| 13 | 13 | 13 | 13 | 13 |
| 14 | 14 | 14 | 14 | 14 |
| 15 | 15 | 15 | 15 | 15 |
| 16 | 16 | 16 | 16 | 16 |
| 17 | 17 | 17 | 17 | 17 |
| 18 | 18 | 18 | 18 | 18 |
| 19 | 19 | 19 | 19 | 19 |
| 20 | 20 | 20 | 20 | 20 |
| 21 | 21 | 21 | 21 | 21 |
| 22 | 22 | 22 | 22 | 22 |
| 23 | 23 | 23 | 23 | 23 |
| 24 | 24 | 24 | 24 | 24 |
| 25 | 25 | 25 | 25 | 25 |
| 26 | 26 | 26 | 26 | 26 |
| 27 | 27 | 27 | 27 | 27 |
| 28 | 28 | 28 | 28 | 28 |
| 29 | 29 | 29 | 29 | 29 |
| 30 | 30 | 30 | 30 | 30 |
| 31 | 31 | 31 | 31 | 31 |
| 32 | 32 | 32 | 32 | 32 |
| 33 | 33 | 33 | 33 | 33 |
| 34 | 34 | 34 | 34 | 34 |
| 35 | 35 | 35 | 35 | 35 |
| 36 | 36 | 36 | 36 | 36 |
| 37 | 37 | 37 | 37 | 37 |
| 38 | 38 | 38 | 38 | 38 |
| 39 | 39 | 39 | 39 | 39 |
| 40 | 40 | 40 | 40 | 40 |
| 41 | 41 | 41 | 41 | 41 |
| 42 | 42 | 42 | 42 | 42 |
| 43 | 43 | 43 | 43 | 43 |
| 44 | 44 | 44 | 44 | 44 |
| 45 | 45 | 45 | 45 | 45 |
| 46 | 46 | 46 | 46 | 46 |
| 47 | 47 | 47 | 47 | 47 |
| 48 | 48 | 48 | 48 | 48 |
| 49 | 49 | 49 | 49 | 49 |
| 50 | 50 | 50 | 50 | 50 |
| 51 | 51 | 51 | 51 | 51 |
| 52 | 52 | 52 | 52 | 52 |
| 53 | 53 | 53 | 53 | 53 |
| 54 | 54 | 54 | 54 | 54 |
| 55 | 55 | 55 | 55 | 55 |
| 56 | 56 | 56 | 56 | 56 |
| 57 | 57 | 57 | 57 | 57 |
| 58 | 58 | 58 | 58 | 58 |
| 59 | 59 | 59 | 59 | 59 |
| 60 | 60 | 60 | 60 | 60 |
| 61 | 61 | 61 | 61 | 61 |
| 62 | 62 | 62 | 62 | 62 |
| 63 | 63 | 63 | 63 | 63 |
| 64 | 64 | 64 | 64 | 64 |
| 65 | 65 | 65 | 65 | 65 |
| 66 | 66 | 66 | 66 | 66 |
| 67 | 67 | 67 | 67 | 67 |
| 68 | 68 | 68 | 68 | 68 |
| 69 | 69 | 69 | 69 | 69 |
| 70 | 70 | 70 | 70 | 70 |
| 71 | 71 | 71 | 71 | 71 |
| 72 | 72 | 72 | 72 | 72 |
| 73 | 73 | 73 | 73 | 73 |
| 74 | 74 | 74 | 74 | 74 |
| 75 | 75 | 75 | 75 | 75 |
| 76 | 76 | 76 | 76 | 76 |
| 77 | 77 | 77 | 77 | 77 |
| 78 | 78 | 78 | 78 | 78 |
| 79 | 79 | 79 | 79 | 79 |
| 80 | 80 | 80 | 80 | 80 |
| 81 | 81 | 81 | 81 | 81 |
| 82 | 82 | 82 | 82 | 82 |
| 83 | 83 | 83 | 83 | 83 |
| 84 | 84 | 84 | 84 | 84 |
| 85 | 85 | 85 | 85 | 85 |
| 86 | 86 | 86 | 86 | 86 |
| 87 | 87 | 87 | 87 | 87 |
| 88 | 88 | 88 | 88 | 88 |
| 89 | 89 | 89 | 89 | 89 |
| 90 | 90 | 90 | 90 | 90 |
| 91 | 91 | 91 | 91 | 91 |
| 92 | 92 | 92 | 92 | 92 |
| 93 | 93 | 93 | 93 | 93 |
| 94 | 94 | 94 | 94 | 94 |
| 95 | 95 | 95 | 95 | 95 |
| 96 | 96 | 96 | 96 | 96 |
| 97 | 97 | 97 | 97 | 97 |
| 98 | 98 | 98 | 98 | 98 |
| 99 | 99 | 99 | 99 | 99 |
| 100 | 100 | 100 | 100 | 100 |
| 101 | 101 | 101 | 101 | 101 |
| 102 | 102 | 102 | 102 | 102 |
| 103 | 103 | 103 | 103 | 103 |
| 104 | 104 | 104 | 104 | 104 |
| 105 | 105 | 105 | 105 | 105 |
| 106 | 106 | 106 | 106 | 106 |
| 107 | 107 | 107 | 107 | 107 |
| 108 | 108 | 108 | 108 | 108 |
| 109 | 109 | 109 | 109 | 109 |
| 110 | 110 | 110 | 110 | 110 |
| 111 | 111 | 111 | 111 | 111 |
| 112 | 112 | 112 | 112 | 112 |
| 113 | 113 | 113 | 113 | 113 |
| 114 | 114 | 114 | 114 | 114 |
| 115 | 115 | 115 | 115 | 115 |
| 116 | 116 | 116 | 116 | 116 |
| 117 | 117 | 117 | 117 | 117 |
| 118 | 118 | 118 | 118 | 118 |
| 119 | 119 | 119 | 119 | 119 |
| 120 | 120 | 120 | 120 | 120 |
| 121 | 121 | 121 | 121 | 121 |
| 122 | 122 | 122 | 122 | 122 |
| 123 | 123 | 123 | 123 | 123 |
| 124 | 124 | 124 | 124 | 124 |
| 125 | 125 | 125 | 125 | 125 |
| 126 | 126 | 126 | 126 | 126 |
| 127 | 127 | 127 | 127 | 127 |
| 128 | 128 | 128 | 128 | 128 |
| 129 | 129 | 129 | 129 | 129 |
| 130 | 130 | 130 | 130 | 130 |
| 131 | 131 | 131 | 131 | 131 |
| 132 | 132 | 132 | 132 | 132 |
| 133 | 133 | 133 | 133 | 133 |
| 134 | 134 | 134 | 134 | 134 |
| 135 | 135 | 135 | 135 | 135 |
| 136 | 136 | 136 | 136 | 136 |
| 137 | 137 | 137 | 137 | 137 |
| 138 | 138 | 138 | 138 | 138 |
| 139 | 139 | 139 | 139 | 139 |
| 140 | 140 | 140 | 140 | 140 |
| 141 | 141 | 141 | 141 | 141 |
| 142 | 142 | 142 | 142 | 142 |
| 143 | 143 | 143 | 143 | 143 |
| 144 | 144 | 144 | 144 | 144 |
| 145 | 145 | 145 | 145 | 145 |
| 146 | 146 | 146 | 146 | 146 |
| 147 | 147 | 147 | 147 | 147 |
| 148 | 148 | 148 | 148 | 148 |
| 149 | 149 | 149 | 149 | 149 |
| 150 | 150 | 150 | 150 | 150 |
| 151 | 151 | 151 | 151 | 151 |
| 152 | 152 | 152 | 152 | 152 |
| 153 | 153 | 153 | 153 | 153 |
| 154 | 154 | 154 | 154 | 154 |
| 155 | 155 | 155 | 155 | 155 |
| 156 | 156 | 156 | 156 | 156 |
| 157 | 157 | 157 | 157 | 157 |
| 158 | 158 | 158 | 158 | 158 |
| 159 | 159 | 159 | 159 | 159 |
| 160 | 160 | 160 | 160 | 160 |
| 161 | 161 | 161 | 161 | 161 |
| 162 | 162 | 162 | 162 | 162 |
| 163 | 163 | 163 | 163 | 163 |
| 164 | 164 | 164 | 164 | 164 |
| 165 | 165 | 165 | 165 | 165 |
| 166 | 166 | 166 | 166 | 166 |
| 167 | 167 | 167 | 167 | 167 |
| 168 | 168 | 168 | 168 | 168 |
| 169 | 169 | 169 | 169 | 169 |
| 170 | 170 | 170 | 170 | 170 |
| 171 | 171 | 171 | 171 | 171 |
| 172 | 172 | 172 | 172 | 172 |
| 173 | 173 | 173 | 173 | 173 |
| 174 | 174 | 174 | 174 | 174 |
| 175 | 175 | 175 | 175 | 175 |
| 176 | 176 | 176 | 176 | 176 |
| 177 | 177 | 177 | 177 | 177 |
| 178 | 178 | 178 | 178 | 178 |
| 179 | 179 | 179 | 179 | 179 |
| 180 | 180 | 180 | 180 | 180 |
| 181 | 181 | 181 | 181 | 181 |
| 182 | 182 | 182 | 182 | 182 |
| 183 | 183 | 183 | 183 | 183 |
| 184 | 184 | 184 | 184 | 184 |
| 185 | 185 | 185 | 185 | 185 |
| 186 | 186 | 186 | 186 | 186 |
| 187 | 187 | 187 | 187 | 187 |
| 188 | 188 | 188 | 188 | 188 |
| 189 | 189 | 189 | 189 | 189 |
| 190 | 190 | 190 | 190 | 190 |
| 191 | 191 | 191 | 191 | 191 |
| 192 | 192 | 192 | 192 | 192 |
| 193 | 193 | 193 | 193 | 193 |
| 194 | 194 | 194 | 194 | 194 |
| 195 | 195 | 195 | 195 | 195 |
| 196 | 196 | 196 | 196 | 196 |
| 197 | 197 | 197 | 197 | 197 |
| 198 | 198 | 198 | 198 | 198 |
| 199 | 199 | 199 | 199 | 199 |
| 200 | 200 | 200 | 200 | 200 |
| 201 | 201 | 201 | 201 | 201 |
| 202 | 202 | 202 | 202 | 202 |
| 203 | 203 | 203 | 203 | 203 |
| 204 | 204 | 204 | 204 | 204 |
| 205 | 205 | 205 | 205 | 205 |
| 206 | 206 | 206 | 206 | 206 |
| 207 | 207 | 207 | 207 | 207 |
| 208 | 208 | 208 | 208 | 208 |
| 209 | 209 | 209 | 209 | 209 |
| 210 | 210 | 210 | 210 | 210 |
| 211 | 211 | 211 | 211 | 211 |
| 212 | 212 | 212 | 212 | 212 |
| 213 | 213 | 213 | 213 | 213 |
| 214 | 214 | 214 | 214 | 214 |
| 215 | 215 | 215 | 215 | 215 |
| 216 | 216 | 216 | 216 | 216 |
| 217 | 217 | 217 | 217 | 217 |
| 218 | 218 | 218 | 218 | 218 |
| 219 | 219 | 219 | 219 | 219 |
| 220 | 220 | 220 | 220 | 220 |
| 221 | 221 | 221 | 221 | 221 |
| 222 | 222 | 222 | 222 | 222 |
| 223 | 223 | 223 | 223 | 223 |
| 224 | 224 | 224 | 224 | 224 |
| 225 | 225 | 225 | 225 | 225 |
| 226 | 226 | 226 | 226 | 226 |
| 227 | 227 | 227 | 227 | 227 |
| 228 | 228 | 228 | 228 | 228 |
| 229 | 229 | 229 | 229 | 229 |
| 230 | 230 | 230 | 230 | 230 |
| 231 | 231 | 231 | 231 | 231 |
| 232 | 232 | 232 | 232 | 232 |
| 233 | 233 | 233 | 233 | 233 |
| 234 | 234 | 234 | 234 | 234 |
| 235 | 235 | 235 | 235 | 235 |
| 236 | 236 | 236 | 236 | 236 |
| 237 | 237 | 237 | 237 | 237 |
| 238 | 238 | 238 | 238 | 238 |
| 239 | 239 | 239 | 239 | 239 |
| 240 | 240 | 240 | 240 | 240 |
| 241 | 241 | 241 | 241 | 241 |
| 242 | 242 | 242 | 242 | 242 |
| 243 | 243 | 243 | 243 | 243 |
| 244 | 244 | 244 | 244 | 244 |
| 245 | 245 | 245 | 245 | 245 |
| 246 | 246 | 246 | 246 | 246 |
| 247 | 247 | 247 | 247 | 247 |
| 248 | 248 | 248 | 248 | 248 |
| 249 | 249 | 249 | 249 | 249 |
| 250 | 250 | 250 | 250 | 250 |
| 251 | 251 | 251 | 251 | 251 |
| 252 | 252 | 252 | 252 | 252 |
| 253 | 253 | 253 | 253 | 253 |
| 254 | 254 | 254 | 254 | 254 |
| 255 | 255 | 255 | 255 | 255 |
| 256 | 256 | 256 | 256 | 256 |
| 257 | 257 | 257 | 257 | 257 |
| 258 | 258 | 258 | 258 | 258 |
| 259 | 259 | 259 | 259 | 259 |
| 260 | 260 | 260 | 260 | 260 |
| 261 | 261 | 261 | 261 | 261 |
| 262 | 262 | 262 | 262 | 262 |
| 263 | 263 | 263 | 263 | 263 |
| 264 | 264 | 264 | 264 | 264 |
| 265 | 265 | 265 | 265 | 265 |
| 266 | 266 | 266 | 266 | 266 |
| 267 | 267 | 267 | 267 | 267 |
| 268 | 268 | 268 | 268 | 268 |
| 269 | 269 | 269 | 269 | 269 |
| 270 | 270 | 270 | 270 | 270 |
| 271 | 271 | 271 | 271 | 271 |
| 272 | 272 | 272 | 272 | 272 |
| 273 | 273 | 273 | 273 | 273 |
| 274 | 274 | 274 | 274 | 274 |
| 275 | 275 | 275 | 275 | 275 |
| 276 | 276 | 276 | 276 | 276 |
| 277 | 277 | 277 | 277 | 277 |
| 278 | 278 | 278 | 278 | 278 |
| 279 | 279 | 279 | 279 | 279 |
| 280 | 280 | 280 | 280 | 280 |
| 281 | 281 | 281 | 281 | 281 |
| 282 | 282 | 282 | 282 | 282 |
| 283 | 283 | 283 | 283 | 283 |
| 284 | 284 | 284 | 284 | 284 |
| 285 | 285 | 285 | 285 | 285 |
| 286 | 286 | 286 | 286 | 286 |
| 287 | 287 | 287 | 287 | 287 |
| 288 | 288 | 288 | 288 | 288 |
| 289 | 289 | 289 | 289 | 289 |
| 290 | 290 | 290 | 290 | 290 |
| 291 | 291 | 291 | 291 | 291 |
| 292 | 292 | 292 | 292 | 292 |
| 293 | 293 | 293 | 293 | 293 |
| 294 | 294 | 294 | 294 | 294 |
| 295 | 295 | 295 | 295 | 295 |
| 296 | 296 | 296 | 296 | 296 |
| 297 | 297 | 297 | 297 | 297 |
| 298 | 298 | 298 | 298 | 298 |
| 299 | 299 | 299 | 299 | 299 |
| 300 | 300 | 300 | 300 | 300 |
+-----+-----+-----+-----+------+
## part three 生成列 FIXME 生成列也有问题
drop table if exists bmsql_oorder;
drop tablegroup if exists tpcc_group;
CREATE TABLEGROUP IF NOT EXISTS `tpcc_group`;
CREATE TABLE `bmsql_oorder` (
`o_w_id` int(11) NOT NULL,
`o_d_id` int(11) NOT NULL,
`o_id` int(11) NOT NULL,
`o_c_id` int(11) DEFAULT NULL,
`o_carrier_id` int(11) DEFAULT NULL,
`o_ol_cnt` decimal(2,0) DEFAULT NULL,
`o_all_local` decimal(1,0) DEFAULT NULL,
`o_entry_d` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`o_w_id`, `o_d_id`, `o_id`),
KEY `o_w_id` (`o_w_id`, `o_d_id`, `o_c_id`, `o_id`) GLOBAL BLOCK_SIZE 16384,
KEY `o_w_id_2` (`o_w_id`, `o_d_id`, `o_ol_cnt`) GLOBAL BLOCK_SIZE 16384
) DEFAULT CHARSET = utf8mb4 TABLEGROUP = 'tpcc_group'
partition by hash(o_w_id) partitions 2;
insert into bmsql_oorder(o_w_id,o_d_id,o_id,o_c_id,o_carrier_id) values(36,7,1,169,1);
select /*+index(bmsql_oorder o_w_id)*/ o_id, o_entry_d, o_carrier_id FROM bmsql_oorder where o_w_id = 36 AND o_d_id = 7 AND o_c_id = 169 AND o_id = (select max(o_id) FROM bmsql_oorder WHERE o_w_id = 36 AND o_d_id = 7 AND o_c_id = 169);
+------+-----------+--------------+
| o_id | o_entry_d | o_carrier_id |
+------+-----------+--------------+
| 1 | NULL | 1 |
+------+-----------+--------------+
drop table bmsql_oorder;
drop table if exists notify;
CREATE TABLE `notify` (
`id` varchar(68) COLLATE utf8mb4_bin NOT NULL,
`plugin` varchar(100) COLLATE utf8mb4_bin NOT NULL,
`parameter` varchar(8000) COLLATE utf8mb4_bin NOT NULL,
`group_no` bigint(20) NOT NULL,
`status` varchar(2) COLLATE utf8mb4_bin NOT NULL,
`gmt_create` datetime(6) NOT NULL,
`gmt_modify` datetime(6) NOT NULL,
`iw_user_id` varchar(16) COLLATE utf8mb4_bin DEFAULT NULL,
`channel_endpoint` varchar(400) COLLATE utf8mb4_bin DEFAULT NULL,
`business_order` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL,
`business_type` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`plugin_host` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL,
`gmt_local_create` datetime(6) DEFAULT NULL,
`gmt_compensate` datetime(6) DEFAULT NULL,
`partition_id` varchar(2) COLLATE utf8mb4_bin GENERATED ALWAYS AS (substr(`id`,21,2)) VIRTUAL,
PRIMARY KEY (`id`),
KEY `notify_business_order1_ind` (`business_order`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_gmt_compensate_nofity` (`gmt_compensate`) STORING (`status`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_iwuser_gmtc` (`iw_user_id`, `gmt_create`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_gmt_st_pl_iw_gmtm_gn_ce` (`gmt_compensate`, `status`, `plugin`, `iw_user_id`, `gmt_modify`, `channel_endpoint`, `group_no`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_gmt_st_pl_iw_gmtm` (`plugin`, `channel_endpoint`, `gmt_compensate`, `status`, `iw_user_id`, `gmt_modify`, `group_no`) GLOBAL BLOCK_SIZE 16384
) DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin
partition by list columns(partition_id)
(partition p10 values in ('10'),
partition p11 values in ('11'),
partition p12 values in ('12'),
partition p13 values in ('13'),
partition p14 values in ('14'),
partition p15 values in ('15'),
partition p16 values in ('16'),
partition p17 values in ('17'),
partition p18 values in ('18'),
partition p19 values in ('19'),
partition p20 values in ('20'));
insert into notify(id,plugin,parameter,group_no,status,gmt_create,gmt_modify,gmt_compensate) values('2088201800000072862812','aaa','bbb',1,'F',current_timestamp(),current_timestamp(), date_sub(current_timestamp(), INTERVAL 74 MINUTE));
select id, business_order, business_type, plugin_host from notify per where gmt_compensate <= date_sub(current_timestamp(), INTERVAL 74 MINUTE) AND gmt_compensate >= date_sub(current_timestamp(), INTERVAL 75 MINUTE) AND ((status = 'F') ) limit 200;
+------------------------+----------------+---------------+-------------+
| id | business_order | business_type | plugin_host |
+------------------------+----------------+---------------+-------------+
| 2088201800000072862812 | NULL | NULL | NULL |
+------------------------+----------------+---------------+-------------+
select /*+use_px parallel(3)*/ id, business_order, business_type, plugin_host from notify per where gmt_compensate <= date_sub(current_timestamp(), INTERVAL 74 MINUTE) AND gmt_compensate >= date_sub(current_timestamp(), INTERVAL 75 MINUTE) AND ((status = 'F') ) limit 200;
+------------------------+----------------+---------------+-------------+
| id | business_order | business_type | plugin_host |
+------------------------+----------------+---------------+-------------+
| 2088201800000072862812 | NULL | NULL | NULL |
+------------------------+----------------+---------------+-------------+
drop table notify;

View File

@ -0,0 +1,129 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: yuchen.wyc
#owner group: sql1
# tags: optimizer, global_index
--result_format 4
--explain_protocol 2
--disable_warnings
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
--enable_warnings
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b) partitions 2;
create index gkey on t1(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t1 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t2;
--enable_warnings
create table t2(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(c+1) partitions 3;
create index gkey on t2(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t2 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t3;
--enable_warnings
create table t3(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b+c) partitions 4;
create index gkey on t3(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t3 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t4;
--enable_warnings
create table t4(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b+c+d) partitions 5;
create index gkey on t4(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t4 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
## 1.2 test key partition
--disable_warnings
drop table if exists t5;
--enable_warnings
create table t5(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by key(b) partitions 2;
create index gkey on t5(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t5 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
use muhangtest;
## build tables
## part one 测试各种分区方式下,能否正确的将index rowkey发送到正确的主表分区。
## 注意,目前list column分区相关的case插入可能会出现ERROR 6002 (40000): Transaction rollbacked, 这里需要被修复.
## part tow 测试多轮的读取是否会出错
## part three 生成列
## part one
## 1.1 test hash partition
select /*+index(t1 gkey)*/ * from t1 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t1 gkey)*/ * from t1 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t1 gkey)*/ * from t1 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t1 gkey)*/ * from t1 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t2 gkey)*/ * from t2 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t2 gkey)*/ * from t2 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t2 gkey)*/ * from t2 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t2 gkey)*/ * from t2 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t3 gkey)*/ * from t3 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t3 gkey)*/ * from t3 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t3 gkey)*/ * from t3 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t3 gkey)*/ * from t3 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t4 gkey)*/ * from t4 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t4 gkey)*/ * from t4 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t4 gkey)*/ * from t4 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t4 gkey)*/ * from t4 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t5 gkey)*/ * from t5 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t5 gkey)*/ * from t5 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t5 gkey)*/ * from t5 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t5 gkey)*/ * from t5 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
drop table t1;
drop table t2;
create table t1(a int, b int);
create table t2(a int primary key, b int, c int, d int) partition by hash(a) partitions 2;
create index i1 on t2(b) global;
insert into t1 values(1, 1), (2, 2);
insert into t2 values(1, 1, 1, 1), (3, 3, 3, 3);
select /*+no_rewrite, leading(t1)*/ * from t1 where exists (select /*+index(t2 i1)*/ 1 from t2 where t1.b=t2.b and t2.c>0);
drop database muhangtest;

View File

@ -0,0 +1,118 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: yuchen.wyc
#owner group: sql3
# tags: optimizer, global_index
--result_format 4
--explain_protocol 2
--disable_warnings
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
--enable_warnings
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
--disable_warnings
drop table if exists t6;
--enable_warnings
create table t6(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by key(b,c) partitions 3;
create index gkey on t6(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t6 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t7;
--enable_warnings
create table t7(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by key(b,c,d) partitions 4;
create index gkey on t7(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t7 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t8;
--enable_warnings
create table t8(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range(b) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t8(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t8 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t9;
--enable_warnings
create table t9(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range(b+1) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t9(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t9 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t10;
--enable_warnings
create table t10(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range(b+c) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t10(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t10 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
select /*+index(t6 gkey)*/ * from t6 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t6 gkey)*/ * from t6 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t6 gkey)*/ * from t6 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t6 gkey)*/ * from t6 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t7 gkey)*/ * from t7 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t7 gkey)*/ * from t7 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t7 gkey)*/ * from t7 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t7 gkey)*/ * from t7 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
## 1.3 test range partitioning
select /*+index(t8 gkey)*/ * from t8 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t8 gkey)*/ * from t8 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t8 gkey)*/ * from t8 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t8 gkey)*/ * from t8 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t9 gkey)*/ * from t9 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t9 gkey)*/ * from t9 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t9 gkey)*/ * from t9 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t9 gkey)*/ * from t9 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t10 gkey)*/ * from t10 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t10 gkey)*/ * from t10 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t10 gkey)*/ * from t10 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t10 gkey)*/ * from t10 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;

View File

@ -0,0 +1,117 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: yuchen.wyc
#owner group: sql1
# tags: optimizer, global_index
--result_format 4
--explain_protocol 2
--disable_warnings
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
--enable_warnings
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
--disable_warnings
drop table if exists t11;
--enable_warnings
create table t11(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range columns(b) (
partition p0 values less than (3),
partition p1 values less than (5),
partition p2 values less than (100));
create index gkey on t11(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t11 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t12;
--enable_warnings
create table t12(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range columns(b, c) (
partition p0 values less than (3,3),
partition p1 values less than (5,5),
partition p2 values less than (100,100));
create index gkey on t12(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t12 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t13;
--enable_warnings
create table t13(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by range columns(b, c, d) (
partition p0 values less than (3,3,3),
partition p1 values less than (5,5,5),
partition p2 values less than (100,100,100));
create index gkey on t13(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--disable_query_log
--disable_result_log
insert into t13 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t14;
--enable_warnings
create table t14(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list(b) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t14(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t14 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
--disable_warnings
drop table if exists t15;
--enable_warnings
create table t15(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list(b+1) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t15(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t15 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
## 1.4 test range columns partitioning
select /*+index(t11 gkey)*/ * from t11 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t11 gkey)*/ * from t11 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t11 gkey)*/ * from t11 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t11 gkey)*/ * from t11 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t12 gkey)*/ * from t12 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t12 gkey)*/ * from t12 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t12 gkey)*/ * from t12 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t12 gkey)*/ * from t12 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t13 gkey)*/ * from t13 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t13 gkey)*/ * from t13 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t13 gkey)*/ * from t13 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t13 gkey)*/ * from t13 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
## 1.5 test list partitioning
select /*+index(t14 gkey)*/ * from t14 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t14 gkey)*/ * from t14 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t14 gkey)*/ * from t14 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t14 gkey)*/ * from t14 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t15 gkey)*/ * from t15 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t15 gkey)*/ * from t15 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t15 gkey)*/ * from t15 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t15 gkey)*/ * from t15 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;

View File

@ -0,0 +1,88 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: yuchen.wyc
#owner group: sql1
# tags: optimizer, global_index
--result_format 4
--explain_protocol 2
--disable_warnings
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
--enable_warnings
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
--disable_warnings
drop table if exists t16;
--enable_warnings
create table t16(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list(b+c) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t16(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t16 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
--disable_warnings
drop table if exists t17;
--enable_warnings
create table t17(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list columns(b) (
partition p0 values in (1,2,3),
partition p1 values in (5,9),
partition p2 values in (default));
create index gkey on t17(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t17 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
--disable_warnings
drop table if exists t18;
--enable_warnings
create table t18(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list columns(b,c) (
partition p0 values in ((1,1),(2,2),(3,3)),
partition p1 values in ((5,5),(9,9)),
partition p2 values in (default));
create index gkey on t18(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t18 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
--disable_warnings
drop table if exists t19;
--enable_warnings
create table t19(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by list columns(b,c,d) (
partition p0 values in ((1,1,1)),
partition p1 values in ((5,5,5)),
partition p2 values in (default));
create index gkey on t19(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t19 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
--disable_warnings
drop database if exists muhangtest1;
create database muhangtest1;
use muhangtest1;
--enable_warnings
--disable_warnings
drop table if exists t20;
--enable_warnings
create table t20(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b)
subpartition by range columns(c)
subpartition template (
subpartition p0 values less than (5),
subpartition p1 values less than (100)) partitions 2;
create index gkey on t20(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--real_sleep 3
--disable_query_log
--disable_result_log
insert into t20 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1

View File

@ -0,0 +1,142 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: yuchen.wyc
#owner group: sql1
# tags: optimizer, global_index
--result_format 4
--explain_protocol 2
--disable_warnings
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
--enable_warnings
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
--disable_warnings
drop table if exists t21;
--enable_warnings
create table t21(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b)
subpartition by range columns(c,d)
subpartition template (
subpartition p0 values less than (5,5),
subpartition p1 values less than (100,100)) partitions 2;
create index gkey on t21(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--real_sleep 3
--disable_query_log
--disable_result_log
insert into t21 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t22;
--enable_warnings
create table t22(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by range columns(b) subpartition by hash(c) subpartitions 2 (
partition p0 values less than (5),
partition p1 values less than (maxvalue)
);
create index gkey on t22(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--real_sleep 3
--disable_query_log
--disable_result_log
insert into t22 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
drop table if exists t23;
--enable_warnings
create table t23(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by range columns(b,d) subpartition by hash(c) subpartitions 2 (
partition p0 values less than (5,5),
partition p1 values less than (maxvalue,maxvalue)
);
create index gkey on t23(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--real_sleep 3
--disable_query_log
--disable_result_log
insert into t23 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--enable_query_log
--enable_result_log
--sleep 1
--disable_warnings
drop table if exists t24;
--enable_warnings
create table t24(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b)
subpartition by list columns(c)
subpartition template (
subpartition p0 values in (1,2,3,4),
subpartition p1 values in (default)) partitions 2;
create index gkey on t24(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t24 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
--disable_warnings
drop table if exists t25;
--enable_warnings
create table t25(a int, b int, c int, d int, e int, primary key(a,b,c,d), key k1(b) local, key k2(c,b) local, key k3(c,d,b) local) partition by hash(b)
subpartition by list columns(c,d)
subpartition template (
subpartition p0 values in ((1,1),(2,2),(3,3),(4,4)),
subpartition p1 values in (default)) partitions 2;
create index gkey on t25(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t25 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
select /*+index(t21 gkey)*/ * from t21 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t21 gkey)*/ * from t21 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t21 gkey)*/ * from t21 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t21 gkey)*/ * from t21 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
### test range columns partitioning followed by hash partitioning
select /*+index(t22 gkey)*/ * from t22 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t22 gkey)*/ * from t22 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t22 gkey)*/ * from t22 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t22 gkey)*/ * from t22 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t23 gkey)*/ * from t23 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t23 gkey)*/ * from t23 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t23 gkey)*/ * from t23 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t23 gkey)*/ * from t23 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
#test hash partitioning followed by list columns partitioning
select /*+index(t24 gkey)*/ * from t24 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t24 gkey)*/ * from t24 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t24 gkey)*/ * from t24 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t24 gkey)*/ * from t24 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t25 gkey)*/ * from t25 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t25 gkey)*/ * from t25 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t25 gkey)*/ * from t25 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t25 gkey)*/ * from t25 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
#fix bug:
--disable_warnings
drop table if exists t26;
drop table if exists t27;
drop function if exists n_1;
--enable_warnings
create table t26(c1 int , c2 int , c3 int);
create index gkey on t26(c1) global partition by hash(c1) partitions 5;
insert into t26 values(1,1,1),(2,2,2),(3,3,3),(999,999,999),(1111,1111,1111);
create table t27(c1 int ,c2 int, c3 int);
delimiter /;
create function n_1() returns int not deterministic
begin
insert into t27 values(1,0,1);
return 1;
end/
delimiter ;/
select/*+ index(t26 gkey) */ * from t26 where c2=n_1();

View File

@ -0,0 +1,181 @@
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
#owner: yuchen.wyc
#owner group: sql1
# tags: optimizer, global_index
--result_format 4
--explain_protocol 2
--disable_warnings
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
--enable_warnings
set ob_enable_plan_cache = off;
set ob_enable_transformation = false;
--disable_warnings
drop table if exists t26;
--enable_warnings
create table t26(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by list columns(b) subpartition by hash(c) subpartitions 2 (
partition p0 values in (1,2,3,4),
partition p1 values in (default)
);
create index gkey on t26(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t26 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
drop table if exists t27;
--enable_warnings
create table t27(a int, b int, c int, d int, e int, primary key(a,b,c,d))
partition by list columns(b,d) subpartition by hash(c) subpartitions 2 (
partition p0 values in ((1,1),(2,2),(3,3),(4,4)),
partition p1 values in (default)
);
create index gkey on t27(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
insert into t27 values(1,1,1,1,1),(2,2,2,2,2),(3,3,3,3,3),(4,4,4,4,4),(5,5,5,5,5),(6,6,6,6,6),(7,7,7,7,7),(8,8,8,8,8),(9,9,9,9,9),(10,10,10,10,10);
--sleep 1
set autocommit=1;
--disable_warnings
drop table if exists t28;
--enable_warnings
create table t28(a int, b int, c int, d int, e int, primary key(a,b,c,d)) partition by hash(b) partitions 2;
create index gkey on t28(b,c,d) global partition by hash(b) partitions 5;
--source mysql_test/include/check_all_idx_ok.inc
--explain_protocol 0
--disable_info
--disable_query_log
--disable_result_log
let $cnt=300;
while($cnt)
{
eval insert into t28 values($cnt, $cnt, $cnt, $cnt, $cnt);
dec $cnt;
}
--enable_query_log
--enable_result_log
use muhangtest;
#test list columns partitioning followed by hash partitioning
select /*+index(t26 gkey)*/ * from t26 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t26 gkey)*/ * from t26 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t26 gkey)*/ * from t26 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t26 gkey)*/ * from t26 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
select /*+index(t27 gkey)*/ * from t27 where a in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t27 gkey)*/ * from t27 where b in (1,2,3,4,5) order by a,b,c,d;
select /*+index(t27 gkey)*/ * from t27 where (c,b) in ((1,1),(2,2),(3,3),(4,4),(5,5)) order by a,b,c,d;
select /*+index(t27 gkey)*/ * from t27 where (c,d,b) in ((1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5)) order by a,b,c,d;
## part two
explain basic select /*+index(t28 gkey)*/ * from t28 order by a,b;
select /*+index(t28 gkey)*/ * from t28 order by a,b;
## part three 生成列 FIXME 生成列也有问题
#--disable_warnings
#drop table if exists t1;
#--enable_warnings
#
#CREATE TABLE t1 (
# first_name VARCHAR(10),
# last_name VARCHAR(10),
# full_name VARCHAR(255) AS (CONCAT(first_name,' ',last_name))
#);
#create index gkey on t1(full_name) global partition by key(last_name) partitions 5;
#--source mysql_test/include/check_all_idx_ok.inc
#insert into t1(first_name, last_name) values("aaa0", "bbbbb");
#insert into t1(first_name, last_name) values("aaa1", "bbbbb");
#insert into t1(first_name, last_name) values("aaa2", "bbbbb");
#insert into t1(first_name, last_name) values("aaa3", "bbbbb");
#insert into t1(first_name, last_name) values("aaa4", "bbbbb");
#insert into t1(first_name, last_name) values("aaa5", "bbbbb");
#insert into t1(first_name, last_name) values("aaa6", "bbbbb");
#insert into t1(first_name, last_name) values("aaa7", "bbbbb");
#insert into t1(first_name, last_name) values("aaa8", "bbbbb");
#insert into t1(first_name, last_name) values("aaa9", "bbbbb");
# bug 17583593
--disable_warnings
drop table if exists bmsql_oorder;
drop tablegroup if exists tpcc_group;
--enable_warnings
CREATE TABLEGROUP IF NOT EXISTS `tpcc_group`;
CREATE TABLE `bmsql_oorder` (
`o_w_id` int(11) NOT NULL,
`o_d_id` int(11) NOT NULL,
`o_id` int(11) NOT NULL,
`o_c_id` int(11) DEFAULT NULL,
`o_carrier_id` int(11) DEFAULT NULL,
`o_ol_cnt` decimal(2,0) DEFAULT NULL,
`o_all_local` decimal(1,0) DEFAULT NULL,
`o_entry_d` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`o_w_id`, `o_d_id`, `o_id`),
KEY `o_w_id` (`o_w_id`, `o_d_id`, `o_c_id`, `o_id`) GLOBAL BLOCK_SIZE 16384,
KEY `o_w_id_2` (`o_w_id`, `o_d_id`, `o_ol_cnt`) GLOBAL BLOCK_SIZE 16384
) DEFAULT CHARSET = utf8mb4 TABLEGROUP = 'tpcc_group'
partition by hash(o_w_id) partitions 2;
insert into bmsql_oorder(o_w_id,o_d_id,o_id,o_c_id,o_carrier_id) values(36,7,1,169,1);
--source mysql_test/include/check_all_idx_ok.inc
select /*+index(bmsql_oorder o_w_id)*/ o_id, o_entry_d, o_carrier_id FROM bmsql_oorder where o_w_id = 36 AND o_d_id = 7 AND o_c_id = 169 AND o_id = (select max(o_id) FROM bmsql_oorder WHERE o_w_id = 36 AND o_d_id = 7 AND o_c_id = 169);
drop table bmsql_oorder;
# bug
--disable_warnings
drop table if exists notify;
--enable_warnings
CREATE TABLE `notify` (
`id` varchar(68) COLLATE utf8mb4_bin NOT NULL,
`plugin` varchar(100) COLLATE utf8mb4_bin NOT NULL,
`parameter` varchar(8000) COLLATE utf8mb4_bin NOT NULL,
`group_no` bigint(20) NOT NULL,
`status` varchar(2) COLLATE utf8mb4_bin NOT NULL,
`gmt_create` datetime(6) NOT NULL,
`gmt_modify` datetime(6) NOT NULL,
`iw_user_id` varchar(16) COLLATE utf8mb4_bin DEFAULT NULL,
`channel_endpoint` varchar(400) COLLATE utf8mb4_bin DEFAULT NULL,
`business_order` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL,
`business_type` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`plugin_host` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL,
`gmt_local_create` datetime(6) DEFAULT NULL,
`gmt_compensate` datetime(6) DEFAULT NULL,
`partition_id` varchar(2) COLLATE utf8mb4_bin GENERATED ALWAYS AS (substr(`id`,21,2)) VIRTUAL,
PRIMARY KEY (`id`),
KEY `notify_business_order1_ind` (`business_order`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_gmt_compensate_nofity` (`gmt_compensate`) STORING (`status`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_iwuser_gmtc` (`iw_user_id`, `gmt_create`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_gmt_st_pl_iw_gmtm_gn_ce` (`gmt_compensate`, `status`, `plugin`, `iw_user_id`, `gmt_modify`, `channel_endpoint`, `group_no`) GLOBAL BLOCK_SIZE 16384,
KEY `idx_gmt_st_pl_iw_gmtm` (`plugin`, `channel_endpoint`, `gmt_compensate`, `status`, `iw_user_id`, `gmt_modify`, `group_no`) GLOBAL BLOCK_SIZE 16384
) DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin
partition by list columns(partition_id)
(partition p10 values in ('10'),
partition p11 values in ('11'),
partition p12 values in ('12'),
partition p13 values in ('13'),
partition p14 values in ('14'),
partition p15 values in ('15'),
partition p16 values in ('16'),
partition p17 values in ('17'),
partition p18 values in ('18'),
partition p19 values in ('19'),
partition p20 values in ('20'));
insert into notify(id,plugin,parameter,group_no,status,gmt_create,gmt_modify,gmt_compensate) values('2088201800000072862812','aaa','bbb',1,'F',current_timestamp(),current_timestamp(), date_sub(current_timestamp(), INTERVAL 74 MINUTE));
select id, business_order, business_type, plugin_host from notify per where gmt_compensate <= date_sub(current_timestamp(), INTERVAL 74 MINUTE) AND gmt_compensate >= date_sub(current_timestamp(), INTERVAL 75 MINUTE) AND ((status = 'F') ) limit 200;
select /*+use_px parallel(3)*/ id, business_order, business_type, plugin_host from notify per where gmt_compensate <= date_sub(current_timestamp(), INTERVAL 74 MINUTE) AND gmt_compensate >= date_sub(current_timestamp(), INTERVAL 75 MINUTE) AND ((status = 'F') ) limit 200;
drop table notify;