move test folder
This commit is contained in:
34
tools/deploy/mysql_test/test_suite/px/t/add_material.test
Normal file
34
tools/deploy/mysql_test/test_suite/px/t/add_material.test
Normal file
@ -0,0 +1,34 @@
|
||||
#owner: peihan.dph
|
||||
#owner group: SQL3
|
||||
# tags: optimizer
|
||||
|
||||
# test blocking operator for material
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
create table t1(c1 bigint primary key,c2 bigint) partition by hash (c1) partitions 10;
|
||||
create table t2(c1 bigint primary key,c2 bigint) partition by hash (c1) partitions 6;
|
||||
insert into t1 values(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(0,1),(7,8),(8,9),(9,10);
|
||||
insert into t2 values(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(0,1),(7,8),(8,9),(9,10);
|
||||
--sleep 1
|
||||
commit;
|
||||
|
||||
##need add materail for the left child of merge join
|
||||
explain basic
|
||||
select /*+ USE_PX parallel(3) */* from
|
||||
(select c1,count(*) over(partition by c1) c2 from
|
||||
(select c1,count(c2) c2 from t1 group by c1)c) a join
|
||||
(select c1,count(*) c2 from t2 group by c1)b on a.c1=b.c1 ;
|
||||
--sorted_result
|
||||
select /*+ USE_PX parallel(3) */* from
|
||||
(select c1,count(*) over(partition by c1) c2 from
|
||||
(select c1,count(c2) c2 from t1 group by c1)c) a join
|
||||
(select c1,count(*) c2 from t2 group by c1)b on a.c1=b.c1;
|
||||
|
||||
##no need material operator for merge sort receice with local order
|
||||
explain basic
|
||||
select a.c2,count(*) from (select /*+ USE_PX parallel(3) PQ_DISTRIBUTE(b HASH HASH) */a.c1,a.c2,b.c1 c3,b.c2 c4 from t1 a join t2 b on a.c1=b.c1)a group by a.c2;
|
||||
--sorted_result
|
||||
select a.c2,count(*) from (select /*+ USE_PX parallel(3) PQ_DISTRIBUTE(b HASH HASH) */a.c1,a.c2,b.c1 c3,b.c2 c4 from t1 a join t2 b on a.c1=b.c1)a group by a.c2;
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
# owner: bin.lb
|
||||
# owner group: sql3
|
||||
# tags: px, optimizer
|
||||
#
|
||||
# Need to alloc material operator to make producer/consumer threads mode schedulable.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (c1 int, c2 int, c3 int);
|
||||
create table t2 (c1 int, c2 int, c3 int);
|
||||
|
||||
# need material above hash join. (but root DFO not needed)
|
||||
explain select /*+ use_px parallel(2) use_hash(c d) */ * from (select a.c2, b.c3 from (select /*+ use_hash(a, b) */ c1, c2, count(*) c3 from t1 group by 1, 2) a, (select c1, c2, count(*) c3 from t1 group by 1, 2) b where a.c1 = b.c1) c, (select c1, c2, count(*) c3 from t1 group by 1, 2) d where c.c2 = d.c2;
|
||||
|
||||
# need material on left child, if has right DFO.
|
||||
explain select /*+ use_px parallel(2) use_merge(a b) */ b.c2, sum(a.c3) from (select /*+ NO_USE_HASH_AGGREGATION */ c1, c2, count(*) c3 from t1 group by 1, 2) a, t2 b where a.c1 = b.c1 group by 1;
|
||||
|
||||
# no material needed for root DFO.
|
||||
explain select /*+ use_px parallel(2) use_merge(a b) */ * from (select /*+ NO_USE_HASH_AGGREGATION */ c1, c2, count(*) c3 from t1 group by 1, 2) a, t2 b where a.c1 = b.c1;
|
||||
|
||||
37
tools/deploy/mysql_test/test_suite/px/t/default_open_px.test
Normal file
37
tools/deploy/mysql_test/test_suite/px/t/default_open_px.test
Normal file
@ -0,0 +1,37 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: mingdou.tmd
|
||||
#owner group: sql3
|
||||
# tags: optimizer
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists muhangtest;
|
||||
drop table if exists t1;
|
||||
create database muhangtest;
|
||||
use muhangtest;
|
||||
--enable_warnings
|
||||
|
||||
--result_format 4
|
||||
|
||||
create table t1 (c1 int(11) not null, c2 int(11) not null, c3 int(11) not null, primary key (c1, c2, c3)) partition by key(c2) partitions 4;
|
||||
|
||||
explain select * from t1;
|
||||
explain select /*+use_px*/ * from t1;
|
||||
explain select /*+use_px parallel(15)*/ * from t1;
|
||||
explain select /*+no_use_px */ * from t1;
|
||||
explain select /*+no_use_px use_px*/ * from t1;
|
||||
explain select /*+use_px no_use_px */ * from t1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t7;
|
||||
--enable_warnings
|
||||
create table t7(a int, b int, c int, d int, primary key (a)) partition by hash(a) partitions 3;
|
||||
insert into t7 values(1,2,3,4);
|
||||
insert into t7 values(2,3,5,6);
|
||||
--sorted_result
|
||||
select /*+NO_REWRITE use_px */ * from t7 as A, t7 as B where A.a = B.a and exists(select * from t7 where t7.a=B.a);
|
||||
|
||||
drop table if exists t1;
|
||||
drop table if exists t7;
|
||||
drop database if exists muhangtest;
|
||||
244
tools/deploy/mysql_test/test_suite/px/t/dml_use_px.test
Normal file
244
tools/deploy/mysql_test/test_suite/px/t/dml_use_px.test
Normal file
@ -0,0 +1,244 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: xiaochu.yh
|
||||
# owner group: sql2
|
||||
# 测试 dml 查询部分打开px
|
||||
# tags: dml, px, optimizer
|
||||
# dml查询部分打开px,必须使用 USE_PX hint
|
||||
--result_format 4
|
||||
--disable_warnings
|
||||
drop table if exists s,p,p4,no_p,temp_s,temp_p,temp_p4,temp_p5;
|
||||
|
||||
create table s(c1 int primary key, c2 int ,c3 int);
|
||||
create table p(c1 int primary key, c2 int ,c3 int) partition by hash(c1) partitions 4;
|
||||
create table p4(c1 int primary key, c2 int ,c3 int) partition by hash(c1) partitions 4;
|
||||
create table no_p(c1 int, c2 int ,c3 int) partition by hash(c1) partitions 4;
|
||||
create table temp_s(c1 int, c2 int, c3 int);
|
||||
create table temp_p(c1 int, c2 int ,c3 int) partition by hash(c1) partitions 4;
|
||||
create table temp_p4(c1 int, c2 int ,c3 int) partition by hash(c1) partitions 4;
|
||||
create table temp_p5(c1 int, c2 int ,c3 int) partition by hash(c1) partitions 5;
|
||||
|
||||
## delete测试
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
# 非分区表,parallel不大于1,不启用px
|
||||
explain basic delete /*+no_use_px*/ from s;
|
||||
explain basic delete /*+use_px*/ from s;
|
||||
delete /*+use_px*/ from s;
|
||||
select * from s order by c1;
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
# 非分区表,parallel大于1,启用px
|
||||
explain basic delete /*+use_px, parallel(10)*/ from s;
|
||||
delete /*+use_px, parallel(10)*/ from s;
|
||||
select * from s order by c1;
|
||||
|
||||
# 分区表测试
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px,parallel(10)*/ from p;
|
||||
explain basic delete /*+use_px,parallel(10)*/ from p;
|
||||
delete /*+use_px,parallel(10)*/ from p;
|
||||
select * from p order by c1;
|
||||
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px,parallel(10)*/ from p where c1 >= 5;
|
||||
explain basic delete /*+use_px,parallel(10)*/ from p where c1 >= 5;
|
||||
delete /*+use_px,parallel(10)*/ from p where c1 >= 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+use_px*/ from p where c1 = 5;
|
||||
explain basic delete /*+use_px,parallel(10)*/ from p where c1 = 5;
|
||||
explain basic delete /*+no_use_px,parallel(10)*/ from p where c1 = 5;
|
||||
delete /*+use_px,parallel(10)*/ from p where c1 = 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
# partition wise join
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
insert into p4(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px, use_nl(p,p4), parallel(10)*/ p from p,p4 where p.c1 = p4.c1 and p.c1 >= 5;
|
||||
explain basic delete /*+use_px, parallel(10)*/ p from p,p4 where p.c1 = p4.c1 and p.c1 >= 5;
|
||||
delete /*+use_px, parallel(10)*/ p from p,p4 where p.c1 = p4.c1 and p.c1 >= 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
# 非 partition wise join,会经过pkey,形成回退的multi part计划
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
# 存在pkey,计划回退成multi part
|
||||
explain basic delete /*+no_use_px, parallel(10)*/ p from p,p4 where p.c1 = p4.c2 and p.c1 >= 5;
|
||||
explain basic delete /*+use_px, parallel(10)*/ p from p,p4 where p.c1 = p4.c2 and p.c1 >= 5;
|
||||
delete /*+use_px, parallel(10)*/ p from p,p4 where p.c1 = p4.c2 and p.c1 >= 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
# 多表删除
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px,parallel(10)*/ s,p from s,p;
|
||||
explain basic delete /*+use_px,parallel(10)*/ s,p from s,p;
|
||||
delete /*+use_px,parallel(10)*/ s,p from s,p;
|
||||
select * from p order by c1;
|
||||
select * from s order by c1;
|
||||
|
||||
# 删除非分区表或者单分区(开启分区内并行,但是DML仍然是非multi part)
|
||||
# 删除非分区表
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px, parallel(10)*/ s from s,p where p.c1 = s.c1;
|
||||
explain basic delete /*+use_px, parallel(10),leading(s,p),pq_distribute(p,none,broadcast)*/ s from s,p where p.c1 = s.c1;
|
||||
delete /*+use_px, parallel(10),leading(s,p),pq_distribute(p,none,broadcast)*/ s from s,p where p.c1 = s.c1;
|
||||
select * from s order by c1;
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+use_px, parallel(10)*/ s from s,p where p.c1 = s.c1;
|
||||
delete /*+use_px, parallel(10)*/ s from s,p where p.c1 = s.c1;
|
||||
select * from s order by c1;
|
||||
|
||||
# 删除分区表的一个分区
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px, parallel(10)*/ p from s,p where p.c1 = s.c1 and p.c1 = 1;
|
||||
# dop小于2,单分区,不会产生非PX计划
|
||||
explain basic delete /*+use_px, parallel(1)*/ p from s,p where p.c1 = s.c1 and p.c1 = 1;
|
||||
explain basic delete /*+use_px, parallel(10)*/ p from s,p where p.c1 = s.c1 and p.c1 = 1;
|
||||
delete /*+use_px, parallel(10)*/ p from s,p where p.c1 = s.c1 and p.c1 = 1;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
delete from s;
|
||||
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+no_use_px, parallel(10)*/ p from p4,p where p.c1 = p4.c2 and p4.c2 = 4;
|
||||
# dop = 1, 针对单分区,不会启用分区内并行,所有p所对应的分区location是local(c模式),remote(slave模式)
|
||||
# 在c模式下会产生local+local的计划,在slave模式下remote+remote,并且分配了EX,变为multi part计划
|
||||
explain basic delete /*+use_px, parallel(1)*/ p from p4,p where p.c1 = p4.c2 and p4.c2 = 4;
|
||||
delete /*+use_px, parallel(1)*/ p from p4,p where p.c1 = p4.c2 and p4.c2 = 4;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic delete /*+use_px, parallel(10)*/ p from p4,p where p.c1 = p4.c2 and p4.c2 = 4;
|
||||
delete /*+use_px, parallel(10)*/ p from p4,p where p.c1 = p4.c2 and p4.c2 = 4;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
delete from p4;
|
||||
|
||||
|
||||
## update测试
|
||||
# 非分区表,parallel大于1,启用px
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic update /*+no_use_px, parallel(10)*/ s set s.c2 = 20 where s.c1 >= 5;
|
||||
explain basic update /*+use_px, parallel(10)*/ s set s.c2 = 20 where s.c1 >= 5;
|
||||
update /*+use_px, parallel(10)*/ s set s.c2 = 20 where s.c1 >=5;
|
||||
select * from s order by c1;
|
||||
delete from s;
|
||||
|
||||
# 更新主键
|
||||
insert into s(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic update /*+no_use_px, parallel(10)*/ s set s.c1 = 20 where s.c2 = 5;
|
||||
explain basic update /*+use_px, parallel(10)*/ s set s.c1 = 20 where s.c2 = 5;
|
||||
update /*+use_px, parallel(10)*/ s set s.c1 = 20 where s.c2 = 5;
|
||||
select * from s order by c1;
|
||||
delete from s;
|
||||
|
||||
# 分区表
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic update /*+no_use_px, parallel(10)*/ p set p.c3 = 20 where p.c1 >= 5;
|
||||
explain basic update /*+use_px, parallel(10)*/ p set p.c3 = 20 where p.c1 >= 5;
|
||||
update /*+use_px, parallel(10)*/ p set p.c3 = 20 where p.c1 >= 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic update /*+no_use_px, parallel(10)*/ p set p.c1 = 20 where p.c1 = 5;
|
||||
explain basic update /*+use_px, parallel(10)*/ p set p.c1 = 20 where p.c1 = 5;
|
||||
update /*+use_px, parallel(10)*/ p set p.c1 = 20 where p.c1 = 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
insert into p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic update /*+no_use_px, parallel(10)*/ p as pp set pp.c3 = 20 where pp.c1 >= 5;
|
||||
explain basic update /*+use_px, parallel(10)*/ p as pp set pp.c3 = 20 where pp.c1 >= 5;
|
||||
update /*+use_px, parallel(10)*/ p as pp set pp.c3 = 20 where pp.c1 >= 5;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
# 跟新无主键表
|
||||
insert into no_p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
explain basic update /*+no_use_px, parallel(10)*/ no_p set no_p.c1 = 20 where no_p.c1 >= 5;
|
||||
explain basic update /*+use_px, parallel(10)*/ no_p set no_p.c1 = 20 where no_p.c1 >= 5;
|
||||
update /*+use_px, parallel(10)*/ no_p set no_p.c1 = 20 where no_p.c1 >= 5;
|
||||
select * from no_p order by c2;
|
||||
delete from no_p;
|
||||
|
||||
## insert测试:insert插入的表是local的非分区表/单分区的计划是非multi part,其他都是multi part计划
|
||||
## insert不会出现GI算子在insert算子头上的计划
|
||||
insert into temp_p(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
insert into temp_s(c1,c3) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
insert into temp_p4(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
insert into temp_p5(c1,c2) values(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
|
||||
|
||||
explain basic insert /*+no_use_px*/ into s select * from temp_s;
|
||||
explain basic insert /*+use_px*/ into s select * from temp_s;
|
||||
insert /*+use_px*/ into s select * from temp_s;
|
||||
select * from s order by c1;
|
||||
delete from s;
|
||||
|
||||
explain basic insert /*+no_use_px,parallel(10)*/ into s select * from temp_s;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into s select * from temp_s;
|
||||
insert /*+use_px,parallel(10)*/ into s select * from temp_s;
|
||||
select * from s order by c1;
|
||||
delete from s;
|
||||
|
||||
explain basic insert /*+no_use_px,parallel(10)*/ into s select * from temp_p where temp_p.c2 >= 5;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into s select * from temp_p where temp_p.c2 >= 5;
|
||||
insert /*+use_px,parallel(10)*/ into s select * from temp_p where temp_p.c2 >= 5;
|
||||
select * from s order by c1;
|
||||
delete from s;
|
||||
|
||||
explain basic insert /*+no_use_px,parallel(10)*/ into s select temp_p.c1,temp_p.c2,temp_s.c3 from temp_p,temp_s where temp_p.c1 = temp_s.c1;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into s select temp_p.c1,temp_p.c2,temp_s.c3 from temp_p,temp_s where temp_p.c1 = temp_s.c1;
|
||||
insert /*+use_px,parallel(10)*/ into s select temp_p.c1,temp_p.c2,temp_s.c3 from temp_p,temp_s where temp_p.c1 = temp_s.c1;
|
||||
select * from s order by c1;
|
||||
delete from s;
|
||||
|
||||
# 插入多分区表
|
||||
explain basic insert /*+no_use_px,parallel(10)*/ into p select * from temp_s;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into p select * from temp_s;
|
||||
insert /*+use_px,parallel(10)*/ into p select * from temp_s;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
explain basic insert /*+no_use_px,parallel(10)*/ into p select * from temp_p;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into p select * from temp_p;
|
||||
insert /*+use_px,parallel(10)*/ into p select * from temp_p;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
explain basic insert /*+no_use_px, parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_p.c3 from temp_p,temp_p5 where temp_p.c1 = temp_p5.c1;
|
||||
explain basic insert /*+use_px, parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_p.c3 from temp_p,temp_p5 where temp_p.c1 = temp_p5.c1;
|
||||
insert /*+use_px, parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_p.c3 from temp_p,temp_p5 where temp_p.c1 = temp_p5.c1;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
explain basic insert /*+use_px, parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_p.c3 from temp_p,temp_p5 where temp_p.c1 = temp_p5.c1 and temp_p.c1 = 3;
|
||||
insert /*+use_px, parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_p.c3 from temp_p,temp_p5 where temp_p.c1 = temp_p5.c1 and temp_p.c1 = 3;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
# full partition wise join insert
|
||||
explain basic insert /*+use_px, parallel(10)*/ into p select temp_p.c1, temp_p.c2, temp_p.c3 from temp_p, temp_p4 where temp_p.c1 = temp_p4.c1;
|
||||
insert /*+use_px, parallel(10)*/ into p select temp_p.c1, temp_p.c2, temp_p.c3 from temp_p, temp_p4 where temp_p.c1 = temp_p4.c1;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
explain basic insert /*+no_use_px,parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_s.c3 from temp_p,temp_s where temp_p.c1 = temp_s.c1;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_s.c3 from temp_p,temp_s where temp_p.c1 = temp_s.c1;
|
||||
insert /*+use_px,parallel(10)*/ into p select temp_p.c1,temp_p.c2,temp_s.c3 from temp_p,temp_s where temp_p.c1 = temp_s.c1;
|
||||
select * from p order by c1;
|
||||
delete from p;
|
||||
|
||||
## replace / insert on duplicate 计划
|
||||
## 目前replace / insert on duplicate计划是不支持PX
|
||||
explain basic replace /*+use_px,parallel(10)*/ into p select * from temp_p;
|
||||
explain basic insert /*+use_px,parallel(10)*/ into p select * from temp_p on duplicate key update c3 = 2;
|
||||
|
||||
# 清理测试
|
||||
drop table if exists s,p,p4,no_p,temp_s,temp_p,temp_p4,temp_p5;
|
||||
9
tools/deploy/mysql_test/test_suite/px/t/join_mj.test
Normal file
9
tools/deploy/mysql_test/test_suite/px/t/join_mj.test
Normal file
@ -0,0 +1,9 @@
|
||||
#owner: mingdou.tmd
|
||||
#owner group: SQL3
|
||||
# tags: optimizer
|
||||
|
||||
--source mysql_test/test_suite/px/include/exam_data.inc
|
||||
|
||||
explain select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid order by score.sid;
|
||||
--sorted_result
|
||||
select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid order by score.sid;
|
||||
36
tools/deploy/mysql_test/test_suite/px/t/join_nlj.test
Normal file
36
tools/deploy/mysql_test/test_suite/px/t/join_nlj.test
Normal file
@ -0,0 +1,36 @@
|
||||
#owner: mingdou.tmd
|
||||
#owner group: SQL3
|
||||
# tags: optimizer
|
||||
|
||||
--source mysql_test/test_suite/px/include/exam_data.inc
|
||||
|
||||
## bc2host
|
||||
explain select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid != score.sid and stu.sid < 12;
|
||||
--sorted_result
|
||||
select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid != score.sid and stu.sid < 12;
|
||||
|
||||
# subject 上指定一个选择率,走 NLJ
|
||||
explain select /*+ USE_PX parallel(2) */ * from score, teacher where teacher.subject = score.subject and teacher.tid = 1;
|
||||
--sorted_result
|
||||
select /*+ USE_PX parallel(2) */ * from score, teacher where teacher.subject = score.subject and teacher.tid = 1;
|
||||
|
||||
CREATE TABLE product (pid bigint primary key,pname varchar(50),gmt_modify timestamp(6),gmt_create timestamp(6),thread_id bigint, key k (gmt_modify))duplicate_scope="cluster";
|
||||
|
||||
CREATE TABLE orders (oid bigint primary key,pid bigint,amount int, addr varchar(20),key k (pid) local) partition by hash (oid) partitions 100;
|
||||
|
||||
insert into product values(314265, "abcd", now(), now(), 1234);
|
||||
insert into orders values(314265, 314265, 678, "192.168.1.8");
|
||||
|
||||
insert into product values(314266, "abcd", now(), now(), 1234);
|
||||
insert into orders values(314266, 314266, 678, "192.168.1.8");
|
||||
|
||||
insert into product values(314267, "abcd", now(), now(), 1234);
|
||||
insert into orders values(314267, 314267, 678, "192.168.1.8");
|
||||
|
||||
insert into product values(314268, "abcd", now(), now(), 1234);
|
||||
insert into orders values(314268, 314268, 678, "192.168.1.8");
|
||||
|
||||
explain select t1.pname,t2.oid,t2.amount from product t1,orders t2 where t2.oid = 314265 and t1.pid=t2.pid;
|
||||
select t1.pname,t2.oid,t2.amount from product t1,orders t2 where t2.oid = 314265 and t1.pid=t2.pid;
|
||||
|
||||
|
||||
12
tools/deploy/mysql_test/test_suite/px/t/join_pwj.test
Normal file
12
tools/deploy/mysql_test/test_suite/px/t/join_pwj.test
Normal file
@ -0,0 +1,12 @@
|
||||
#owner: mingdou.tmd
|
||||
#owner group: SQL3
|
||||
# tags: optimizer
|
||||
|
||||
--source mysql_test/test_suite/px/include/exam_data.inc
|
||||
|
||||
## partition wise join
|
||||
explain select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid;
|
||||
--sorted_result
|
||||
select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid;
|
||||
|
||||
|
||||
44
tools/deploy/mysql_test/test_suite/px/t/sql_audit.test
Normal file
44
tools/deploy/mysql_test/test_suite/px/t/sql_audit.test
Normal file
@ -0,0 +1,44 @@
|
||||
#owner: xiaochu.yh
|
||||
#owner group: SQL3
|
||||
# tags: optimizer
|
||||
--result_format 4
|
||||
|
||||
# test aggregation
|
||||
|
||||
--disable_result_log
|
||||
|
||||
--source mysql_test/test_suite/px/include/exam_data.inc
|
||||
--disable_result_log
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys;
|
||||
alter system set enable_sql_audit = true;
|
||||
alter system flush sql audit global;
|
||||
|
||||
disconnect obsys;
|
||||
connection default;
|
||||
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ * from teacher;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ * from teacher;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(4) */ * from teacher;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ subject, avg(score), max(score), min(score) from score group by subject;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ subject, avg(score), max(score), min(score) from score group by subject;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject;
|
||||
--sorted_result
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject;
|
||||
|
||||
--enable_result_log
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys;
|
||||
|
||||
--sorted_result
|
||||
eval select query_sql, EXPECTED_WORKER_COUNT, USED_WORKER_COUNT from oceanbase.gv\$sql_audit where EXPECTED_WORKER_COUNT > 0 AND query_sql like '%TEST_SQL_AUDIT%' order by request_time desc limit 10;
|
||||
Reference in New Issue
Block a user