mark some file to been opensource for ce-farm

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

View File

@ -0,0 +1,169 @@
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) */ subject, avg(score), max(score), min(score) from score group by subject;
Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |20 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|2 |18 |
|2 | └─HASH GROUP BY | |2 |16 |
|3 | └─EXCHANGE IN DISTR | |4 |15 |
|4 | └─EXCHANGE OUT DISTR (HASH)|:EX10000|4 |14 |
|5 | └─HASH GROUP BY | |4 |10 |
|6 | └─PX BLOCK ITERATOR | |28 |8 |
|7 | └─TABLE FULL SCAN |score |28 |8 |
=====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(score.subject, cast(cast(T_FUN_SUM(T_FUN_SUM(score.score)), DECIMAL(33, 0)) / cast(T_FUN_COUNT_SUM(T_FUN_COUNT(score.score)),
DECIMAL(20, 0)), DECIMAL(15, 4)), T_FUN_MAX(T_FUN_MAX(score.score)), T_FUN_MIN(T_FUN_MIN(score.score)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(score.subject, cast(cast(T_FUN_SUM(T_FUN_SUM(score.score)), DECIMAL(33, 0)) / cast(T_FUN_COUNT_SUM(T_FUN_COUNT(score.score)),
DECIMAL(20, 0)), DECIMAL(15, 4)), T_FUN_MAX(T_FUN_MAX(score.score)), T_FUN_MIN(T_FUN_MIN(score.score)))]), filter(nil), rowset=256
dop=2
2 - output([score.subject], [T_FUN_MAX(T_FUN_MAX(score.score))], [T_FUN_MIN(T_FUN_MIN(score.score))], [T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))]), filter(nil), rowset=256
group([score.subject]), agg_func([T_FUN_MAX(T_FUN_MAX(score.score))], [T_FUN_MIN(T_FUN_MIN(score.score))], [T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))])
3 - output([score.subject], [T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
4 - output([score.subject], [T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
(#keys=1, [score.subject]), dop=2
5 - output([score.subject], [T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
group([score.subject]), agg_func([T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)])
6 - output([score.subject], [score.score]), filter(nil), rowset=256
7 - output([score.subject], [score.score]), filter(nil), rowset=256
access([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
select /*+ USE_PX parallel(2) */ subject, avg(score), max(score), min(score) from score group by subject;
subject avg(score) max(score) min(score)
EN 83.7143 100 58
MA 83.7143 100 58
explain select /*+ USE_PX parallel(2) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject;
Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |9 |66 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|9 |57 |
|2 | └─HASH GROUP BY | |9 |48 |
|3 | └─EXCHANGE IN DISTR | |16 |45 |
|4 | └─EXCHANGE OUT DISTR (HASH)|:EX10000|16 |37 |
|5 | └─HASH GROUP BY | |16 |20 |
|6 | └─PX PARTITION ITERATOR| |28 |16 |
|7 | └─MERGE JOIN | |28 |16 |
|8 | ├─TABLE FULL SCAN |score |28 |8 |
|9 | └─SORT | |14 |8 |
|10| └─TABLE FULL SCAN|stu |14 |7 |
=====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(stu.cls, score.subject, cast(cast(T_FUN_SUM(T_FUN_SUM(score.score)), DECIMAL(33, 0)) / cast(T_FUN_COUNT_SUM(T_FUN_COUNT(score.score)),
DECIMAL(20, 0)), DECIMAL(15, 4)), T_FUN_MAX(T_FUN_MAX(score.score)), T_FUN_MIN(T_FUN_MIN(score.score)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(stu.cls, score.subject, cast(cast(T_FUN_SUM(T_FUN_SUM(score.score)), DECIMAL(33, 0)) / cast(T_FUN_COUNT_SUM(T_FUN_COUNT(score.score)),
DECIMAL(20, 0)), DECIMAL(15, 4)), T_FUN_MAX(T_FUN_MAX(score.score)), T_FUN_MIN(T_FUN_MIN(score.score)))]), filter(nil), rowset=256
dop=2
2 - output([stu.cls], [score.subject], [T_FUN_MAX(T_FUN_MAX(score.score))], [T_FUN_MIN(T_FUN_MIN(score.score))], [T_FUN_SUM(T_FUN_SUM(score.score))],
[T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))]), filter(nil), rowset=256
group([stu.cls], [score.subject]), agg_func([T_FUN_MAX(T_FUN_MAX(score.score))], [T_FUN_MIN(T_FUN_MIN(score.score))], [T_FUN_SUM(T_FUN_SUM(score.score))],
[T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))])
3 - output([stu.cls], [score.subject], [T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
4 - output([stu.cls], [score.subject], [T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
(#keys=2, [stu.cls], [score.subject]), dop=2
5 - output([stu.cls], [score.subject], [T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
group([stu.cls], [score.subject]), agg_func([T_FUN_MAX(score.score)], [T_FUN_MIN(score.score)], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)])
6 - output([score.score], [stu.cls], [score.subject]), filter(nil), rowset=256
partition wise, force partition granule
7 - output([score.score], [stu.cls], [score.subject]), filter(nil), rowset=256
equal_conds([score.sid = stu.sid]), other_conds(nil)
merge_directions([ASC])
8 - 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
9 - output([stu.cls], [stu.sid]), filter(nil), rowset=256
sort_keys([stu.sid, ASC])
10 - output([stu.cls], [stu.sid]), filter(nil), rowset=256
access([stu.cls], [stu.sid]), 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) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject;
cls subject avg(score) max(score) min(score)
1 EN 70.0000 80 60
1 MA 70.0000 80 60
2 EN 74.0000 90 58
2 MA 74.0000 90 58
3 EN 80.0000 80 80
3 MA 80.0000 80 80
4 EN 85.0000 90 80
4 MA 85.0000 90 80
5 EN 94.0000 99 89
5 MA 94.0000 99 89
6 EN 94.0000 100 87
6 MA 94.0000 100 87

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,204 @@
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 score, teacher where teacher.subject = score.subject;
Query Plan
========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------------
|0 |PX COORDINATOR | |28 |81 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|28 |53 |
|2 | └─SHARED HASH JOIN | |28 |22 |
|3 | ├─EXCHANGE IN DISTR | |2 |11 |
|4 | │ └─EXCHANGE OUT DISTR (BC2HOST)|:EX10000|2 |10 |
|5 | │ └─PX BLOCK ITERATOR | |2 |9 |
|6 | │ └─TABLE FULL SCAN |teacher |2 |9 |
|7 | └─PX BLOCK ITERATOR | |28 |8 |
|8 | └─TABLE FULL SCAN |score |28 |8 |
========================================================================
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], [teacher.tid], [teacher.name], [score.sid], [score.score]), filter(nil), rowset=256
equal_conds([teacher.subject = score.subject]), other_conds(nil)
3 - output([teacher.subject], [teacher.tid], [teacher.name]), filter(nil), rowset=256
4 - output([teacher.subject], [teacher.tid], [teacher.name]), filter(nil), rowset=256
dop=2
5 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil), rowset=256
6 - output([teacher.tid], [teacher.subject], [teacher.name]), filter(nil), rowset=256
access([teacher.tid], [teacher.subject], [teacher.name]), partitions(p[0-7])
is_index_back=false, is_global_index=false,
range_key([teacher.tid]), range(MIN ; MAX)always true
7 - output([score.sid], [score.subject], [score.score]), filter(nil), rowset=256
8 - 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
select /*+ USE_PX parallel(2) */ * from score, teacher where teacher.subject = score.subject;
sid subject score tid name subject
11 EN 60 1 Miss Zhang EN
11 MA 60 2 Mr Wang MA
12 EN 70 1 Miss Zhang EN
12 MA 70 2 Mr Wang MA
13 EN 80 1 Miss Zhang EN
13 MA 80 2 Mr Wang MA
21 EN 58 1 Miss Zhang EN
21 MA 58 2 Mr Wang MA
22 EN 90 1 Miss Zhang EN
22 MA 90 2 Mr Wang MA
31 EN 80 1 Miss Zhang EN
31 MA 80 2 Mr Wang MA
41 EN 80 1 Miss Zhang EN
41 MA 80 2 Mr Wang MA
42 EN 90 1 Miss Zhang EN
42 MA 90 2 Mr Wang MA
51 EN 89 1 Miss Zhang EN
51 MA 89 2 Mr Wang MA
52 EN 99 1 Miss Zhang EN
52 MA 99 2 Mr Wang MA
61 EN 100 1 Miss Zhang EN
61 MA 100 2 Mr Wang MA
62 EN 90 1 Miss Zhang EN
62 MA 90 2 Mr Wang MA
63 EN 99 1 Miss Zhang EN
63 MA 99 2 Mr Wang MA
64 EN 87 1 Miss Zhang EN
64 MA 87 2 Mr Wang MA
explain select /*+ USE_PX parallel(2) */ teacher.name, teacher.subject, avg(score) from score, teacher where teacher.subject = score.subject group by teacher.name, teacher.subject;
Query Plan
=============================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
-----------------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |31 |
|1 |└─EXCHANGE OUT DISTR |:EX10003|2 |29 |
|2 | └─HASH JOIN | |2 |27 |
|3 | ├─SUBPLAN SCAN |VIEW1 |2 |14 |
|4 | │ └─HASH GROUP BY | |2 |14 |
|5 | │ └─EXCHANGE IN DISTR | |4 |13 |
|6 | │ └─EXCHANGE OUT DISTR (HASH) |:EX10000|4 |12 |
|7 | │ └─HASH GROUP BY | |4 |9 |
|8 | │ └─PX BLOCK ITERATOR | |28 |8 |
|9 | │ └─TABLE FULL SCAN |score |28 |8 |
|10| └─EXCHANGE IN DISTR | |2 |13 |
|11| └─EXCHANGE OUT DISTR (HASH) |:EX10002|2 |13 |
|12| └─SUBPLAN SCAN |VIEW2 |2 |11 |
|13| └─HASH GROUP BY | |2 |11 |
|14| └─EXCHANGE IN DISTR | |2 |11 |
|15| └─EXCHANGE OUT DISTR (HASH)|:EX10001|2 |10 |
|16| └─HASH GROUP BY | |2 |9 |
|17| └─PX BLOCK ITERATOR | |2 |9 |
|18| └─TABLE FULL SCAN |teacher |2 |9 |
=============================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL_INT(20,
0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL_INT(20,
0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
dop=2
2 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)], [VIEW2.teacher.name]), filter(nil), rowset=256
equal_conds([VIEW2.teacher.subject = VIEW1.score.subject]), other_conds(nil)
3 - output([VIEW1.score.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)]), filter(nil), rowset=256
access([VIEW1.score.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)])
4 - output([score.subject], [T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))]), filter(nil), rowset=256
group([score.subject]), agg_func([T_FUN_SUM(T_FUN_SUM(score.score))], [T_FUN_COUNT_SUM(T_FUN_COUNT(score.score))])
5 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
6 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
(#keys=1, [score.subject]), dop=2
7 - output([score.subject], [T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)]), filter(nil), rowset=256
group([score.subject]), agg_func([T_FUN_SUM(score.score)], [T_FUN_COUNT(score.score)])
8 - output([score.subject], [score.score]), filter(nil), rowset=256
9 - output([score.subject], [score.score]), filter(nil), rowset=256
access([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
10 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=256
11 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW2.teacher.name]), filter(nil), rowset=256
(#keys=1, [VIEW2.teacher.subject]), dop=2
12 - output([VIEW2.teacher.subject], [VIEW2.teacher.name], [VIEW2.T_FUN_COUNT(*)]), filter(nil), rowset=256
access([VIEW2.teacher.subject], [VIEW2.teacher.name], [VIEW2.T_FUN_COUNT(*)])
13 - output([teacher.subject], [teacher.name], [T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil), rowset=256
group([teacher.subject], [teacher.name]), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
14 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=256
15 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=256
(#keys=2, [teacher.subject], [teacher.name]), dop=2
16 - output([teacher.subject], [teacher.name], [T_FUN_COUNT(*)]), filter(nil), rowset=256
group([teacher.subject], [teacher.name]), agg_func([T_FUN_COUNT(*)])
17 - output([teacher.subject], [teacher.name]), filter(nil), rowset=256
18 - output([teacher.subject], [teacher.name]), filter(nil), rowset=256
access([teacher.subject], [teacher.name]), partitions(p[0-7])
is_index_back=false, is_global_index=false,
range_key([teacher.tid]), range(MIN ; MAX)always true
select /*+ USE_PX parallel(2) */ teacher.name, teacher.subject, avg(score) from score, teacher where teacher.subject = score.subject group by teacher.name, teacher.subject;
name subject avg(score)
Miss Zhang EN 83.7143
Mr Wang MA 83.7143

View File

@ -0,0 +1,486 @@
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);
select * from stu;
sid name cls
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
select /*+ USE_PX parallel(2) */ * from stu;
sid name cls
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
select /*+ USE_PX parallel(6) */ * from stu;
sid name cls
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
select /*+ USE_PX parallel(18) */ * from stu;
sid name cls
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
select /*+ USE_PX parallel(28) */ name, cls from stu;
name cls
a1 1
a2 2
a3 3
a4 4
a5 5
a6 6
b1 1
b2 2
b4 4
b5 5
b6 6
c1 1
c6 6
d6 6
select * from teacher;
tid name subject
1 Miss Zhang EN
2 Mr Wang MA
select /*+ USE_PX parallel(2) */ * from teacher;
tid name subject
1 Miss Zhang EN
2 Mr Wang MA
select /*+ USE_PX parallel(6) */ * from teacher;
tid name subject
1 Miss Zhang EN
2 Mr Wang MA
select /*+ USE_PX parallel(8) */ * from teacher;
tid name subject
1 Miss Zhang EN
2 Mr Wang MA
select /*+ USE_PX parallel(18) */ name from teacher;
name
Miss Zhang
Mr Wang
select * from score;
sid subject score
11 EN 60
11 MA 60
12 EN 70
12 MA 70
13 EN 80
13 MA 80
21 EN 58
21 MA 58
22 EN 90
22 MA 90
31 EN 80
31 MA 80
41 EN 80
41 MA 80
42 EN 90
42 MA 90
51 EN 89
51 MA 89
52 EN 99
52 MA 99
61 EN 100
61 MA 100
62 EN 90
62 MA 90
63 EN 99
63 MA 99
64 EN 87
64 MA 87
select /*+ USE_PX parallel(2) */ * from score;
sid subject score
11 EN 60
11 MA 60
12 EN 70
12 MA 70
13 EN 80
13 MA 80
21 EN 58
21 MA 58
22 EN 90
22 MA 90
31 EN 80
31 MA 80
41 EN 80
41 MA 80
42 EN 90
42 MA 90
51 EN 89
51 MA 89
52 EN 99
52 MA 99
61 EN 100
61 MA 100
62 EN 90
62 MA 90
63 EN 99
63 MA 99
64 EN 87
64 MA 87
select /*+ USE_PX parallel(6) */ * from score;
sid subject score
11 EN 60
11 MA 60
12 EN 70
12 MA 70
13 EN 80
13 MA 80
21 EN 58
21 MA 58
22 EN 90
22 MA 90
31 EN 80
31 MA 80
41 EN 80
41 MA 80
42 EN 90
42 MA 90
51 EN 89
51 MA 89
52 EN 99
52 MA 99
61 EN 100
61 MA 100
62 EN 90
62 MA 90
63 EN 99
63 MA 99
64 EN 87
64 MA 87
select /*+ USE_PX parallel(8) */ * from score;
sid subject score
11 EN 60
11 MA 60
12 EN 70
12 MA 70
13 EN 80
13 MA 80
21 EN 58
21 MA 58
22 EN 90
22 MA 90
31 EN 80
31 MA 80
41 EN 80
41 MA 80
42 EN 90
42 MA 90
51 EN 89
51 MA 89
52 EN 99
52 MA 99
61 EN 100
61 MA 100
62 EN 90
62 MA 90
63 EN 99
63 MA 99
64 EN 87
64 MA 87
select /*+ USE_PX parallel(18) */ score, sid from score;
score sid
100 61
100 61
58 21
58 21
60 11
60 11
70 12
70 12
80 13
80 13
80 31
80 31
80 41
80 41
87 64
87 64
89 51
89 51
90 22
90 22
90 42
90 42
90 62
90 62
99 52
99 52
99 63
99 63
select /*+ USE_PX parallel(3) */ * from score where score > 60 and score < 90;
sid subject score
12 EN 70
12 MA 70
13 EN 80
13 MA 80
31 EN 80
31 MA 80
41 EN 80
41 MA 80
51 EN 89
51 MA 89
64 EN 87
64 MA 87
select /*+ USE_PX parallel(3) */ * from score where score > 60 and score < 90 and subject = 'MA';
sid subject score
12 MA 70
13 MA 80
31 MA 80
41 MA 80
51 MA 89
64 MA 87
select /*+ USE_PX parallel(3) */ * from score where score > 60 and score < 90 and subject IN ('MA', 'EN', 'HIS');
sid subject score
12 EN 70
12 MA 70
13 EN 80
13 MA 80
31 EN 80
31 MA 80
41 EN 80
41 MA 80
51 EN 89
51 MA 89
64 EN 87
64 MA 87
select /*+ USE_PX parallel(3) */ * from score where sid >=20 and sid <= 40 and score > 60 and score < 90 and subject IN ('MA', 'EN', 'HIS');
sid subject score
31 EN 80
31 MA 80
select /*+ USE_PX parallel(3) */ * from score where sid IN (41, 51) and score > 60 and score < 90 and subject IN ('MA', 'EN', 'HIS');
sid subject score
41 EN 80
41 MA 80
51 EN 89
51 MA 89
explain select /*+ USE_PX parallel(2) */ * from stu order by name desc;
Query Plan
==============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------
|0 |PX COORDINATOR MERGE SORT | |14 |26 |
|1 |└─EXCHANGE OUT DISTR |:EX10000|14 |18 |
|2 | └─SORT | |14 |9 |
|3 | └─PX BLOCK ITERATOR | |14 |7 |
|4 | └─TABLE FULL SCAN |stu |14 |7 |
==============================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls)]), filter(nil), rowset=16
sort_keys([stu.name, DESC])
1 - output([stu.name], [INTERNAL_FUNCTION(stu.sid, stu.name, stu.cls)]), filter(nil), rowset=16
dop=2
2 - output([stu.name], [stu.cls], [stu.sid]), filter(nil), rowset=16
sort_keys([stu.name, DESC])
3 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=16
4 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=16
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 order by name desc;
sid name cls
64 d6 6
63 c6 6
13 c1 1
62 b6 6
52 b5 5
42 b4 4
22 b2 2
12 b1 1
61 a6 6
51 a5 5
41 a4 4
31 a3 3
21 a2 2
11 a1 1
select /*+ USE_PX parallel(2) */ * from stu order by name;
sid name cls
11 a1 1
21 a2 2
31 a3 3
41 a4 4
51 a5 5
61 a6 6
12 b1 1
22 b2 2
42 b4 4
52 b5 5
62 b6 6
13 c1 1
63 c6 6
64 d6 6
explain select /*+ USE_PX parallel(2) */ * from stu order by name limit 3;
Query Plan
================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
----------------------------------------------------------------
|0 |LIMIT | |3 |12 |
|1 |└─PX COORDINATOR MERGE SORT | |3 |12 |
|2 | └─EXCHANGE OUT DISTR |:EX10000|3 |10 |
|3 | └─TOP-N SORT | |3 |8 |
|4 | └─PX BLOCK ITERATOR | |14 |7 |
|5 | └─TABLE FULL SCAN |stu |14 |7 |
================================================================
Outputs & filters:
-------------------------------------
0 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), rowset=16
limit(3), offset(nil)
1 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), rowset=16
sort_keys([stu.name, ASC])
2 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), rowset=16
dop=2
3 - output([stu.sid], [stu.name], [stu.cls]), filter(nil), rowset=16
sort_keys([stu.name, ASC]), topn(3)
4 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=16
5 - output([stu.cls], [stu.sid], [stu.name]), filter(nil), rowset=16
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 order by name limit 3;
sid name cls
11 a1 1
21 a2 2
31 a3 3
create table t11 (c1 int, c2 int, c3 int, c4 int) partition by hash(c1);
select /*+use_px parallel(2) read_consistency(weak) */ t0.c1 from (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t0 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t1 on t0.c1=t1.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t2 on t0.c1=t2.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t3 on t0.c1=t3.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t4 on t0.c1=t4.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t5 on t0.c1=t5.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t6 on t0.c1=t6.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t7 on t0.c1=t7.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t8 on t0.c1=t8.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t9 on t0.c1=t9.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t10 on t0.c1=t10.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t11 on t0.c1=t11.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t12 on t0.c1=t12.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t13 on t0.c1=t13.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t14 on t0.c1=t14.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t15 on t0.c1=t15.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t16 on t0.c1=t16.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t17 on t0.c1=t17.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t18 on t0.c1=t18.c1 join (select c1,c2 from t11 where t11.c1 BETWEEN 1000000000000001 and 1000000000000500) t19 on t0.c1=t19.c1;
c1
drop table if exists t1;
create table t1(c1 int primary key, c2 varchar(10)) partition by hash(c1) partitions 2;
insert into t1 values(1, 'aaa'),(2,'bbb');
explain basic select * from t1 where c2 not in('', 'xxx');
Query Plan
=======================================
|ID|OPERATOR |NAME |
---------------------------------------
|0 |PX COORDINATOR | |
|1 |└─EXCHANGE OUT DISTR |:EX10000|
|2 | └─PX PARTITION ITERATOR| |
|3 | └─TABLE FULL SCAN |t1 |
=======================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2)]), filter(nil), rowset=16
dop=1
2 - output([t1.c1], [t1.c2]), filter(nil), rowset=16
force partition granule
3 - output([t1.c1], [t1.c2]), filter([(T_OP_NOT_IN, t1.c2, ('', 'xxx'))]), rowset=16
access([t1.c1], [t1.c2]), partitions(p[0-1])
is_index_back=false, is_global_index=false, filter_before_indexback[false],
range_key([t1.c1]), range(MIN ; MAX)always true
select * from t1 where c2 not in('', 'xxx');
c1 c2
2 bbb
1 aaa

View File

@ -0,0 +1,588 @@
result_format: 4
explain_protocol: 2
drop database if exists muhangtest;
create database muhangtest;
use muhangtest;
drop table if exists xy_t1, xy_t2;
create table t2(c1 int(11) not null, c2 int(11) not null, c3 int(11) not null, primary key (c1, c2, c3)) partition by hash(c2)
subpartition by range columns(c2) subpartition template( subpartition sp_00 values less than (45), subpartition sp_01 values less than (100));
## left outer join
## OB bug
##select * from t1 left join t2 on t1.c2 = t1.c2;
create table t1 (c1 int(11) not null, c2 int(11) not null, c3 int(11) not null, primary key (c1, c2, c3)) ;
##原始结果
EXPLAIN select /*+use_px parallel(4) */ * from t1 left join t2 on t1.c2 = t2.c2;
Query Plan
========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |7 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|3 |5 |
|2 | └─SHARED HASH RIGHT OUTER JOIN | |3 |3 |
|3 | ├─EXCHANGE IN DISTR | |2 |2 |
|4 | │ └─EXCHANGE OUT DISTR (BC2HOST)|:EX10000|2 |2 |
|5 | │ └─PX BLOCK ITERATOR | |2 |2 |
|6 | │ └─TABLE FULL SCAN |t2 |2 |2 |
|7 | └─PX BLOCK ITERATOR | |3 |1 |
|8 | └─TABLE FULL SCAN |t1 |3 |1 |
========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t2.c1], [t2.c3], [t1.c1], [t1.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
4 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
dop=4
5 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
6 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
7 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
8 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
select /*+use_px parallel(4) */ * from t1 left join t2 on t1.c2 = t2.c2;
+-----+-----+-----+----+----+----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+-----+-----+-----+----+----+----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| 999 | 999 | 999 | NULL | NULL | NULL |
+-----+-----+-----+----+----+----+
##left outer join
EXPLAIN select /*+use_px parallel(4) pq_distribute(t1 partition none) */ * from t1 left join t2 on t1.c2 = t2.c2;
Query Plan
==========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |8 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|3 |6 |
|2 | └─HASH OUTER JOIN | |3 |4 |
|3 | ├─PART JOIN FILTER CREATE |:RF0000 |3 |1 |
|4 | │ └─PX BLOCK ITERATOR | |3 |1 |
|5 | │ └─TABLE FULL SCAN |t1 |3 |1 |
|6 | └─EXCHANGE IN DISTR | |2 |3 |
|7 | └─EXCHANGE OUT DISTR (BROADCAST)|:EX10000|2 |2 |
|8 | └─PX BLOCK HASH JOIN-FILTER |:RF0000 |2 |2 |
|9 | └─TABLE FULL SCAN |t2 |2 |2 |
==========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t1.c1], [t1.c3], [t2.c1], [t2.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
RF_TYPE(bloom), RF_EXPR[calc_tablet_id(t1.c2, t1.c2)]
4 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
6 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
7 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
dop=4
8 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
9 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+use_px parallel(4) pq_distribute(t1 partition none) */ * from t1 left join t2 on t1.c2 = t2.c2;
+-----+-----+-----+----+----+----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+-----+-----+-----+----+----+----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| 999 | 999 | 999 | NULL | NULL | NULL |
+-----+-----+-----+----+----+----+
EXPLAIN select /*+use_px parallel(4) pq_distribute(t1 none partition) */ * from t1 left join t2 on t1.c2 = t2.c2;
Query Plan
==========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |8 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|3 |6 |
|2 | └─HASH OUTER JOIN | |3 |4 |
|3 | ├─PART JOIN FILTER CREATE |:RF0000 |3 |1 |
|4 | │ └─PX BLOCK ITERATOR | |3 |1 |
|5 | │ └─TABLE FULL SCAN |t1 |3 |1 |
|6 | └─EXCHANGE IN DISTR | |2 |3 |
|7 | └─EXCHANGE OUT DISTR (BROADCAST)|:EX10000|2 |2 |
|8 | └─PX BLOCK HASH JOIN-FILTER |:RF0000 |2 |2 |
|9 | └─TABLE FULL SCAN |t2 |2 |2 |
==========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3, t2.c1, t2.c2, t2.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t1.c1], [t1.c3], [t2.c1], [t2.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
RF_TYPE(bloom), RF_EXPR[calc_tablet_id(t1.c2, t1.c2)]
4 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
6 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
7 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
dop=4
8 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
9 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+use_px parallel(4) pq_distribute(t1 none partition) */ * from t1 left join t2 on t1.c2 = t2.c2;
+-----+-----+-----+----+----+----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+-----+-----+-----+----+----+----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| 999 | 999 | 999 | NULL | NULL | NULL |
+-----+-----+-----+----+----+----+
##right outer join
EXPLAIN select /*+use_px parallel(4) pq_distribute(t1 none partition) */ * from t2 right join t1 on t1.c2 = t2.c2;
Query Plan
==========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |8 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|3 |6 |
|2 | └─HASH OUTER JOIN | |3 |4 |
|3 | ├─PART JOIN FILTER CREATE |:RF0000 |3 |1 |
|4 | │ └─PX BLOCK ITERATOR | |3 |1 |
|5 | │ └─TABLE FULL SCAN |t1 |3 |1 |
|6 | └─EXCHANGE IN DISTR | |2 |3 |
|7 | └─EXCHANGE OUT DISTR (BROADCAST)|:EX10000|2 |2 |
|8 | └─PX BLOCK HASH JOIN-FILTER |:RF0000 |2 |2 |
|9 | └─TABLE FULL SCAN |t2 |2 |2 |
==========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t1.c1], [t1.c3], [t2.c1], [t2.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
RF_TYPE(bloom), RF_EXPR[calc_tablet_id(t1.c2, t1.c2)]
4 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
6 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
7 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
dop=4
8 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
9 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+use_px parallel(4) pq_distribute(t1 none partition) */ * from t2 right join t1 on t1.c2 = t2.c2;
+----+----+----+-----+-----+-----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+----+----+----+-----+-----+-----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| NULL | NULL | NULL | 999 | 999 | 999 |
+----+----+----+-----+-----+-----+
EXPLAIN select /*+use_px parallel(4) pq_distribute(t1 partition none) */ * from t2 right join t1 on t1.c2 = t2.c2;
Query Plan
==========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
--------------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |8 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|3 |6 |
|2 | └─HASH OUTER JOIN | |3 |4 |
|3 | ├─PART JOIN FILTER CREATE |:RF0000 |3 |1 |
|4 | │ └─PX BLOCK ITERATOR | |3 |1 |
|5 | │ └─TABLE FULL SCAN |t1 |3 |1 |
|6 | └─EXCHANGE IN DISTR | |2 |3 |
|7 | └─EXCHANGE OUT DISTR (BROADCAST)|:EX10000|2 |2 |
|8 | └─PX BLOCK HASH JOIN-FILTER |:RF0000 |2 |2 |
|9 | └─TABLE FULL SCAN |t2 |2 |2 |
==========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t1.c1], [t1.c3], [t2.c1], [t2.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
RF_TYPE(bloom), RF_EXPR[calc_tablet_id(t1.c2, t1.c2)]
4 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
6 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
7 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
dop=4
8 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
9 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+use_px parallel(4) pq_distribute(t1 partition none) */ * from t2 right join t1 on t1.c2 = t2.c2;
+----+----+----+-----+-----+-----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+----+----+----+-----+-----+-----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| NULL | NULL | NULL | 999 | 999 | 999 |
+----+----+----+-----+-----+-----+
##full outer join
EXPLAIN select /*+use_px parallel(4) pq_distribute(t1 partition none) */ * from t2 full join t1 on t1.c2 = t2.c2;
Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |9 |
|1 |└─EXCHANGE OUT DISTR |:EX10002|3 |6 |
|2 | └─HASH FULL OUTER JOIN | |3 |4 |
|3 | ├─EXCHANGE IN DISTR | |3 |2 |
|4 | │ └─EXCHANGE OUT DISTR (HASH)|:EX10000|3 |2 |
|5 | │ └─PX BLOCK ITERATOR | |3 |1 |
|6 | │ └─TABLE FULL SCAN |t1 |3 |1 |
|7 | └─EXCHANGE IN DISTR | |2 |2 |
|8 | └─EXCHANGE OUT DISTR (HASH)|:EX10001|2 |2 |
|9 | └─PX BLOCK ITERATOR | |2 |2 |
|10| └─TABLE FULL SCAN |t2 |2 |2 |
=====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t1.c1], [t1.c3], [t2.c1], [t2.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
4 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
(#keys=1, [t1.c2]), dop=4
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
6 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
7 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
8 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
(#keys=1, [t2.c2]), dop=4
9 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
10 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+use_px parallel(4) pq_distribute(t1 partition none) */ * from t2 full join t1 on t1.c2 = t2.c2;
+----+----+----+-----+-----+-----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+----+----+----+-----+-----+-----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| NULL | NULL | NULL | 999 | 999 | 999 |
+----+----+----+-----+-----+-----+
EXPLAIN select /*+use_px parallel(4) pq_distribute(t1 none partition) */ * from t2 full join t1 on t1.c2 = t2.c2;
Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |3 |9 |
|1 |└─EXCHANGE OUT DISTR |:EX10002|3 |6 |
|2 | └─HASH FULL OUTER JOIN | |3 |4 |
|3 | ├─EXCHANGE IN DISTR | |3 |2 |
|4 | │ └─EXCHANGE OUT DISTR (HASH)|:EX10000|3 |2 |
|5 | │ └─PX BLOCK ITERATOR | |3 |1 |
|6 | │ └─TABLE FULL SCAN |t1 |3 |1 |
|7 | └─EXCHANGE IN DISTR | |2 |2 |
|8 | └─EXCHANGE OUT DISTR (HASH)|:EX10001|2 |2 |
|9 | └─PX BLOCK ITERATOR | |2 |2 |
|10| └─TABLE FULL SCAN |t2 |2 |2 |
=====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t2.c1, t2.c2, t2.c3, t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=4
2 - output([t1.c2], [t2.c2], [t1.c1], [t1.c3], [t2.c1], [t2.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
4 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
(#keys=1, [t1.c2]), dop=4
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
6 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
7 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
8 - output([t2.c2], [t2.c1], [t2.c3]), filter(nil), rowset=16
(#keys=1, [t2.c2]), dop=4
9 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
10 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil), rowset=16
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+use_px parallel(4) pq_distribute(t1 none partition) */ * from t2 full join t1 on t1.c2 = t2.c2;
+----+----+----+-----+-----+-----+
| c1 | c2 | c3 | c1 | c2 | c3 |
+----+----+----+-----+-----+-----+
| 1 | 1 | 1 | 1 | 1 | 1 |
| 99 | 99 | 99 | 99 | 99 | 99 |
| NULL | NULL | NULL | 999 | 999 | 999 |
+----+----+----+-----+-----+-----+
## anti
EXPLAIN select * from t1 where not exists (select 1 from t2 where t1.c1 = t2.c1);
Query Plan
===============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------
|0 |HASH RIGHT ANTI JOIN | |1 |9 |
|1 |├─PX COORDINATOR | |2 |6 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|2 |5 |
|3 |│ └─PX PARTITION ITERATOR| |2 |5 |
|4 |│ └─TABLE FULL SCAN |t2 |2 |5 |
|5 |└─TABLE FULL SCAN |t1 |3 |3 |
===============================================================
Outputs & filters:
-------------------------------------
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
1 - output([t2.c1]), filter(nil), rowset=16
2 - output([t2.c1]), filter(nil), rowset=16
dop=1
3 - output([t2.c1]), filter(nil), rowset=16
force partition granule
4 - output([t2.c1]), filter(nil), rowset=16
access([t2.c1]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
select * from t1 where not exists (select 1 from t2 where t1.c1 = t2.c1);
+-----+-----+-----+
| c1 | c2 | c3 |
+-----+-----+-----+
| 999 | 999 | 999 |
+-----+-----+-----+
EXPLAIN select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 partition none)*/ * from t1 where not exists (select 1 from t2 where t1.c2 = t2.c2);
Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |5 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|1 |4 |
|2 | └─NESTED-LOOP ANTI JOIN | |1 |4 |
|3 | ├─EXCHANGE IN DISTR | |3 |4 |
|4 | │ └─EXCHANGE OUT DISTR (PKEY)|:EX10000|3 |3 |
|5 | │ └─PX BLOCK ITERATOR | |3 |2 |
|6 | │ └─TABLE FULL SCAN |t1 |3 |2 |
|7 | └─MATERIAL | |2 |3 |
|8 | └─PX PARTITION ITERATOR | |2 |3 |
|9 | └─TABLE FULL SCAN |t2 |2 |3 |
=====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=2
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
conds([t1.c2 = t2.c2]), nl_params_(nil), use_batch=false
3 - output([t1.c2], [PARTITION_ID], [t1.c1], [t1.c3]), filter(nil), rowset=16
4 - output([t1.c2], [PARTITION_ID], [t1.c1], [t1.c3]), filter(nil), rowset=16
(#keys=1, [t1.c2]), dop=2
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
6 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
7 - output([t2.c2]), filter(nil), rowset=16
8 - output([t2.c2]), filter(nil), rowset=16
affinitize
9 - output([t2.c2]), filter(nil), rowset=16
access([t2.c2]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 partition none)*/ * from t1 where not exists (select 1 from t2 where t1.c2 = t2.c2);
+-----+-----+-----+
| c1 | c2 | c3 |
+-----+-----+-----+
| 999 | 999 | 999 |
+-----+-----+-----+
EXPLAIN select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 none partition)*/ * from t1 where not exists (select 1 from t2 where t1.c2 = t2.c2);
Query Plan
========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------------
|0 |PX COORDINATOR | |1 |6 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|1 |5 |
|2 | └─SHARED HASH RIGHT ANTI JOIN | |1 |5 |
|3 | ├─EXCHANGE IN DISTR | |2 |3 |
|4 | │ └─EXCHANGE OUT DISTR (BC2HOST)|:EX10000|2 |3 |
|5 | │ └─PX BLOCK ITERATOR | |2 |3 |
|6 | │ └─TABLE FULL SCAN |t2 |2 |3 |
|7 | └─PX BLOCK ITERATOR | |3 |2 |
|8 | └─TABLE FULL SCAN |t1 |3 |2 |
========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=2
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t2.c2]), filter(nil), rowset=16
4 - output([t2.c2]), filter(nil), rowset=16
dop=2
5 - output([t2.c2]), filter(nil), rowset=16
6 - output([t2.c2]), filter(nil), rowset=16
access([t2.c2]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
7 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
8 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 none partition)*/ * from t1 where not exists (select 1 from t2 where t1.c2 = t2.c2);
+-----+-----+-----+
| c1 | c2 | c3 |
+-----+-----+-----+
| 999 | 999 | 999 |
+-----+-----+-----+
## semi
EXPLAIN select * from t1 where exists (select 1 from t2 where t1.c1 = t2.c1);
Query Plan
===============================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------
|0 |HASH RIGHT SEMI JOIN | |2 |9 |
|1 |├─PX COORDINATOR | |2 |6 |
|2 |│ └─EXCHANGE OUT DISTR |:EX10000|2 |5 |
|3 |│ └─PX PARTITION ITERATOR| |2 |5 |
|4 |│ └─TABLE FULL SCAN |t2 |2 |5 |
|5 |└─TABLE FULL SCAN |t1 |3 |3 |
===============================================================
Outputs & filters:
-------------------------------------
0 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
1 - output([t2.c1]), filter(nil), rowset=16
2 - output([t2.c1]), filter(nil), rowset=16
dop=1
3 - output([t2.c1]), filter(nil), rowset=16
force partition granule
4 - output([t2.c1]), filter(nil), rowset=16
access([t2.c1]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
select * from t1 where exists (select 1 from t2 where t1.c1 = t2.c1);
+----+----+----+
| c1 | c2 | c3 |
+----+----+----+
| 1 | 1 | 1 |
| 99 | 99 | 99 |
+----+----+----+
EXPLAIN select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 partition none)*/ * from t1 where exists (select 1 from t2 where t1.c2 = t2.c2);
Query Plan
=====================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
---------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |6 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|2 |5 |
|2 | └─NESTED-LOOP SEMI JOIN | |2 |4 |
|3 | ├─EXCHANGE IN DISTR | |3 |4 |
|4 | │ └─EXCHANGE OUT DISTR (PKEY)|:EX10000|3 |3 |
|5 | │ └─PX BLOCK ITERATOR | |3 |2 |
|6 | │ └─TABLE FULL SCAN |t1 |3 |2 |
|7 | └─MATERIAL | |2 |3 |
|8 | └─PX PARTITION ITERATOR | |2 |3 |
|9 | └─TABLE FULL SCAN |t2 |2 |3 |
=====================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=2
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
conds([t1.c2 = t2.c2]), nl_params_(nil), use_batch=false
3 - output([t1.c2], [PARTITION_ID], [t1.c1], [t1.c3]), filter(nil), rowset=16
4 - output([t1.c2], [PARTITION_ID], [t1.c1], [t1.c3]), filter(nil), rowset=16
(#keys=1, [t1.c2]), dop=2
5 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
6 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
7 - output([t2.c2]), filter(nil), rowset=16
8 - output([t2.c2]), filter(nil), rowset=16
affinitize
9 - output([t2.c2]), filter(nil), rowset=16
access([t2.c2]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 partition none)*/ * from t1 where exists (select 1 from t2 where t1.c2 = t2.c2);
+----+----+----+
| c1 | c2 | c3 |
+----+----+----+
| 1 | 1 | 1 |
| 99 | 99 | 99 |
+----+----+----+
EXPLAIN select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 none partition)*/ * from t1 where exists (select 1 from t2 where t1.c2 = t2.c2);
Query Plan
========================================================================
|ID|OPERATOR |NAME |EST.ROWS|EST.TIME(us)|
------------------------------------------------------------------------
|0 |PX COORDINATOR | |2 |7 |
|1 |└─EXCHANGE OUT DISTR |:EX10001|2 |6 |
|2 | └─SHARED HASH RIGHT SEMI JOIN | |2 |5 |
|3 | ├─EXCHANGE IN DISTR | |2 |3 |
|4 | │ └─EXCHANGE OUT DISTR (BC2HOST)|:EX10000|2 |3 |
|5 | │ └─PX BLOCK ITERATOR | |2 |3 |
|6 | │ └─TABLE FULL SCAN |t2 |2 |3 |
|7 | └─PX BLOCK ITERATOR | |3 |2 |
|8 | └─TABLE FULL SCAN |t1 |3 |2 |
========================================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c2, t1.c3)]), filter(nil), rowset=16
dop=2
2 - output([t1.c2], [t1.c1], [t1.c3]), filter(nil), rowset=16
equal_conds([t1.c2 = t2.c2]), other_conds(nil)
3 - output([t2.c2]), filter(nil), rowset=16
4 - output([t2.c2]), filter(nil), rowset=16
dop=2
5 - output([t2.c2]), filter(nil), rowset=16
6 - output([t2.c2]), filter(nil), rowset=16
access([t2.c2]), partitions(p0sp[0-1])
is_index_back=false, is_global_index=false,
range_key([t2.c1], [t2.c2], [t2.c3]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
7 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
8 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil), rowset=16
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
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
select /*+ use_px parallel(2) LEADING(t1, t2) USE_NL(t1, t2) pq_distribute(t2 none partition)*/ * from t1 where exists (select 1 from t2 where t1.c2 = t2.c2);
+----+----+----+
| c1 | c2 | c3 |
+----+----+----+
| 1 | 1 | 1 |
| 99 | 99 | 99 |
+----+----+----+