mark some file to been opensource for ce-farm
This commit is contained in:
@ -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;
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
@ -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;
|
||||
Reference in New Issue
Block a user