@@ -405,36 +405,24 @@ select * from t, pt where tid = ptid and t1 = 'hello' || tid;
405405(33 rows)
406406
407407explain (costs off, timing off, summary off) select * from t, pt where t1 = pt1 and ptid = tid;
408- QUERY PLAN
409- ---------------------------------------------------------------
410- Nested Loop
411- -> Seq Scan on t
412- -> Append
413- -> Seq Scan on pt_p0
414- Filter: ((t.t1 = pt1) AND (t.tid = ptid))
415- -> Seq Scan on pt_p1
416- Filter: ((t.t1 = pt1) AND (t.tid = ptid))
417- -> Bitmap Heap Scan on pt_p2
418- Recheck Cond: ((ptid = t.tid) AND (pt1 = t.t1))
419- -> BitmapAnd
420- -> Bitmap Index Scan on pt_p2_ptid_idx
421- Index Cond: (ptid = t.tid)
422- -> Bitmap Index Scan on pt_p2_pt1_idx
423- Index Cond: (pt1 = t.t1)
424- -> Bitmap Heap Scan on pt_p3
425- Recheck Cond: ((ptid = t.tid) AND (pt1 = t.t1))
426- -> BitmapAnd
427- -> Bitmap Index Scan on pt_p3_ptid_idx
428- Index Cond: (ptid = t.tid)
429- -> Bitmap Index Scan on pt_p3_pt1_idx
430- Index Cond: (pt1 = t.t1)
431- -> Seq Scan on pt_p4
432- Filter: ((t.t1 = pt1) AND (t.tid = ptid))
433- -> Seq Scan on pt_p5
434- Filter: ((t.t1 = pt1) AND (t.tid = ptid))
435- -> Seq Scan on pt_p6
436- Filter: ((t.t1 = pt1) AND (t.tid = ptid))
437- (27 rows)
408+ QUERY PLAN
409+ -----------------------------------------------------
410+ Merge Join
411+ Merge Cond: (pt_p0.pt1 = t.t1)
412+ Join Filter: (t.tid = pt_p0.ptid)
413+ -> Merge Append
414+ Sort Key: pt_p0.pt1
415+ -> Index Scan using pt_p0_pt1_idx on pt_p0
416+ -> Index Scan using pt_p1_pt1_idx on pt_p1
417+ -> Index Scan using pt_p2_pt1_idx on pt_p2
418+ -> Index Scan using pt_p3_pt1_idx on pt_p3
419+ -> Index Scan using pt_p4_pt1_idx on pt_p4
420+ -> Index Scan using pt_p5_pt1_idx on pt_p5
421+ -> Index Scan using pt_p6_pt1_idx on pt_p6
422+ -> Sort
423+ Sort Key: t.t1
424+ -> Seq Scan on t
425+ (15 rows)
438426
439427select * from t, pt where t1 = pt1 and ptid = tid;
440428 dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
@@ -1812,30 +1800,23 @@ set polar_px_optimizer_enable_seqscan=on;
18121800set polar_px_optimizer_enable_hashjoin=on;
18131801set polar_px_optimizer_enable_nestloopjoin=off;
18141802explain (costs off, timing off, summary off) select * from t, pt where t1 = pt1;
1815- QUERY PLAN
1816- ------------------------------------------------------
1817- Nested Loop
1818- -> Seq Scan on t
1819- -> Append
1820- -> Seq Scan on pt_p0
1821- Filter: (t.t1 = pt1)
1822- -> Seq Scan on pt_p1
1823- Filter: (t.t1 = pt1)
1824- -> Bitmap Heap Scan on pt_p2
1825- Recheck Cond: (pt1 = t.t1)
1826- -> Bitmap Index Scan on pt_p2_pt1_idx
1827- Index Cond: (pt1 = t.t1)
1828- -> Bitmap Heap Scan on pt_p3
1829- Recheck Cond: (pt1 = t.t1)
1830- -> Bitmap Index Scan on pt_p3_pt1_idx
1831- Index Cond: (pt1 = t.t1)
1832- -> Seq Scan on pt_p4
1833- Filter: (t.t1 = pt1)
1834- -> Seq Scan on pt_p5
1835- Filter: (t.t1 = pt1)
1836- -> Seq Scan on pt_p6
1837- Filter: (t.t1 = pt1)
1838- (21 rows)
1803+ QUERY PLAN
1804+ -----------------------------------------------------
1805+ Merge Join
1806+ Merge Cond: (pt_p0.pt1 = t.t1)
1807+ -> Merge Append
1808+ Sort Key: pt_p0.pt1
1809+ -> Index Scan using pt_p0_pt1_idx on pt_p0
1810+ -> Index Scan using pt_p1_pt1_idx on pt_p1
1811+ -> Index Scan using pt_p2_pt1_idx on pt_p2
1812+ -> Index Scan using pt_p3_pt1_idx on pt_p3
1813+ -> Index Scan using pt_p4_pt1_idx on pt_p4
1814+ -> Index Scan using pt_p5_pt1_idx on pt_p5
1815+ -> Index Scan using pt_p6_pt1_idx on pt_p6
1816+ -> Sort
1817+ Sort Key: t.t1
1818+ -> Seq Scan on t
1819+ (14 rows)
18391820
18401821select * from t, pt where t1 = pt1;
18411822 dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
@@ -2244,38 +2225,41 @@ insert into t1 select i, -100, 'dummy' from generate_series(1,10) i;
22442225analyze t;
22452226analyze t1;
22462227explain (costs off, timing off, summary off) select * from t, t1, pt where t1.tid = ptid and t.tid = ptid;
2247- QUERY PLAN
2248- -----------------------------------------
2249- Hash Join
2250- Hash Cond: (pt_p0.ptid = t1.tid)
2251- -> Hash Join
2252- Hash Cond: (pt_p0.ptid = t.tid)
2253- -> Append
2254- -> Seq Scan on pt_p0
2255- -> Seq Scan on pt_p1
2256- -> Seq Scan on pt_p2
2257- -> Seq Scan on pt_p3
2258- -> Seq Scan on pt_p4
2259- -> Seq Scan on pt_p5
2260- -> Seq Scan on pt_p6
2261- -> Hash
2228+ QUERY PLAN
2229+ ------------------------------------------------------------
2230+ Merge Join
2231+ Merge Cond: (pt_p0.ptid = t1.tid)
2232+ -> Merge Join
2233+ Merge Cond: (pt_p0.ptid = t.tid)
2234+ -> Merge Append
2235+ Sort Key: pt_p0.ptid
2236+ -> Index Scan using pt_p0_ptid_idx on pt_p0
2237+ -> Index Scan using pt_p1_ptid_idx on pt_p1
2238+ -> Index Scan using pt_p2_ptid_idx on pt_p2
2239+ -> Index Scan using pt_p3_ptid_idx on pt_p3
2240+ -> Index Scan using pt_p4_ptid_idx on pt_p4
2241+ -> Index Scan using pt_p5_ptid_idx on pt_p5
2242+ -> Index Scan using pt_p6_ptid_idx on pt_p6
2243+ -> Sort
2244+ Sort Key: t.tid
22622245 -> Seq Scan on t
2263- -> Hash
2246+ -> Sort
2247+ Sort Key: t1.tid
22642248 -> Seq Scan on t1
2265- (16 rows)
2249+ (19 rows)
22662250
22672251select * from t, t1, pt where t1.tid = ptid and t.tid = ptid;
22682252 dist | tid | t1 | t2 | dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid
22692253------+-----+--------+-----+------+-----+--------+-----+------+---------+-------+-----------+------
2270- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 1 | hello1 | world | drop this | 1
2271- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 7 | hello7 | world | drop this | 1
2272- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 13 | hello13 | world | drop this | 1
2273- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 19 | hello19 | world | drop this | 1
2274- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 25 | hello25 | world | drop this | 1
2275- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 31 | hello31 | world | drop this | 1
2276- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 37 | hello37 | world | drop this | 1
2277- 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 43 | hello43 | world | drop this | 1
22782254 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 49 | hello49 | world | drop this | 1
2255+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 43 | hello43 | world | drop this | 1
2256+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 37 | hello37 | world | drop this | 1
2257+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 31 | hello31 | world | drop this | 1
2258+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 25 | hello25 | world | drop this | 1
2259+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 19 | hello19 | world | drop this | 1
2260+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 13 | hello13 | world | drop this | 1
2261+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 7 | hello7 | world | drop this | 1
2262+ 1 | 1 | hello1 | bar | 1 | 1 | hello1 | bar | 1 | hello1 | world | drop this | 1
22792263(9 rows)
22802264
22812265rollback;
0 commit comments