[FEAT MERGE]4_1_sql_feature

Co-authored-by: leslieyuchen <leslieyuchen@gmail.com>
Co-authored-by: Charles0429 <xiezhenjiang@gmail.com>
Co-authored-by: raywill <hustos@gmail.com>
This commit is contained in:
obdev
2023-01-28 16:01:26 +08:00
committed by ob-robot
parent 3080f2b66f
commit 2d19a9d8f5
846 changed files with 161957 additions and 116661 deletions

View File

@ -24,22 +24,27 @@ Query Plan
|7 | PX BLOCK ITERATOR | |
|8 | TABLE SCAN |t2 |
===========================================
Outputs & filters:
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=256, dop=3
2 - output([t1.c1], [t2.c1]), filter(nil), rowset=256,
1 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=256
dop=3
2 - output([t1.c1], [t2.c1]), filter(nil), rowset=256
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
3 - output([t1.c1]), filter(nil), rowset=256
4 - output([t1.c1]), filter(nil), rowset=256,
affinitize
4 - output([t1.c1]), filter(nil), rowset=256
access([t1.c1]), partitions(p[0-9])
is_index_back=false, is_global_index=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256
6 - (#keys=1, [t2.c1]), output([t2.c1]), filter(nil), rowset=256, dop=3
6 - output([t2.c1]), filter(nil), rowset=256
(#keys=1, [t2.c1]), dop=3
7 - output([t2.c1]), filter(nil), rowset=256
8 - output([t2.c1]), filter(nil), rowset=256,
8 - output([t2.c1]), filter(nil), rowset=256
access([t2.c1]), partitions(p[0-5])
is_index_back=false, is_global_index=false,
range_key([t2.c1]), range(MIN ; MAX)always true
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
@ -76,29 +81,35 @@ Query Plan
|12| PX PARTITION HASH JOIN-FILTER|:BF0000 |
|13| TABLE SCAN |a |
==================================================
Outputs & filters:
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(a.c2, T_FUN_COUNT_SUM(T_FUN_COUNT(*)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(a.c2, T_FUN_COUNT_SUM(T_FUN_COUNT(*)))]), filter(nil), rowset=256, dop=3
2 - output([a.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=256,
1 - output([INTERNAL_FUNCTION(a.c2, T_FUN_COUNT_SUM(T_FUN_COUNT(*)))]), filter(nil), rowset=256
dop=3
2 - output([a.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=256
group([a.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
3 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
4 - (#keys=1, [a.c2]), output([a.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256, dop=3
5 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256,
4 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
(#keys=1, [a.c2]), dop=3
5 - output([a.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
group([a.c2]), agg_func([T_FUN_COUNT(*)])
6 - output([a.c2]), filter(nil), rowset=256,
6 - output([a.c2]), filter(nil), rowset=256
equal_conds([a.c1 = b.c1]), other_conds(nil)
7 - output([b.c1]), filter(nil), rowset=256
8 - output([b.c1]), filter(nil), rowset=256
9 - (#keys=1, [b.c1]), output([b.c1]), filter(nil), rowset=256, dop=3
10 - output([b.c1]), filter(nil), rowset=256
11 - output([b.c1]), filter(nil), rowset=256,
9 - output([b.c1]), filter(nil), rowset=256
(#keys=1, [b.c1]), dop=3
10 - output([b.c1]), filter(nil), rowset=256
11 - output([b.c1]), filter(nil), rowset=256
access([b.c1]), partitions(p[0-5])
12 - output([a.c1], [a.c2]), filter(nil), rowset=256
13 - output([a.c1], [a.c2], [PARTITION_ID]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([b.c1]), range(MIN ; MAX)always true
12 - output([a.c1], [a.c2]), filter(nil), rowset=256
affinitize
13 - output([a.c1], [a.c2], [PARTITION_ID]), filter(nil), rowset=256
access([a.c1], [a.c2]), partitions(p[0-9])
is_index_back=false, is_global_index=false,
range_key([a.c1]), range(MIN ; MAX)always true
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

View File

@ -3,162 +3,186 @@ 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 |TEMP TABLE TRANSFORMATION | |1 |5 |
|1 | PX COORDINATOR | |1 |4 |
|2 | EXCHANGE OUT DISTR |:EX10001 |1 |4 |
|3 | TEMP TABLE INSERT |TEMP1 |1 |3 |
|4 | HASH GROUP BY | |1 |3 |
|5 | EXCHANGE IN DISTR | |2 |3 |
|6 | EXCHANGE OUT DISTR (HASH) |:EX10000 |2 |3 |
|7 | HASH GROUP BY | |2 |2 |
|8 | PX BLOCK ITERATOR | |1 |1 |
|9 | TABLE SCAN |t1 |1 |1 |
|10| PX COORDINATOR | |1 |2 |
|11| EXCHANGE OUT DISTR |:EX20002 |1 |2 |
|12| SHARED HASH JOIN | |1 |1 |
|13| EXCHANGE IN DISTR | |1 |1 |
|14| EXCHANGE OUT DISTR (BC2HOST) |:EX20001 |1 |1 |
|15| SHARED HASH JOIN | |1 |1 |
|16| EXCHANGE IN DISTR | |1 |1 |
|17| EXCHANGE OUT DISTR (BC2HOST)|:EX20000 |1 |1 |
|18| TEMP TABLE ACCESS |VIEW2(TEMP1)|1 |1 |
|19| TEMP TABLE ACCESS |VIEW3(TEMP1)|1 |1 |
|20| TEMP TABLE ACCESS |VIEW1(TEMP1)|1 |1 |
=====================================================================
Outputs & filters:
============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------------------
|0 |TEMP TABLE TRANSFORMATION | |1 |5 |
|1 | PX COORDINATOR | |1 |4 |
|2 | EXCHANGE OUT DISTR |:EX10001 |1 |4 |
|3 | TEMP TABLE INSERT |TEMP1 |1 |3 |
|4 | HASH GROUP BY | |1 |3 |
|5 | EXCHANGE IN DISTR | |2 |3 |
|6 | EXCHANGE OUT DISTR (HASH) |:EX10000 |2 |3 |
|7 | HASH GROUP BY | |2 |2 |
|8 | PX BLOCK ITERATOR | |1 |1 |
|9 | TABLE SCAN |t1 |1 |1 |
|10| PX COORDINATOR | |1 |2 |
|11| EXCHANGE OUT DISTR |:EX20002 |1 |2 |
|12| SHARED HASH JOIN | |1 |1 |
|13| EXCHANGE IN DISTR | |1 |1 |
|14| EXCHANGE OUT DISTR (BC2HOST) |:EX20001 |1 |1 |
|15| SHARED HASH JOIN | |1 |1 |
|16| EXCHANGE IN DISTR | |1 |1 |
|17| EXCHANGE OUT DISTR (BC2HOST)|:EX20000 |1 |1 |
|18| TEMP TABLE ACCESS |VIEW2(TEMP1)|1 |1 |
|19| TEMP TABLE ACCESS |VIEW3(TEMP1)|1 |1 |
|20| TEMP TABLE ACCESS |VIEW1(TEMP1)|1 |1 |
============================================================================
Outputs & filters:
-------------------------------------
0 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256
1 - output(nil), filter(nil), rowset=256
2 - output(nil), filter(nil), rowset=256, dop=2
2 - output(nil), filter(nil), rowset=256
dop=2
3 - output(nil), filter(nil), rowset=256
4 - output([t1.c1], [t1.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=256,
4 - output([t1.c1], [t1.c2], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=256
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
5 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
6 - (#keys=2, [t1.c1], [t1.c2]), output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256, dop=2
7 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256,
6 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
(#keys=2, [t1.c1], [t1.c2]), dop=2
7 - output([t1.c1], [t1.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
group([t1.c1], [t1.c2]), agg_func([T_FUN_COUNT(*)])
8 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
9 - output([t1.c1], [t1.c2]), filter(nil), rowset=256,
9 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
access([t1.c1], [t1.c2]), partitions(p0)
10 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256
11 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256, dop=2
12 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
10 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256
11 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256
dop=2
12 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)], [VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256
equal_conds([VIEW2.t1.c2 = VIEW1.t1.c2]), other_conds(nil)
13 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256
14 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256, dop=2
15 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256,
13 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256
14 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256
dop=2
15 - output([VIEW2.t1.c2], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256
equal_conds([VIEW2.t1.c1 = VIEW3.t1.c1]), other_conds(nil)
16 - output([VIEW2.t1.c2], [VIEW2.t1.c1]), filter(nil), rowset=256
17 - output([VIEW2.t1.c2], [VIEW2.t1.c1]), filter(nil), rowset=256, dop=2
18 - output([VIEW2.t1.c1], [VIEW2.t1.c2]), filter(nil), rowset=256,
16 - output([VIEW2.t1.c2], [VIEW2.t1.c1]), filter(nil), rowset=256
17 - output([VIEW2.t1.c2], [VIEW2.t1.c1]), filter(nil), rowset=256
dop=2
18 - output([VIEW2.t1.c1], [VIEW2.t1.c2]), filter(nil), rowset=256
access([VIEW2.t1.c1], [VIEW2.t1.c2])
19 - output([VIEW3.t1.c1], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256,
19 - output([VIEW3.t1.c1], [VIEW3.T_FUN_COUNT(*)]), filter(nil), rowset=256
access([VIEW3.t1.c1], [VIEW3.T_FUN_COUNT(*)])
20 - output([VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256,
20 - output([VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)]), filter(nil), rowset=256
access([VIEW1.t1.c1], [VIEW1.t1.c2], [VIEW1.T_FUN_COUNT(*)])
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 | |1 |5 |
|1 | EXCHANGE OUT DISTR |:EX10003|1 |5 |
|2 | HASH GROUP BY | |1 |5 |
|3 | EXCHANGE IN DISTR | |2 |5 |
|4 | EXCHANGE OUT DISTR (HASH) |:EX10002|2 |4 |
|5 | HASH GROUP BY | |2 |4 |
|6 | SUBPLAN SCAN |VIEW1 |1 |3 |
|7 | MERGE GROUP BY | |1 |3 |
|8 | SORT | |1 |3 |
|9 | MERGE JOIN | |1 |3 |
|10| SORT | |1 |2 |
|11| EXCHANGE IN DISTR | |1 |2 |
|12| EXCHANGE OUT DISTR (HASH)|:EX10000|1 |2 |
|13| PX BLOCK ITERATOR | |1 |1 |
|14| TABLE SCAN |b |1 |1 |
|15| SORT | |1 |2 |
|16| EXCHANGE IN DISTR | |1 |2 |
|17| EXCHANGE OUT DISTR (HASH)|:EX10001|1 |2 |
|18| PX BLOCK ITERATOR | |1 |1 |
|19| TABLE SCAN |t1 |1 |1 |
==================================================================
Outputs & filters:
=========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |5 |
|1 | EXCHANGE OUT DISTR |:EX10003|1 |5 |
|2 | HASH GROUP BY | |1 |5 |
|3 | EXCHANGE IN DISTR | |2 |5 |
|4 | EXCHANGE OUT DISTR (HASH) |:EX10002|2 |4 |
|5 | HASH GROUP BY | |2 |4 |
|6 | SUBPLAN SCAN |VIEW1 |1 |3 |
|7 | MERGE GROUP BY | |1 |3 |
|8 | PARTITION SORT | |1 |3 |
|9 | MERGE JOIN | |1 |3 |
|10| SORT | |1 |2 |
|11| EXCHANGE IN DISTR | |1 |2 |
|12| EXCHANGE OUT DISTR (HASH)|:EX10000|1 |2 |
|13| PX BLOCK ITERATOR | |1 |1 |
|14| TABLE SCAN |b |1 |1 |
|15| SORT | |1 |2 |
|16| EXCHANGE IN DISTR | |1 |2 |
|17| EXCHANGE OUT DISTR (HASH)|:EX10001|1 |2 |
|18| PX BLOCK ITERATOR | |1 |1 |
|19| TABLE SCAN |t1 |1 |1 |
=========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(VIEW1.b.c2, T_FUN_SUM(T_FUN_SUM(VIEW1.a.c3)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(VIEW1.b.c2, T_FUN_SUM(T_FUN_SUM(VIEW1.a.c3)))]), filter(nil), rowset=256, dop=2
2 - output([VIEW1.b.c2], [T_FUN_SUM(T_FUN_SUM(VIEW1.a.c3))]), filter(nil), rowset=256,
1 - output([INTERNAL_FUNCTION(VIEW1.b.c2, T_FUN_SUM(T_FUN_SUM(VIEW1.a.c3)))]), filter(nil), rowset=256
dop=2
2 - output([VIEW1.b.c2], [T_FUN_SUM(T_FUN_SUM(VIEW1.a.c3))]), filter(nil), rowset=256
group([VIEW1.b.c2]), agg_func([T_FUN_SUM(T_FUN_SUM(VIEW1.a.c3))])
3 - output([VIEW1.b.c2], [T_FUN_SUM(VIEW1.a.c3)]), filter(nil), rowset=256
4 - (#keys=1, [VIEW1.b.c2]), output([VIEW1.b.c2], [T_FUN_SUM(VIEW1.a.c3)]), filter(nil), rowset=256, dop=2
5 - output([VIEW1.b.c2], [T_FUN_SUM(VIEW1.a.c3)]), filter(nil), rowset=256,
4 - output([VIEW1.b.c2], [T_FUN_SUM(VIEW1.a.c3)]), filter(nil), rowset=256
(#keys=1, [VIEW1.b.c2]), dop=2
5 - output([VIEW1.b.c2], [T_FUN_SUM(VIEW1.a.c3)]), filter(nil), rowset=256
group([VIEW1.b.c2]), agg_func([T_FUN_SUM(VIEW1.a.c3)])
6 - output([VIEW1.b.c2], [VIEW1.a.c3]), filter(nil), rowset=256,
6 - output([VIEW1.b.c2], [VIEW1.a.c3]), filter(nil), rowset=256
access([VIEW1.b.c2], [VIEW1.a.c3])
7 - output([b.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256,
7 - output([b.c2], [T_FUN_COUNT(*)]), filter(nil), rowset=256
group([b.__pk_increment], [t1.c2]), agg_func([T_FUN_COUNT(*)])
8 - output([b.__pk_increment], [t1.c2], [b.c2]), filter(nil), rowset=256, sort_keys([b.__pk_increment, ASC], [t1.c2, ASC])
9 - output([b.__pk_increment], [t1.c2], [b.c2]), filter(nil), rowset=256,
8 - output([b.__pk_increment], [t1.c2], [b.c2]), filter(nil), rowset=256
sort_keys([HASH(b.__pk_increment, t1.c2), ASC], [b.__pk_increment, ASC], [t1.c2, ASC])
9 - output([b.__pk_increment], [t1.c2], [b.c2]), filter(nil), rowset=256
equal_conds([t1.c1 = b.c1]), other_conds(nil)
10 - output([b.__pk_increment], [b.c2], [b.c1]), filter(nil), rowset=256, sort_keys([b.c1, ASC])
11 - output([b.__pk_increment], [b.c2], [b.c1]), filter(nil), rowset=256
12 - (#keys=1, [b.c1]), output([b.__pk_increment], [b.c2], [b.c1]), filter(nil), rowset=256, dop=2
13 - output([b.__pk_increment], [b.c1], [b.c2]), filter(nil), rowset=256
14 - output([b.__pk_increment], [b.c1], [b.c2]), filter(nil), rowset=256,
merge_directions([ASC])
10 - output([b.__pk_increment], [b.c2], [b.c1]), filter(nil), rowset=256
sort_keys([b.c1, ASC])
11 - output([b.__pk_increment], [b.c2], [b.c1]), filter(nil), rowset=256
12 - output([b.__pk_increment], [b.c2], [b.c1]), filter(nil), rowset=256
(#keys=1, [b.c1]), dop=2
13 - output([b.__pk_increment], [b.c1], [b.c2]), filter(nil), rowset=256
14 - output([b.__pk_increment], [b.c1], [b.c2]), filter(nil), rowset=256
access([b.__pk_increment], [b.c1], [b.c2]), partitions(p0)
15 - output([t1.c2], [t1.c1]), filter(nil), rowset=256, sort_keys([t1.c1, ASC])
16 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
17 - (#keys=1, [t1.c1]), output([t1.c2], [t1.c1]), filter(nil), rowset=256, dop=2
18 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
19 - output([t1.c1], [t1.c2]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([b.__pk_increment]), range(MIN ; MAX)always true
15 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
sort_keys([t1.c1, ASC])
16 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
17 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
(#keys=1, [t1.c1]), dop=2
18 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
19 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
access([t1.c1], [t1.c2]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
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 | |1 |5 |
|1 | EXCHANGE OUT DISTR |:EX10002|1 |4 |
|2 | MERGE GROUP BY | |1 |4 |
|3 | SORT | |1 |4 |
|4 | MERGE JOIN | |1 |4 |
|5 | SORT | |1 |2 |
|6 | EXCHANGE IN DISTR | |1 |2 |
|7 | EXCHANGE OUT DISTR (HASH)|:EX10000|1 |2 |
|8 | PX BLOCK ITERATOR | |1 |1 |
|9 | TABLE SCAN |t1 |1 |1 |
|10| SORT | |1 |2 |
|11| EXCHANGE IN DISTR | |1 |2 |
|12| EXCHANGE OUT DISTR (HASH)|:EX10001|1 |2 |
|13| PX BLOCK ITERATOR | |1 |1 |
|14| TABLE SCAN |b |1 |1 |
=============================================================
Outputs & filters:
====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |5 |
|1 | EXCHANGE OUT DISTR |:EX10002|1 |4 |
|2 | MERGE GROUP BY | |1 |4 |
|3 | PARTITION SORT | |1 |4 |
|4 | MERGE JOIN | |1 |4 |
|5 | SORT | |1 |2 |
|6 | EXCHANGE IN DISTR | |1 |2 |
|7 | EXCHANGE OUT DISTR (HASH)|:EX10000|1 |2 |
|8 | PX BLOCK ITERATOR | |1 |1 |
|9 | TABLE SCAN |t1 |1 |1 |
|10| SORT | |1 |2 |
|11| EXCHANGE IN DISTR | |1 |2 |
|12| EXCHANGE OUT DISTR (HASH)|:EX10001|1 |2 |
|13| PX BLOCK ITERATOR | |1 |1 |
|14| TABLE SCAN |b |1 |1 |
====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, T_FUN_COUNT(*), b.c1, b.c2, b.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, T_FUN_COUNT(*), b.c1, b.c2, b.c3)]), filter(nil), rowset=256, dop=2
2 - output([t1.c2], [T_FUN_COUNT(*)], [t1.c1], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256,
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, T_FUN_COUNT(*), b.c1, b.c2, b.c3)]), filter(nil), rowset=256
dop=2
2 - output([t1.c2], [T_FUN_COUNT(*)], [t1.c1], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
group([b.__pk_increment], [t1.c2]), agg_func([T_FUN_COUNT(*)])
3 - output([t1.c2], [b.__pk_increment], [t1.c1], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256, sort_keys([b.__pk_increment, ASC], [t1.c2, ASC])
4 - output([t1.c2], [b.__pk_increment], [t1.c1], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256,
3 - output([t1.c2], [b.__pk_increment], [t1.c1], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
sort_keys([HASH(b.__pk_increment, t1.c2), ASC], [b.__pk_increment, ASC], [t1.c2, ASC])
4 - output([t1.c2], [b.__pk_increment], [t1.c1], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
equal_conds([t1.c1 = b.c1]), other_conds(nil)
5 - output([t1.c2], [t1.c1]), filter(nil), rowset=256, sort_keys([t1.c1, ASC])
merge_directions([ASC])
5 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
sort_keys([t1.c1, ASC])
6 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
7 - (#keys=1, [t1.c1]), output([t1.c2], [t1.c1]), filter(nil), rowset=256, dop=2
7 - output([t1.c2], [t1.c1]), filter(nil), rowset=256
(#keys=1, [t1.c1]), dop=2
8 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
9 - output([t1.c1], [t1.c2]), filter(nil), rowset=256,
9 - output([t1.c1], [t1.c2]), filter(nil), rowset=256
access([t1.c1], [t1.c2]), partitions(p0)
10 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256, sort_keys([b.c1, ASC])
11 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
12 - (#keys=1, [b.c1]), output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256, dop=2
13 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
14 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([t1.__pk_increment]), range(MIN ; MAX)always true
10 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
sort_keys([b.c1, ASC])
11 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
12 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
(#keys=1, [b.c1]), dop=2
13 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
14 - output([b.__pk_increment], [b.c1], [b.c2], [b.c3]), filter(nil), rowset=256
access([b.__pk_increment], [b.c1], [b.c2], [b.c3]), partitions(p0)
is_index_back=false, is_global_index=false,
range_key([b.__pk_increment]), range(MIN ; MAX)always true

View File

@ -7,118 +7,129 @@ create table t1 (c1 int(11) not null, c2 int(11) not null, c3 int(11) not null,
explain select * from t1;
Query Plan
====================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
----------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
====================================================
Outputs & filters:
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
===========================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256, dop=1
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
dop=1
2 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
force partition granule
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
access([t1.c1], [t1.c2], [t1.c3]), partitions(p[0-3])
is_index_back=false, is_global_index=false,
range_key([t1.c1], [t1.c2], [t1.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
explain select /*+use_px*/ * from t1;
Query Plan
====================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
----------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
====================================================
Outputs & filters:
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
===========================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256, dop=1
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
dop=1
2 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
force partition granule
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
access([t1.c1], [t1.c2], [t1.c3]), partitions(p[0-3])
is_index_back=false, is_global_index=false,
range_key([t1.c1], [t1.c2], [t1.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
explain select /*+use_px parallel(15)*/ * from t1;
Query Plan
================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------
|0 |PX COORDINATOR | |1 |1 |
|1 | EXCHANGE OUT DISTR|:EX10000|1 |1 |
|2 | PX BLOCK ITERATOR| |1 |1 |
|3 | TABLE SCAN |t1 |1 |1 |
================================================
Outputs & filters:
=======================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-------------------------------------------------------
|0 |PX COORDINATOR | |1 |1 |
|1 | EXCHANGE OUT DISTR|:EX10000|1 |1 |
|2 | PX BLOCK ITERATOR| |1 |1 |
|3 | TABLE SCAN |t1 |1 |1 |
=======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256, dop=15
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
dop=15
2 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
access([t1.c1], [t1.c2], [t1.c3]), partitions(p[0-3])
is_index_back=false, is_global_index=false,
range_key([t1.c1], [t1.c2], [t1.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
explain select /*+no_use_px */ * from t1;
Query Plan
====================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
----------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
====================================================
Outputs & filters:
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
===========================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256, dop=1
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
dop=1
2 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
force partition granule
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
access([t1.c1], [t1.c2], [t1.c3]), partitions(p[0-3])
is_index_back=false, is_global_index=false,
range_key([t1.c1], [t1.c2], [t1.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
explain select /*+no_use_px use_px*/ * from t1;
Query Plan
====================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
----------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
====================================================
Outputs & filters:
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
===========================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256, dop=1
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
dop=1
2 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
force partition granule
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
access([t1.c1], [t1.c2], [t1.c3]), partitions(p[0-3])
is_index_back=false, is_global_index=false,
range_key([t1.c1], [t1.c2], [t1.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
explain select /*+use_px no_use_px */ * from t1;
Query Plan
====================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
----------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
====================================================
Outputs & filters:
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |PX COORDINATOR | |1 |9 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |8 |
|2 | PX PARTITION ITERATOR| |1 |7 |
|3 | TABLE SCAN |t1 |1 |7 |
===========================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256, dop=1
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=256
dop=1
2 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256,
force partition granule
3 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=256
access([t1.c1], [t1.c2], [t1.c3]), partitions(p[0-3])
is_index_back=false, is_global_index=false,
range_key([t1.c1], [t1.c2], [t1.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
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;

File diff suppressed because it is too large Load Diff

View File

@ -70,33 +70,41 @@ insert into score values
(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 | |1 |13 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |12 |
|2 | SORT | |1 |11 |
|3 | PX PARTITION ITERATOR | |1 |11 |
|4 | MERGE JOIN | |1 |11 |
|5 | TABLE SCAN |score |1 |6 |
|6 | SORT | |1 |6 |
|7 | TABLE SCAN |stu |1 |6 |
=======================================================
Outputs & filters:
==============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |1 |13 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |12 |
|2 | SORT | |1 |11 |
|3 | PX PARTITION ITERATOR | |1 |11 |
|4 | MERGE JOIN | |1 |11 |
|5 | TABLE SCAN |score |1 |6 |
|6 | SORT | |1 |6 |
|7 | TABLE SCAN |stu |1 |6 |
==============================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256, sort_keys([score.sid, ASC])
1 - output([score.sid], [INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256, dop=2
2 - output([score.sid], [stu.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256, sort_keys([score.sid, ASC]), local merge sort
0 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256
sort_keys([score.sid, ASC])
1 - output([score.sid], [INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256
dop=2
2 - output([score.sid], [stu.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256
sort_keys([score.sid, ASC]), local merge sort
3 - output([score.sid], [stu.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256
4 - output([score.sid], [stu.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256,
partition wise, force partition granule
4 - output([score.sid], [stu.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256
equal_conds([stu.sid = score.sid]), other_conds(nil)
5 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256,
merge_directions([ASC])
5 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
6 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256, sort_keys([stu.sid, ASC])
7 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([score.sid], [score.subject]), range(MIN,MIN ; MAX,MAX)always true
6 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256
sort_keys([stu.sid, ASC])
7 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=256
access([stu.cls], [stu.sid], [stu.name]), partitions(p[0-5])
is_index_back=false, is_global_index=false,
range_key([stu.cls], [stu.sid]), range(MIN,MIN ; MAX,MAX)always true
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

View File

@ -70,37 +70,41 @@ insert into score values
(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 | |0 |11 |
|1 | EXCHANGE OUT DISTR |:EX10001|0 |11 |
|2 | NESTED-LOOP JOIN | |0 |11 |
|3 | PX BLOCK ITERATOR | |1 |6 |
|4 | TABLE SCAN |score |1 |6 |
|5 | MATERIAL | |1 |6 |
|6 | EXCHANGE IN DISTR | |1 |6 |
|7 | EXCHANGE OUT DISTR (BROADCAST)|:EX10000|1 |6 |
|8 | PX BLOCK ITERATOR | |1 |6 |
|9 | TABLE SCAN |stu |1 |6 |
================================================================
Outputs & filters:
=======================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------
|0 |PX COORDINATOR | |0 |11 |
|1 | EXCHANGE OUT DISTR |:EX10001|0 |11 |
|2 | NESTED-LOOP JOIN | |0 |11 |
|3 | PX BLOCK ITERATOR | |1 |6 |
|4 | TABLE SCAN |score |1 |6 |
|5 | MATERIAL | |1 |6 |
|6 | EXCHANGE IN DISTR | |1 |6 |
|7 | EXCHANGE OUT DISTR (BROADCAST)|:EX10000|1 |6 |
|8 | PX BLOCK ITERATOR | |1 |6 |
|9 | TABLE SCAN |stu |1 |6 |
=======================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256, dop=2
2 - output([stu.sid], [score.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256,
conds([stu.sid != score.sid]), nl_params_(nil)
1 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256
dop=2
2 - output([stu.sid], [score.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256
conds([stu.sid != score.sid]), nl_params_(nil), batch_join=false
3 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
4 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256,
4 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
is_index_back=false, is_global_index=false,
range_key([score.sid], [score.subject]), range(MIN,MIN ; MAX,MAX)always true
5 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256
6 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256
7 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256, dop=2
7 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256
dop=2
8 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=256
9 - output([stu.cls], [stu.sid], [stu.name]), filter([stu.sid < 12]), rowset=256,
9 - output([stu.cls], [stu.sid], [stu.name]), filter([stu.sid < 12]), rowset=256
access([stu.cls], [stu.sid], [stu.name]), partitions(p[0-5])
is_index_back=false, is_global_index=false, filter_before_indexback[false],
range_key([stu.cls], [stu.sid]), range(MIN,MIN ; MAX,MAX)always true
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
@ -131,35 +135,40 @@ sid name cls sid subject score
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 |10 |
|1 | EXCHANGE OUT DISTR |:EX10001|1 |9 |
|2 | SHARED HASH JOIN | |1 |8 |
|3 | EXCHANGE IN DISTR | |1 |6 |
|4 | EXCHANGE OUT DISTR (BC2HOST)|:EX10000|1 |6 |
|5 | PX BLOCK ITERATOR | |1 |6 |
|6 | TABLE SCAN |score |1 |6 |
|7 | PX BLOCK ITERATOR | |1 |2 |
|8 | TABLE GET |teacher |1 |2 |
=============================================================
Outputs & filters:
====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |10 |
|1 | EXCHANGE OUT DISTR |:EX10001|1 |9 |
|2 | SHARED HASH JOIN | |1 |8 |
|3 | EXCHANGE IN DISTR | |1 |6 |
|4 | EXCHANGE OUT DISTR (BC2HOST)|:EX10000|1 |6 |
|5 | PX BLOCK ITERATOR | |1 |6 |
|6 | TABLE SCAN |score |1 |6 |
|7 | PX BLOCK ITERATOR | |1 |2 |
|8 | TABLE GET |teacher |1 |2 |
====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(score.sid, score.subject, score.score, teacher.tid, teacher.name, teacher.subject)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(score.sid, score.subject, score.score, teacher.tid, teacher.name, teacher.subject)]), filter(nil), rowset=256, dop=2
2 - output([teacher.subject], [score.subject], [score.sid], [score.score], [teacher.tid], [teacher.name]), filter(nil), rowset=256,
1 - output([INTERNAL_FUNCTION(score.sid, score.subject, score.score, teacher.tid, teacher.name, teacher.subject)]), filter(nil), rowset=256
dop=2
2 - output([teacher.subject], [score.subject], [score.sid], [score.score], [teacher.tid], [teacher.name]), filter(nil), rowset=256
equal_conds([teacher.subject = score.subject]), other_conds(nil)
3 - output([score.subject], [score.sid], [score.score]), filter(nil), rowset=256
4 - output([score.subject], [score.sid], [score.score]), filter(nil), rowset=256, dop=2
4 - output([score.subject], [score.sid], [score.score]), filter(nil), rowset=256
dop=2
5 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
6 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256,
6 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
is_index_back=false, is_global_index=false,
range_key([score.sid], [score.subject]), range(MIN,MIN ; MAX,MAX)always true
7 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil), rowset=256
8 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil), rowset=256,
8 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil), rowset=256
access([teacher.tid], [teacher.subject], [teacher.name]), partitions(p1)
is_index_back=false, is_global_index=false,
range_key([teacher.tid]), range[1 ; 1],
range_cond([teacher.tid = 1])
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

View File

@ -70,31 +70,37 @@ insert into score values
(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 | |1 |13 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |12 |
|2 | PX PARTITION ITERATOR| |1 |11 |
|3 | MERGE JOIN | |1 |11 |
|4 | TABLE SCAN |score |1 |6 |
|5 | SORT | |1 |6 |
|6 | TABLE SCAN |stu |1 |6 |
====================================================
Outputs & filters:
===========================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------
|0 |PX COORDINATOR | |1 |13 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |12 |
|2 | PX PARTITION ITERATOR| |1 |11 |
|3 | MERGE JOIN | |1 |11 |
|4 | TABLE SCAN |score |1 |6 |
|5 | SORT | |1 |6 |
|6 | TABLE SCAN |stu |1 |6 |
===========================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256, dop=2
1 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls, score.sid, score.subject, score.score)]), filter(nil), rowset=256
dop=2
2 - output([stu.sid], [score.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256
3 - output([stu.sid], [score.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256,
partition wise, force partition granule
3 - output([stu.sid], [score.sid], [score.subject], [score.score], [stu.cls], [stu.name]), filter(nil), rowset=256
equal_conds([stu.sid = score.sid]), other_conds(nil)
4 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256,
merge_directions([ASC])
4 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
access([score.sid], [score.subject], [score.score]), partitions(p[0-5])
5 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256, sort_keys([stu.sid, ASC])
6 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=256,
is_index_back=false, is_global_index=false,
range_key([score.sid], [score.subject]), range(MIN,MIN ; MAX,MAX)always true
5 - output([stu.sid], [stu.cls], [stu.name]), filter(nil), rowset=256
sort_keys([stu.sid, ASC])
6 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=256
access([stu.cls], [stu.sid], [stu.name]), partitions(p[0-5])
is_index_back=false, is_global_index=false,
range_key([stu.cls], [stu.sid]), range(MIN,MIN ; MAX,MAX)always true
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

View File

@ -117,7 +117,7 @@ select query_sql, EXPECTED_WORKER_COUNT, USED_WORKER_COUNT from oceanbase.GV$OB_
| 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 | 9 | 9 |
| 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 |
+--------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------+-------------------+