move test folder
This commit is contained in:
@ -0,0 +1,114 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
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);
|
||||
commit;
|
||||
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 ;
|
||||
Query Plan
|
||||
=============================================
|
||||
|ID|OPERATOR |NAME |
|
||||
---------------------------------------------
|
||||
|0 |PX COORDINATOR | |
|
||||
|1 | EXCHANGE OUT DISTR |:EX10001|
|
||||
|2 | MERGE JOIN | |
|
||||
|3 | EXCHANGE IN MERGE SORT DISTR| |
|
||||
|4 | EXCHANGE OUT DISTR (PKEY) |:EX10000|
|
||||
|5 | PX BLOCK ITERATOR | |
|
||||
|6 | TABLE SCAN |t1 |
|
||||
|7 | SORT | |
|
||||
|8 | PX PARTITION ITERATOR | |
|
||||
|9 | TABLE SCAN |t2 |
|
||||
=============================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [1], [t2.c1], [1]), filter(nil)
|
||||
1 - output([t1.c1], [t2.c1], [1], [1]), filter(nil), dop=3
|
||||
2 - output([t1.c1], [t2.c1], [1], [1]), filter(nil),
|
||||
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
|
||||
3 - output([t1.c1]), filter(nil), sort_keys([t1.c1, ASC]), Local Order
|
||||
4 - (#keys=1, [t1.c1]), output([t1.c1]), filter(nil), dop=3
|
||||
5 - output([t1.c1]), filter(nil)
|
||||
6 - output([t1.c1]), filter(nil),
|
||||
access([t1.c1]), partitions(p[0-9])
|
||||
7 - output([t2.c1]), filter(nil), sort_keys([t2.c1, ASC]), local merge sort
|
||||
8 - output([t2.c1]), filter(nil)
|
||||
9 - output([t2.c1]), filter(nil),
|
||||
access([t2.c1]), partitions(p[0-5])
|
||||
|
||||
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;
|
||||
c1 c2 c1 c2
|
||||
0 1 0 1
|
||||
1 1 1 1
|
||||
2 1 2 1
|
||||
3 1 3 1
|
||||
4 1 4 1
|
||||
5 1 5 1
|
||||
6 1 6 1
|
||||
7 1 7 1
|
||||
8 1 8 1
|
||||
9 1 9 1
|
||||
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;
|
||||
Query Plan
|
||||
================================================
|
||||
|ID|OPERATOR |NAME |
|
||||
------------------------------------------------
|
||||
|0 |PX COORDINATOR | |
|
||||
|1 | EXCHANGE OUT DISTR |:EX10003|
|
||||
|2 | HASH GROUP BY | |
|
||||
|3 | EXCHANGE IN DISTR | |
|
||||
|4 | EXCHANGE OUT DISTR (HASH) |:EX10002|
|
||||
|5 | MERGE JOIN | |
|
||||
|6 | EXCHANGE IN MERGE SORT DISTR| |
|
||||
|7 | EXCHANGE OUT DISTR (HASH) |:EX10000|
|
||||
|8 | PX BLOCK ITERATOR | |
|
||||
|9 | TABLE SCAN |a |
|
||||
|10| EXCHANGE IN MERGE SORT DISTR| |
|
||||
|11| EXCHANGE OUT DISTR (HASH) |:EX10001|
|
||||
|12| PX BLOCK ITERATOR | |
|
||||
|13| TABLE SCAN |b |
|
||||
================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil)
|
||||
1 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil), dop=3
|
||||
2 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil),
|
||||
group([a.c2]), agg_func([T_FUN_COUNT(*)])
|
||||
3 - output([a.c2]), filter(nil)
|
||||
4 - (#keys=1, [a.c2]), output([a.c2]), filter(nil), dop=3
|
||||
5 - output([a.c2]), filter(nil),
|
||||
equal_conds([a.c1 = b.c1]), other_conds(nil)
|
||||
6 - output([a.c1], [a.c2]), filter(nil), sort_keys([a.c1, ASC]), Local Order
|
||||
7 - (#keys=1, [a.c1]), output([a.c1], [a.c2]), filter(nil), dop=3
|
||||
8 - output([a.c1], [a.c2]), filter(nil)
|
||||
9 - output([a.c1], [a.c2]), filter(nil),
|
||||
access([a.c1], [a.c2]), partitions(p[0-9])
|
||||
10 - output([b.c1]), filter(nil), sort_keys([b.c1, ASC]), Local Order
|
||||
11 - (#keys=1, [b.c1]), output([b.c1]), filter(nil), dop=3
|
||||
12 - output([b.c1]), filter(nil)
|
||||
13 - output([b.c1]), filter(nil),
|
||||
access([b.c1]), partitions(p[0-5])
|
||||
|
||||
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;
|
||||
c2 count(*)
|
||||
1 1
|
||||
10 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
5 1
|
||||
6 1
|
||||
7 1
|
||||
8 1
|
||||
9 1
|
||||
@ -0,0 +1,227 @@
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (c1 int, c2 int, c3 int);
|
||||
create table t2 (c1 int, c2 int, c3 int);
|
||||
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;
|
||||
Query Plan
|
||||
====================================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
--------------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |96059602 |90225641|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10005|96059602 |58400112|
|
||||
|2 | HASH JOIN | |96059602 |58400112|
|
||||
|3 | EXCHANGE IN DISTR | |10001 |169529 |
|
||||
|4 | EXCHANGE OUT DISTR (BROADCAST) |:EX10001|10001 |168583 |
|
||||
|5 | SUBPLAN SCAN |b |10001 |168583 |
|
||||
|6 | HASH GROUP BY | |10001 |167202 |
|
||||
|7 | EXCHANGE IN DISTR | |10001 |116107 |
|
||||
|8 | EXCHANGE OUT DISTR (HASH) |:EX10000|10001 |115161 |
|
||||
|9 | HASH GROUP BY | |10001 |115161 |
|
||||
|10| PX BLOCK ITERATOR | |100000 |64066 |
|
||||
|11| TABLE SCAN |t1 |100000 |64066 |
|
||||
|12| HASH JOIN | |980101 |924869 |
|
||||
|13| EXCHANGE IN DISTR | |10001 |158931 |
|
||||
|14| EXCHANGE OUT DISTR (BROADCAST)|:EX10003|10001 |157984 |
|
||||
|15| SUBPLAN SCAN |a |10001 |157984 |
|
||||
|16| HASH GROUP BY | |10001 |156604 |
|
||||
|17| EXCHANGE IN DISTR | |10001 |110808 |
|
||||
|18| EXCHANGE OUT DISTR (HASH) |:EX10002|10001 |109862 |
|
||||
|19| HASH GROUP BY | |10001 |109862 |
|
||||
|20| PX BLOCK ITERATOR | |100000 |64066 |
|
||||
|21| TABLE SCAN |t1 |100000 |64066 |
|
||||
|22| SUBPLAN SCAN |d |10001 |168583 |
|
||||
|23| HASH GROUP BY | |10001 |167202 |
|
||||
|24| EXCHANGE IN DISTR | |10001 |116107 |
|
||||
|25| EXCHANGE OUT DISTR (HASH) |:EX10004|10001 |115161 |
|
||||
|26| HASH GROUP BY | |10001 |115161 |
|
||||
|27| PX BLOCK ITERATOR | |100000 |64066 |
|
||||
|28| TABLE SCAN |t1 |100000 |64066 |
|
||||
====================================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.c2], [b.c3], [d.c1], [d.c2], [d.c3]), filter(nil)
|
||||
1 - output([a.c2], [b.c3], [d.c1], [d.c2], [d.c3]), filter(nil), dop=2
|
||||
2 - output([a.c2], [b.c3], [d.c1], [d.c2], [d.c3]), filter(nil),
|
||||
equal_conds([a.c1 = b.c1]), other_conds(nil)
|
||||
3 - output([b.c1], [b.c3]), filter(nil)
|
||||
4 - output([b.c1], [b.c3]), filter(nil), dop=2
|
||||
5 - output([b.c1], [b.c3]), filter(nil),
|
||||
access([b.c1], [b.c3])
|
||||
6 - output([t1.c1], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
7 - output([t1.c1], [T_FUN_COUNT(*)], [t1.c2]), filter(nil)
|
||||
8 - (#keys=2, [t1.c1], [t1.c2]), output([t1.c1], [T_FUN_COUNT(*)], [t1.c2]), filter(nil), dop=2
|
||||
9 - output([t1.c1], [T_FUN_COUNT(*)], [t1.c2]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT(*)])
|
||||
10 - output([t1.c1], [t1.c2]), filter(nil)
|
||||
11 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
12 - output([a.c2], [d.c1], [d.c2], [d.c3], [a.c1]), filter(nil),
|
||||
equal_conds([a.c2 = d.c2]), other_conds(nil)
|
||||
13 - output([a.c1], [a.c2]), filter(nil)
|
||||
14 - output([a.c1], [a.c2]), filter(nil), dop=2
|
||||
15 - output([a.c1], [a.c2]), filter(nil),
|
||||
access([a.c1], [a.c2])
|
||||
16 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func(nil)
|
||||
17 - output([t1.c1], [t1.c2]), filter(nil)
|
||||
18 - (#keys=2, [t1.c1], [t1.c2]), output([t1.c1], [t1.c2]), filter(nil), dop=2
|
||||
19 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func(nil)
|
||||
20 - output([t1.c1], [t1.c2]), filter(nil)
|
||||
21 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
22 - output([d.c2], [d.c1], [d.c3]), filter(nil),
|
||||
access([d.c2], [d.c1], [d.c3])
|
||||
23 - output([t1.c1], [t1.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
24 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil)
|
||||
25 - (#keys=2, [t1.c1], [t1.c2]), output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), dop=2
|
||||
26 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT(*)])
|
||||
27 - output([t1.c1], [t1.c2]), filter(nil)
|
||||
28 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
|
||||
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;
|
||||
Query Plan
|
||||
===============================================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
-------------------------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |101 |744726|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10005|101 |744696|
|
||||
|2 | MERGE GROUP BY | |101 |744696|
|
||||
|3 | EXCHANGE IN MERGE SORT DISTR | |101 |742003|
|
||||
|4 | EXCHANGE OUT DISTR (HASH) |:EX10004|101 |741972|
|
||||
|5 | MERGE GROUP BY | |101 |741972|
|
||||
|6 | SORT | |9802 |739279|
|
||||
|7 | MERGE JOIN | |9802 |712834|
|
||||
|8 | MATERIAL | |101 |355664|
|
||||
|9 | EXCHANGE IN MERGE SORT DISTR | |101 |355600|
|
||||
|10| EXCHANGE OUT DISTR (BROADCAST) |:EX10002|101 |355583|
|
||||
|11| MATERIAL | |101 |355583|
|
||||
|12| SUBPLAN SCAN |VIEW1 |101 |355519|
|
||||
|13| MERGE GROUP BY | |101 |355505|
|
||||
|14| EXCHANGE IN MERGE SORT DISTR | |101 |352758|
|
||||
|15| EXCHANGE OUT DISTR (HASH) |:EX10001|101 |352748|
|
||||
|16| MATERIAL | |101 |352748|
|
||||
|17| MERGE GROUP BY | |101 |352711|
|
||||
|18| SUBPLAN SCAN |a |10001 |349964|
|
||||
|19| MERGE GROUP BY | |10001 |348584|
|
||||
|20| EXCHANGE IN MERGE SORT DISTR| |10001 |312738|
|
||||
|21| EXCHANGE OUT DISTR (HASH) |:EX10000|10001 |311791|
|
||||
|22| MERGE GROUP BY | |10001 |311791|
|
||||
|23| SORT | |100000 |275945|
|
||||
|24| PX BLOCK ITERATOR | |100000 |64066 |
|
||||
|25| TABLE SCAN |t1 |100000 |64066 |
|
||||
|26| SUBPLAN SCAN |VIEW2 |10001 |349964|
|
||||
|27| MERGE GROUP BY | |10001 |348584|
|
||||
|28| EXCHANGE IN MERGE SORT DISTR | |10001 |312738|
|
||||
|29| EXCHANGE OUT DISTR (HASH) |:EX10003|10001 |311791|
|
||||
|30| MERGE GROUP BY | |10001 |311791|
|
||||
|31| SORT | |100000 |275945|
|
||||
|32| PX BLOCK ITERATOR | |100000 |64066 |
|
||||
|33| TABLE SCAN |b |100000 |64066 |
|
||||
===============================================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([VIEW2.b.c2], [T_FUN_SUM(T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0))))]), filter(nil)
|
||||
1 - output([VIEW2.b.c2], [T_FUN_SUM(T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0))))]), filter(nil), dop=2
|
||||
2 - output([VIEW2.b.c2], [T_FUN_SUM(T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0))))]), filter(nil),
|
||||
group([VIEW2.b.c2]), agg_func([T_FUN_SUM(T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0))))])
|
||||
3 - output([VIEW2.b.c2], [T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)))]), filter(nil), sort_keys([VIEW2.b.c2, ASC])
|
||||
4 - (#keys=1, [VIEW2.b.c2]), output([VIEW2.b.c2], [T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)))]), filter(nil), dop=2
|
||||
5 - output([VIEW2.b.c2], [T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)))]), filter(nil),
|
||||
group([VIEW2.b.c2]), agg_func([T_FUN_SUM(VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)))])
|
||||
6 - output([VIEW2.b.c2], [VIEW1.T_FUN_SUM(a.c3) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0))]), filter(nil), sort_keys([VIEW2.b.c2, ASC])
|
||||
7 - output([VIEW2.b.c2], [VIEW1.T_FUN_SUM(a.c3)], [VIEW2.T_FUN_COUNT(*)]), filter(nil),
|
||||
equal_conds([VIEW1.a.c1 = VIEW2.b.c1]), other_conds(nil)
|
||||
8 - output([VIEW1.T_FUN_SUM(a.c3)], [VIEW1.a.c1]), filter(nil)
|
||||
9 - output([VIEW1.T_FUN_SUM(a.c3)], [VIEW1.a.c1]), filter(nil), sort_keys([VIEW1.a.c1, ASC])
|
||||
10 - output([VIEW1.T_FUN_SUM(a.c3)], [VIEW1.a.c1]), filter(nil), dop=2
|
||||
11 - output([VIEW1.T_FUN_SUM(a.c3)], [VIEW1.a.c1]), filter(nil)
|
||||
12 - output([VIEW1.a.c1], [VIEW1.T_FUN_SUM(a.c3)]), filter(nil),
|
||||
access([VIEW1.a.c1], [VIEW1.T_FUN_SUM(a.c3)])
|
||||
13 - output([a.c1], [T_FUN_SUM(T_FUN_SUM(a.c3))]), filter(nil),
|
||||
group([a.c1]), agg_func([T_FUN_SUM(T_FUN_SUM(a.c3))])
|
||||
14 - output([a.c1], [T_FUN_SUM(a.c3)]), filter(nil), sort_keys([a.c1, ASC])
|
||||
15 - (#keys=1, [a.c1]), output([a.c1], [T_FUN_SUM(a.c3)]), filter(nil), dop=2
|
||||
16 - output([a.c1], [T_FUN_SUM(a.c3)]), filter(nil)
|
||||
17 - output([a.c1], [T_FUN_SUM(a.c3)]), filter(nil),
|
||||
group([a.c1]), agg_func([T_FUN_SUM(a.c3)])
|
||||
18 - output([a.c1], [a.c3]), filter(nil),
|
||||
access([a.c1], [a.c3])
|
||||
19 - output([t1.c1], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
20 - output([t1.c1], [T_FUN_COUNT(*)], [t1.c2]), filter(nil), sort_keys([t1.c1, ASC], [t1.c2, ASC])
|
||||
21 - (#keys=2, [t1.c1], [t1.c2]), output([t1.c1], [T_FUN_COUNT(*)], [t1.c2]), filter(nil), dop=2
|
||||
22 - output([t1.c1], [T_FUN_COUNT(*)], [t1.c2]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT(*)])
|
||||
23 - output([t1.c1], [t1.c2]), filter(nil), sort_keys([t1.c1, ASC], [t1.c2, ASC])
|
||||
24 - output([t1.c1], [t1.c2]), filter(nil)
|
||||
25 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
26 - output([VIEW2.b.c1], [VIEW2.b.c2], [VIEW2.T_FUN_COUNT(*)]), filter(nil),
|
||||
access([VIEW2.b.c1], [VIEW2.b.c2], [VIEW2.T_FUN_COUNT(*)])
|
||||
27 - output([b.c1], [b.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil),
|
||||
group([b.c1], [b.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
28 - output([b.c1], [b.c2], [T_FUN_COUNT(*)]), filter(nil), sort_keys([b.c1, ASC], [b.c2, ASC])
|
||||
29 - (#keys=2, [b.c1], [b.c2]), output([b.c1], [b.c2], [T_FUN_COUNT(*)]), filter(nil), dop=2
|
||||
30 - output([b.c1], [b.c2], [T_FUN_COUNT(*)]), filter(nil),
|
||||
group([b.c1], [b.c2]), agg_func([T_FUN_COUNT(*)])
|
||||
31 - output([b.c1], [b.c2]), filter(nil), sort_keys([b.c1, ASC], [b.c2, ASC])
|
||||
32 - output([b.c1], [b.c2]), filter(nil)
|
||||
33 - output([b.c1], [b.c2]), filter(nil),
|
||||
access([b.c1], [b.c2]), partitions(p0)
|
||||
|
||||
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;
|
||||
Query Plan
|
||||
====================================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
--------------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |9801001 |9264343|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10002|9801001 |6481053|
|
||||
|2 | MERGE JOIN | |9801001 |6481053|
|
||||
|3 | EXCHANGE IN MERGE SORT DISTR | |10001 |356896 |
|
||||
|4 | EXCHANGE OUT DISTR (BROADCAST) |:EX10001|10001 |355477 |
|
||||
|5 | MATERIAL | |10001 |355477 |
|
||||
|6 | SUBPLAN SCAN |a |10001 |349964 |
|
||||
|7 | MERGE GROUP BY | |10001 |348584 |
|
||||
|8 | EXCHANGE IN MERGE SORT DISTR| |10001 |312738 |
|
||||
|9 | EXCHANGE OUT DISTR (HASH) |:EX10000|10001 |311791 |
|
||||
|10| MERGE GROUP BY | |10001 |311791 |
|
||||
|11| SORT | |100000 |275945 |
|
||||
|12| PX BLOCK ITERATOR | |100000 |64066 |
|
||||
|13| TABLE SCAN |t1 |100000 |64066 |
|
||||
|14| SORT | |100000 |296180 |
|
||||
|15| PX BLOCK ITERATOR | |100000 |66272 |
|
||||
|16| TABLE SCAN |b |100000 |66272 |
|
||||
====================================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.c1], [a.c2], [a.c3], [b.c1], [b.c2], [b.c3]), filter(nil)
|
||||
1 - output([a.c1], [a.c2], [a.c3], [b.c1], [b.c2], [b.c3]), filter(nil), dop=2
|
||||
2 - output([a.c1], [a.c2], [a.c3], [b.c1], [b.c2], [b.c3]), filter(nil),
|
||||
equal_conds([a.c1 = b.c1]), other_conds(nil)
|
||||
3 - output([a.c1], [a.c2], [a.c3]), filter(nil), sort_keys([a.c1, ASC])
|
||||
4 - output([a.c1], [a.c2], [a.c3]), filter(nil), dop=2
|
||||
5 - output([a.c1], [a.c2], [a.c3]), filter(nil)
|
||||
6 - output([a.c1], [a.c2], [a.c3]), filter(nil),
|
||||
access([a.c1], [a.c2], [a.c3])
|
||||
7 - output([t1.c1], [t1.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
8 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), sort_keys([t1.c1, ASC], [t1.c2, ASC])
|
||||
9 - (#keys=2, [t1.c1], [t1.c2]), output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), dop=2
|
||||
10 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil),
|
||||
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT(*)])
|
||||
11 - output([t1.c1], [t1.c2]), filter(nil), sort_keys([t1.c1, ASC], [t1.c2, ASC])
|
||||
12 - output([t1.c1], [t1.c2]), filter(nil)
|
||||
13 - output([t1.c1], [t1.c2]), filter(nil),
|
||||
access([t1.c1], [t1.c2]), partitions(p0)
|
||||
14 - output([b.c1], [b.c2], [b.c3]), filter(nil), sort_keys([b.c1, ASC])
|
||||
15 - output([b.c1], [b.c2], [b.c3]), filter(nil)
|
||||
16 - output([b.c1], [b.c2], [b.c3]), filter(nil),
|
||||
access([b.c1], [b.c2], [b.c3]), partitions(p0)
|
||||
|
||||
@ -0,0 +1,137 @@
|
||||
drop database if exists muhangtest;
|
||||
drop table if exists t1;
|
||||
create database muhangtest;
|
||||
use muhangtest;
|
||||
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;
|
||||
Query Plan
|
||||
======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |400000 |313022|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|400000 |256226|
|
||||
|2 | PX PARTITION ITERATOR| |400000 |256226|
|
||||
|3 | TABLE SCAN |t1 |400000 |256226|
|
||||
======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil)
|
||||
1 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), dop=1
|
||||
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil)
|
||||
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil),
|
||||
access([t1.c2], [t1.c1], [t1.c3]), partitions(p[0-3])
|
||||
|
||||
explain select /*+use_px*/ * from t1;
|
||||
Query Plan
|
||||
======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |400000 |313022|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|400000 |256226|
|
||||
|2 | PX PARTITION ITERATOR| |400000 |256226|
|
||||
|3 | TABLE SCAN |t1 |400000 |256226|
|
||||
======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil)
|
||||
1 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), dop=1
|
||||
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil)
|
||||
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil),
|
||||
access([t1.c2], [t1.c1], [t1.c3]), partitions(p[0-3])
|
||||
|
||||
explain select /*+use_px parallel(15)*/ * from t1;
|
||||
Query Plan
|
||||
==================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
--------------------------------------------------
|
||||
|0 |PX COORDINATOR | |400000 |313022|
|
||||
|1 | EXCHANGE OUT DISTR|:EX10000|400000 |256226|
|
||||
|2 | PX BLOCK ITERATOR| |400000 |256226|
|
||||
|3 | TABLE SCAN |t1 |400000 |256226|
|
||||
==================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil)
|
||||
1 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), dop=15
|
||||
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil)
|
||||
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil),
|
||||
access([t1.c2], [t1.c1], [t1.c3]), partitions(p[0-3])
|
||||
|
||||
explain select /*+no_use_px */ * from t1;
|
||||
Query Plan
|
||||
======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |400000 |313022|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|400000 |256226|
|
||||
|2 | PX PARTITION ITERATOR| |400000 |256226|
|
||||
|3 | TABLE SCAN |t1 |400000 |256226|
|
||||
======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil)
|
||||
1 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), dop=1
|
||||
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil)
|
||||
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil),
|
||||
access([t1.c2], [t1.c1], [t1.c3]), partitions(p[0-3])
|
||||
|
||||
explain select /*+no_use_px use_px*/ * from t1;
|
||||
Query Plan
|
||||
======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |400000 |313022|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|400000 |256226|
|
||||
|2 | PX PARTITION ITERATOR| |400000 |256226|
|
||||
|3 | TABLE SCAN |t1 |400000 |256226|
|
||||
======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil)
|
||||
1 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), dop=1
|
||||
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil)
|
||||
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil),
|
||||
access([t1.c2], [t1.c1], [t1.c3]), partitions(p[0-3])
|
||||
|
||||
explain select /*+use_px no_use_px */ * from t1;
|
||||
Query Plan
|
||||
======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |400000 |313022|
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|400000 |256226|
|
||||
|2 | PX PARTITION ITERATOR| |400000 |256226|
|
||||
|3 | TABLE SCAN |t1 |400000 |256226|
|
||||
======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil)
|
||||
1 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), dop=1
|
||||
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil)
|
||||
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil),
|
||||
access([t1.c2], [t1.c1], [t1.c3]), partitions(p[0-3])
|
||||
|
||||
|
||||
drop table if exists t7;
|
||||
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);
|
||||
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);
|
||||
+---+------+------+------+---+------+------+------+
|
||||
| a | b | c | d | a | b | c | d |
|
||||
+---+------+------+------+---+------+------+------+
|
||||
| 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 5 | 6 | 2 | 3 | 5 | 6 |
|
||||
+---+------+------+------+---+------+------+------+
|
||||
|
||||
drop table if exists t1;
|
||||
drop table if exists t7;
|
||||
drop database if exists muhangtest;
|
||||
2008
tools/deploy/mysql_test/test_suite/px/r/mysql/dml_use_px.result
Normal file
2008
tools/deploy/mysql_test/test_suite/px/r/mysql/dml_use_px.result
Normal file
File diff suppressed because it is too large
Load Diff
129
tools/deploy/mysql_test/test_suite/px/r/mysql/join_mj.result
Normal file
129
tools/deploy/mysql_test/test_suite/px/r/mysql/join_mj.result
Normal file
@ -0,0 +1,129 @@
|
||||
set ob_query_timeout=1000000000;
|
||||
drop database if exists px_test;
|
||||
create database px_test;
|
||||
use px_test;
|
||||
create table stu (
|
||||
sid int,
|
||||
name varchar(32),
|
||||
cls int,
|
||||
primary key (cls, sid)
|
||||
) partition by hash(sid) partitions 6;
|
||||
create table teacher (
|
||||
tid int,
|
||||
name varchar(32),
|
||||
subject varchar(4),
|
||||
primary key (tid)
|
||||
) partition by hash(tid) partitions 8;
|
||||
create table score (
|
||||
sid int,
|
||||
subject varchar(4),
|
||||
score int,
|
||||
primary key (sid, subject)
|
||||
) partition by hash(sid) partitions 6;
|
||||
insert into stu values
|
||||
(11, 'a1', 1),
|
||||
(12, 'b1', 1),
|
||||
(13, 'c1', 1),
|
||||
(21, 'a2', 2),
|
||||
(22, 'b2', 2),
|
||||
(31, 'a3', 3),
|
||||
(41, 'a4', 4),
|
||||
(42, 'b4', 4),
|
||||
(51, 'a5', 5),
|
||||
(52, 'b5', 5),
|
||||
(61, 'a6', 6),
|
||||
(62, 'b6', 6),
|
||||
(63, 'c6', 6),
|
||||
(64, 'd6', 6);
|
||||
insert into teacher values
|
||||
(1, 'Miss Zhang', 'EN'),
|
||||
(2, 'Mr Wang', 'MA');
|
||||
insert into score values
|
||||
(11, 'EN', 60),
|
||||
(12, 'EN', 70),
|
||||
(13, 'EN', 80),
|
||||
(21, 'EN', 58),
|
||||
(22, 'EN', 90),
|
||||
(31, 'EN', 80),
|
||||
(41, 'EN', 80),
|
||||
(42, 'EN', 90),
|
||||
(51, 'EN', 89),
|
||||
(52, 'EN', 99),
|
||||
(61, 'EN', 100),
|
||||
(62, 'EN', 90),
|
||||
(63, 'EN', 99),
|
||||
(64, 'EN', 87);
|
||||
insert into score values
|
||||
(11, 'MA', 60),
|
||||
(12, 'MA', 70),
|
||||
(13, 'MA', 80),
|
||||
(21, 'MA', 58),
|
||||
(22, 'MA', 90),
|
||||
(31, 'MA', 80),
|
||||
(41, 'MA', 80),
|
||||
(42, 'MA', 90),
|
||||
(51, 'MA', 89),
|
||||
(52, 'MA', 99),
|
||||
(61, 'MA', 100),
|
||||
(62, 'MA', 90),
|
||||
(63, 'MA', 99),
|
||||
(64, 'MA', 87);
|
||||
explain select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid order by score.sid;
|
||||
Query Plan
|
||||
=======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
-------------------------------------------------------
|
||||
|0 |PX COORDINATOR MERGE SORT | |12 |145 |
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|12 |140 |
|
||||
|2 | SORT | |12 |140 |
|
||||
|3 | PX PARTITION ITERATOR | |12 |113 |
|
||||
|4 | MERGE JOIN | |12 |113 |
|
||||
|5 | TABLE SCAN |score |24 |41 |
|
||||
|6 | SORT | |12 |60 |
|
||||
|7 | TABLE SCAN |stu |12 |39 |
|
||||
=======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil), sort_keys([score.sid, ASC])
|
||||
1 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil), dop=2
|
||||
2 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil), sort_keys([score.sid, ASC]), local merge sort
|
||||
3 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil)
|
||||
4 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil),
|
||||
equal_conds([stu.sid = score.sid]), other_conds(nil)
|
||||
5 - output([score.sid], [score.subject], [score.score]), filter(nil),
|
||||
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
|
||||
6 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), sort_keys([stu.sid, ASC])
|
||||
7 - output([stu.sid], [stu.name], [stu.cls]), filter(nil),
|
||||
access([stu.sid], [stu.name], [stu.cls]), partitions(p[0-5])
|
||||
|
||||
select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid order by score.sid;
|
||||
sid name cls sid subject score
|
||||
11 a1 1 11 EN 60
|
||||
11 a1 1 11 MA 60
|
||||
12 b1 1 12 EN 70
|
||||
12 b1 1 12 MA 70
|
||||
13 c1 1 13 EN 80
|
||||
13 c1 1 13 MA 80
|
||||
21 a2 2 21 EN 58
|
||||
21 a2 2 21 MA 58
|
||||
22 b2 2 22 EN 90
|
||||
22 b2 2 22 MA 90
|
||||
31 a3 3 31 EN 80
|
||||
31 a3 3 31 MA 80
|
||||
41 a4 4 41 EN 80
|
||||
41 a4 4 41 MA 80
|
||||
42 b4 4 42 EN 90
|
||||
42 b4 4 42 MA 90
|
||||
51 a5 5 51 EN 89
|
||||
51 a5 5 51 MA 89
|
||||
52 b5 5 52 EN 99
|
||||
52 b5 5 52 MA 99
|
||||
61 a6 6 61 EN 100
|
||||
61 a6 6 61 MA 100
|
||||
62 b6 6 62 EN 90
|
||||
62 b6 6 62 MA 90
|
||||
63 c6 6 63 EN 99
|
||||
63 c6 6 63 MA 99
|
||||
64 d6 6 64 EN 87
|
||||
64 d6 6 64 MA 87
|
||||
210
tools/deploy/mysql_test/test_suite/px/r/mysql/join_nlj.result
Normal file
210
tools/deploy/mysql_test/test_suite/px/r/mysql/join_nlj.result
Normal file
@ -0,0 +1,210 @@
|
||||
set ob_query_timeout=1000000000;
|
||||
drop database if exists px_test;
|
||||
create database px_test;
|
||||
use px_test;
|
||||
create table stu (
|
||||
sid int,
|
||||
name varchar(32),
|
||||
cls int,
|
||||
primary key (cls, sid)
|
||||
) partition by hash(sid) partitions 6;
|
||||
create table teacher (
|
||||
tid int,
|
||||
name varchar(32),
|
||||
subject varchar(4),
|
||||
primary key (tid)
|
||||
) partition by hash(tid) partitions 8;
|
||||
create table score (
|
||||
sid int,
|
||||
subject varchar(4),
|
||||
score int,
|
||||
primary key (sid, subject)
|
||||
) partition by hash(sid) partitions 6;
|
||||
insert into stu values
|
||||
(11, 'a1', 1),
|
||||
(12, 'b1', 1),
|
||||
(13, 'c1', 1),
|
||||
(21, 'a2', 2),
|
||||
(22, 'b2', 2),
|
||||
(31, 'a3', 3),
|
||||
(41, 'a4', 4),
|
||||
(42, 'b4', 4),
|
||||
(51, 'a5', 5),
|
||||
(52, 'b5', 5),
|
||||
(61, 'a6', 6),
|
||||
(62, 'b6', 6),
|
||||
(63, 'c6', 6),
|
||||
(64, 'd6', 6);
|
||||
insert into teacher values
|
||||
(1, 'Miss Zhang', 'EN'),
|
||||
(2, 'Mr Wang', 'MA');
|
||||
insert into score values
|
||||
(11, 'EN', 60),
|
||||
(12, 'EN', 70),
|
||||
(13, 'EN', 80),
|
||||
(21, 'EN', 58),
|
||||
(22, 'EN', 90),
|
||||
(31, 'EN', 80),
|
||||
(41, 'EN', 80),
|
||||
(42, 'EN', 90),
|
||||
(51, 'EN', 89),
|
||||
(52, 'EN', 99),
|
||||
(61, 'EN', 100),
|
||||
(62, 'EN', 90),
|
||||
(63, 'EN', 99),
|
||||
(64, 'EN', 87);
|
||||
insert into score values
|
||||
(11, 'MA', 60),
|
||||
(12, 'MA', 70),
|
||||
(13, 'MA', 80),
|
||||
(21, 'MA', 58),
|
||||
(22, 'MA', 90),
|
||||
(31, 'MA', 80),
|
||||
(41, 'MA', 80),
|
||||
(42, 'MA', 90),
|
||||
(51, 'MA', 89),
|
||||
(52, 'MA', 99),
|
||||
(61, 'MA', 100),
|
||||
(62, 'MA', 90),
|
||||
(63, 'MA', 99),
|
||||
(64, 'MA', 87);
|
||||
explain select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid != score.sid and stu.sid < 12;
|
||||
Query Plan
|
||||
================================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
----------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |15 |106 |
|
||||
|1 | EXCHANGE OUT DISTR |:EX10001|15 |100 |
|
||||
|2 | NESTED-LOOP JOIN | |15 |100 |
|
||||
|3 | PX BLOCK ITERATOR | |24 |41 |
|
||||
|4 | TABLE SCAN |score |24 |41 |
|
||||
|5 | MATERIAL | |2 |42 |
|
||||
|6 | EXCHANGE IN DISTR | |2 |41 |
|
||||
|7 | EXCHANGE OUT DISTR (BROADCAST)|:EX10000|2 |41 |
|
||||
|8 | PX BLOCK ITERATOR | |2 |41 |
|
||||
|9 | TABLE SCAN |stu |2 |41 |
|
||||
================================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil)
|
||||
1 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil), dop=2
|
||||
2 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil),
|
||||
conds([stu.sid != score.sid]), nl_params_(nil)
|
||||
3 - output([score.sid], [score.subject], [score.score]), filter(nil)
|
||||
4 - output([score.sid], [score.subject], [score.score]), filter(nil),
|
||||
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
|
||||
5 - output([stu.sid], [stu.name], [stu.cls]), filter(nil)
|
||||
6 - output([stu.sid], [stu.name], [stu.cls]), filter(nil)
|
||||
7 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), dop=2
|
||||
8 - output([stu.sid], [stu.name], [stu.cls]), filter(nil)
|
||||
9 - output([stu.sid], [stu.name], [stu.cls]), filter([stu.sid < 12]),
|
||||
access([stu.sid], [stu.name], [stu.cls]), partitions(p[0-5])
|
||||
|
||||
select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid != score.sid and stu.sid < 12;
|
||||
sid name cls sid subject score
|
||||
11 a1 1 12 EN 70
|
||||
11 a1 1 12 MA 70
|
||||
11 a1 1 13 EN 80
|
||||
11 a1 1 13 MA 80
|
||||
11 a1 1 21 EN 58
|
||||
11 a1 1 21 MA 58
|
||||
11 a1 1 22 EN 90
|
||||
11 a1 1 22 MA 90
|
||||
11 a1 1 31 EN 80
|
||||
11 a1 1 31 MA 80
|
||||
11 a1 1 41 EN 80
|
||||
11 a1 1 41 MA 80
|
||||
11 a1 1 42 EN 90
|
||||
11 a1 1 42 MA 90
|
||||
11 a1 1 51 EN 89
|
||||
11 a1 1 51 MA 89
|
||||
11 a1 1 52 EN 99
|
||||
11 a1 1 52 MA 99
|
||||
11 a1 1 61 EN 100
|
||||
11 a1 1 61 MA 100
|
||||
11 a1 1 62 EN 90
|
||||
11 a1 1 62 MA 90
|
||||
11 a1 1 63 EN 99
|
||||
11 a1 1 63 MA 99
|
||||
11 a1 1 64 EN 87
|
||||
11 a1 1 64 MA 87
|
||||
explain select /*+ USE_PX parallel(2) */ * from score, teacher where teacher.subject = score.subject and teacher.tid = 1;
|
||||
Query Plan
|
||||
===============================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
---------------------------------------------------------------
|
||||
|0 |PX COORDINATOR | |1 |109 |
|
||||
|1 | EXCHANGE OUT DISTR |:EX10001|1 |109 |
|
||||
|2 | NESTED-LOOP JOIN | |1 |109 |
|
||||
|3 | EXCHANGE IN DISTR | |1 |53 |
|
||||
|4 | EXCHANGE OUT DISTR (BROADCAST)|:EX10000|1 |53 |
|
||||
|5 | PX BLOCK ITERATOR | |1 |53 |
|
||||
|6 | TABLE GET |teacher |1 |53 |
|
||||
|7 | PX BLOCK ITERATOR | |24 |41 |
|
||||
|8 | TABLE SCAN |score |24 |41 |
|
||||
===============================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([score.sid], [score.subject], [score.score], [teacher.tid], [teacher.name], [teacher.subject]), filter(nil)
|
||||
1 - output([score.sid], [score.subject], [score.score], [teacher.tid], [teacher.name], [teacher.subject]), filter(nil), dop=2
|
||||
2 - output([score.sid], [score.subject], [score.score], [teacher.tid], [teacher.name], [teacher.subject]), filter(nil),
|
||||
conds([teacher.subject = score.subject]), nl_params_(nil)
|
||||
3 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil)
|
||||
4 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil), dop=2
|
||||
5 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil)
|
||||
6 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil),
|
||||
access([teacher.tid], [teacher.subject], [teacher.name]), partitions(p1)
|
||||
7 - output([score.sid], [score.subject], [score.score]), filter(nil)
|
||||
8 - output([score.sid], [score.subject], [score.score]), filter(nil),
|
||||
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
|
||||
|
||||
select /*+ USE_PX parallel(2) */ * from score, teacher where teacher.subject = score.subject and teacher.tid = 1;
|
||||
sid subject score tid name subject
|
||||
11 EN 60 1 Miss Zhang EN
|
||||
12 EN 70 1 Miss Zhang EN
|
||||
13 EN 80 1 Miss Zhang EN
|
||||
21 EN 58 1 Miss Zhang EN
|
||||
22 EN 90 1 Miss Zhang EN
|
||||
31 EN 80 1 Miss Zhang EN
|
||||
41 EN 80 1 Miss Zhang EN
|
||||
42 EN 90 1 Miss Zhang EN
|
||||
51 EN 89 1 Miss Zhang EN
|
||||
52 EN 99 1 Miss Zhang EN
|
||||
61 EN 100 1 Miss Zhang EN
|
||||
62 EN 90 1 Miss Zhang EN
|
||||
63 EN 99 1 Miss Zhang EN
|
||||
64 EN 87 1 Miss Zhang EN
|
||||
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;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |89 |
|
||||
|1 | TABLE GET |t2 |1 |53 |
|
||||
|2 | TABLE GET |t1 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.pname], [t2.oid], [t2.amount]), filter(nil),
|
||||
conds(nil), nl_params_([t2.pid])
|
||||
1 - output([t2.oid], [t2.pid], [t2.amount]), filter(nil),
|
||||
access([t2.oid], [t2.pid], [t2.amount]), partitions(p65)
|
||||
2 - output([t1.pname]), filter(nil),
|
||||
access([t1.pname]), partitions(p0)
|
||||
|
||||
select t1.pname,t2.oid,t2.amount from product t1,orders t2 where t2.oid = 314265 and t1.pid=t2.pid;
|
||||
pname oid amount
|
||||
abcd 314265 678
|
||||
127
tools/deploy/mysql_test/test_suite/px/r/mysql/join_pwj.result
Normal file
127
tools/deploy/mysql_test/test_suite/px/r/mysql/join_pwj.result
Normal file
@ -0,0 +1,127 @@
|
||||
set ob_query_timeout=1000000000;
|
||||
drop database if exists px_test;
|
||||
create database px_test;
|
||||
use px_test;
|
||||
create table stu (
|
||||
sid int,
|
||||
name varchar(32),
|
||||
cls int,
|
||||
primary key (cls, sid)
|
||||
) partition by hash(sid) partitions 6;
|
||||
create table teacher (
|
||||
tid int,
|
||||
name varchar(32),
|
||||
subject varchar(4),
|
||||
primary key (tid)
|
||||
) partition by hash(tid) partitions 8;
|
||||
create table score (
|
||||
sid int,
|
||||
subject varchar(4),
|
||||
score int,
|
||||
primary key (sid, subject)
|
||||
) partition by hash(sid) partitions 6;
|
||||
insert into stu values
|
||||
(11, 'a1', 1),
|
||||
(12, 'b1', 1),
|
||||
(13, 'c1', 1),
|
||||
(21, 'a2', 2),
|
||||
(22, 'b2', 2),
|
||||
(31, 'a3', 3),
|
||||
(41, 'a4', 4),
|
||||
(42, 'b4', 4),
|
||||
(51, 'a5', 5),
|
||||
(52, 'b5', 5),
|
||||
(61, 'a6', 6),
|
||||
(62, 'b6', 6),
|
||||
(63, 'c6', 6),
|
||||
(64, 'd6', 6);
|
||||
insert into teacher values
|
||||
(1, 'Miss Zhang', 'EN'),
|
||||
(2, 'Mr Wang', 'MA');
|
||||
insert into score values
|
||||
(11, 'EN', 60),
|
||||
(12, 'EN', 70),
|
||||
(13, 'EN', 80),
|
||||
(21, 'EN', 58),
|
||||
(22, 'EN', 90),
|
||||
(31, 'EN', 80),
|
||||
(41, 'EN', 80),
|
||||
(42, 'EN', 90),
|
||||
(51, 'EN', 89),
|
||||
(52, 'EN', 99),
|
||||
(61, 'EN', 100),
|
||||
(62, 'EN', 90),
|
||||
(63, 'EN', 99),
|
||||
(64, 'EN', 87);
|
||||
insert into score values
|
||||
(11, 'MA', 60),
|
||||
(12, 'MA', 70),
|
||||
(13, 'MA', 80),
|
||||
(21, 'MA', 58),
|
||||
(22, 'MA', 90),
|
||||
(31, 'MA', 80),
|
||||
(41, 'MA', 80),
|
||||
(42, 'MA', 90),
|
||||
(51, 'MA', 89),
|
||||
(52, 'MA', 99),
|
||||
(61, 'MA', 100),
|
||||
(62, 'MA', 90),
|
||||
(63, 'MA', 99),
|
||||
(64, 'MA', 87);
|
||||
explain select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid;
|
||||
Query Plan
|
||||
====================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST|
|
||||
----------------------------------------------------
|
||||
|0 |PX COORDINATOR | |12 |118 |
|
||||
|1 | EXCHANGE OUT DISTR |:EX10000|12 |113 |
|
||||
|2 | PX PARTITION ITERATOR| |12 |113 |
|
||||
|3 | MERGE JOIN | |12 |113 |
|
||||
|4 | SORT | |12 |60 |
|
||||
|5 | TABLE SCAN |stu |12 |39 |
|
||||
|6 | TABLE SCAN |score |24 |41 |
|
||||
====================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil)
|
||||
1 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil), dop=2
|
||||
2 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil)
|
||||
3 - output([stu.sid], [stu.name], [stu.cls], [score.sid], [score.subject], [score.score]), filter(nil),
|
||||
equal_conds([stu.sid = score.sid]), other_conds(nil)
|
||||
4 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), sort_keys([stu.sid, ASC])
|
||||
5 - output([stu.sid], [stu.name], [stu.cls]), filter(nil),
|
||||
access([stu.sid], [stu.name], [stu.cls]), partitions(p[0-5])
|
||||
6 - output([score.sid], [score.subject], [score.score]), filter(nil),
|
||||
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
|
||||
|
||||
select /*+ USE_PX parallel(2) */ * from stu, score where stu.sid = score.sid;
|
||||
sid name cls sid subject score
|
||||
11 a1 1 11 EN 60
|
||||
11 a1 1 11 MA 60
|
||||
12 b1 1 12 EN 70
|
||||
12 b1 1 12 MA 70
|
||||
13 c1 1 13 EN 80
|
||||
13 c1 1 13 MA 80
|
||||
21 a2 2 21 EN 58
|
||||
21 a2 2 21 MA 58
|
||||
22 b2 2 22 EN 90
|
||||
22 b2 2 22 MA 90
|
||||
31 a3 3 31 EN 80
|
||||
31 a3 3 31 MA 80
|
||||
41 a4 4 41 EN 80
|
||||
41 a4 4 41 MA 80
|
||||
42 b4 4 42 EN 90
|
||||
42 b4 4 42 MA 90
|
||||
51 a5 5 51 EN 89
|
||||
51 a5 5 51 MA 89
|
||||
52 b5 5 52 EN 99
|
||||
52 b5 5 52 MA 99
|
||||
61 a6 6 61 EN 100
|
||||
61 a6 6 61 MA 100
|
||||
62 b6 6 62 EN 90
|
||||
62 b6 6 62 MA 90
|
||||
63 c6 6 63 EN 99
|
||||
63 c6 6 63 MA 99
|
||||
64 d6 6 64 EN 87
|
||||
64 d6 6 64 MA 87
|
||||
123
tools/deploy/mysql_test/test_suite/px/r/mysql/sql_audit.result
Normal file
123
tools/deploy/mysql_test/test_suite/px/r/mysql/sql_audit.result
Normal file
@ -0,0 +1,123 @@
|
||||
result_format: 4
|
||||
set ob_query_timeout=1000000000;
|
||||
drop database if exists px_test;
|
||||
create database px_test;
|
||||
use px_test;
|
||||
|
||||
create table stu (
|
||||
sid int,
|
||||
name varchar(32),
|
||||
cls int,
|
||||
primary key (cls, sid)
|
||||
) partition by hash(sid) partitions 6;
|
||||
|
||||
create table teacher (
|
||||
tid int,
|
||||
name varchar(32),
|
||||
subject varchar(4),
|
||||
primary key (tid)
|
||||
) partition by hash(tid) partitions 8;
|
||||
|
||||
create table score (
|
||||
sid int,
|
||||
subject varchar(4),
|
||||
score int,
|
||||
primary key (sid, subject)
|
||||
) partition by hash(sid) partitions 6;
|
||||
|
||||
insert into stu values
|
||||
(11, 'a1', 1),
|
||||
(12, 'b1', 1),
|
||||
(13, 'c1', 1),
|
||||
|
||||
(21, 'a2', 2),
|
||||
(22, 'b2', 2),
|
||||
|
||||
(31, 'a3', 3),
|
||||
|
||||
(41, 'a4', 4),
|
||||
(42, 'b4', 4),
|
||||
|
||||
(51, 'a5', 5),
|
||||
(52, 'b5', 5),
|
||||
|
||||
(61, 'a6', 6),
|
||||
(62, 'b6', 6),
|
||||
(63, 'c6', 6),
|
||||
(64, 'd6', 6);
|
||||
|
||||
insert into teacher values
|
||||
(1, 'Miss Zhang', 'EN'),
|
||||
(2, 'Mr Wang', 'MA');
|
||||
|
||||
insert into score values
|
||||
(11, 'EN', 60),
|
||||
(12, 'EN', 70),
|
||||
(13, 'EN', 80),
|
||||
|
||||
(21, 'EN', 58),
|
||||
(22, 'EN', 90),
|
||||
|
||||
(31, 'EN', 80),
|
||||
|
||||
(41, 'EN', 80),
|
||||
(42, 'EN', 90),
|
||||
|
||||
(51, 'EN', 89),
|
||||
(52, 'EN', 99),
|
||||
|
||||
(61, 'EN', 100),
|
||||
(62, 'EN', 90),
|
||||
(63, 'EN', 99),
|
||||
(64, 'EN', 87);
|
||||
|
||||
insert into score values
|
||||
(11, 'MA', 60),
|
||||
(12, 'MA', 70),
|
||||
(13, 'MA', 80),
|
||||
|
||||
(21, 'MA', 58),
|
||||
(22, 'MA', 90),
|
||||
|
||||
(31, 'MA', 80),
|
||||
|
||||
(41, 'MA', 80),
|
||||
(42, 'MA', 90),
|
||||
|
||||
(51, 'MA', 89),
|
||||
(52, 'MA', 99),
|
||||
|
||||
(61, 'MA', 100),
|
||||
(62, 'MA', 90),
|
||||
(63, 'MA', 99),
|
||||
(64, 'MA', 87);
|
||||
|
||||
alter system set enable_sql_audit = true;
|
||||
alter system flush sql audit global;
|
||||
|
||||
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ * from teacher;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ * from teacher;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(4) */ * from teacher;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ subject, avg(score), max(score), min(score) from score group by subject;
|
||||
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;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ subject, avg(score), max(score), min(score) from score group by subject;
|
||||
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;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject;
|
||||
|
||||
|
||||
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;
|
||||
+--------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+-------------------+
|
||||
| query_sql | EXPECTED_WORKER_COUNT | USED_WORKER_COUNT |
|
||||
+--------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+-------------------+
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ * from teacher | 2 | 2 |
|
||||
| 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 | 4 | 4 |
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject | 4 | 4 |
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ subject, avg(score), max(score), min(score) from score group by subject | 4 | 4 |
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ * from teacher | 3 | 3 |
|
||||
| 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 | 6 | 6 |
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject | 6 | 6 |
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ subject, avg(score), max(score), min(score) from score group by subject | 6 | 6 |
|
||||
| select /*+ TEST_SQL_AUDIT USE_PX parallel(4) */ * from teacher | 4 | 4 |
|
||||
+--------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+-------------------+
|
||||
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