)
FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
;
- QUERY PLAN
------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------
Aggregate
InitPlan 1 (returns $0)
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-(50 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(47 rows)
/*+
Leading(bmt1 bmt2 bmt3 bmt4)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t4.c1 = b1t2.c1)
-> Tid Scan on t4 b1t4
Sort Key: b1t3.c1
-> Tid Scan on t3 b1t3
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t1.c1 = b2t3.c1)
-> Tid Scan on t1 b2t1
Sort Key: b2t4.c1
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt1.c1)
-> Tid Scan on t3 bmt3
Sort Key: bmt2.c1
-> Seq Scan on t2 bmt2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
(62 rows)
-- No. J-2-1-2
)
FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = bmt3.c1 AND bmt3.ctid = '(1,1)' AND bmt1.c1 = bmt4.c1 AND bmt4.ctid = '(1,1)'
;
- QUERY PLAN
------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------
Aggregate
InitPlan 1 (returns $0)
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t4.c1)
- -> Tid Scan on t4 b3t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t2.c1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-(67 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(63 rows)
/*+
Leading(bmt1 bmt2 bmt3 bmt4)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t4.c1 = b1t2.c1)
-> Tid Scan on t4 b1t4
Sort Key: b1t3.c1
-> Tid Scan on t3 b1t3
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t1.c1 = b2t3.c1)
-> Tid Scan on t1 b2t1
Sort Key: b2t4.c1
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b3t2.c1 = b3t1.c1)
-> Seq Scan on t2 b3t2
Sort Key: b3t4.c1
-> Tid Scan on t4 b3t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt1.c1)
-> Tid Scan on t3 bmt3
Sort Key: bmt2.c1
-> Seq Scan on t2 bmt2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
(83 rows)
-- No. J-2-1-3
EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = bmt2.c1 AND bmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
- QUERY PLAN
----------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------
Aggregate
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-(16 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
/*+
Leading(bmt4 bmt3 bmt2 bmt1)
Aggregate
-> Nested Loop
Join Filter: (bmt2.c1 = bmt1.c1)
- -> Tid Scan on t1 bmt1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt2.c1 = bmt3.c1)
-> Seq Scan on t2 bmt2
Sort Key: bmt4.c1
-> Tid Scan on t4 bmt4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
(20 rows)
-- No. J-2-1-4
EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.ctid = '(1,1)' AND bmt1.c1 = sbmt2.c1 AND sbmt2.ctid = '(1,1)' AND bmt1.c1 = sbmt3.c1 AND sbmt3.ctid = '(1,1)' AND bmt1.c1 = sbmt4.c1 AND sbmt4.ctid = '(1,1)';
- QUERY PLAN
----------------------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------------
Aggregate
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-(16 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(15 rows)
/*+
Leading(bmt4 bmt3 bmt2 bmt1)
Aggregate
-> Nested Loop
Join Filter: (bmt2.c1 = bmt1.c1)
- -> Tid Scan on t1 bmt1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt2.c1 = bmt3.c1)
-> Seq Scan on t2 bmt2
Sort Key: bmt4.c1
-> Tid Scan on t4 bmt4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
(20 rows)
-- No. J-2-1-5
SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)'
)
;
- QUERY PLAN
------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------
Aggregate
InitPlan 1 (returns $0)
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
Filter: ((c1 <> $0) AND (c1 <> $1))
- -> Materialize
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-(51 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(48 rows)
/*+
Leading(bmt1 bmt2 bmt3 bmt4)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t4.c1 = b1t2.c1)
-> Tid Scan on t4 b1t4
Sort Key: b1t3.c1
-> Tid Scan on t3 b1t3
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t1.c1 = b2t3.c1)
-> Tid Scan on t1 b2t1
Sort Key: b2t4.c1
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt1.c1)
-> Tid Scan on t3 bmt3
Sort Key: bmt2.c1
-> Seq Scan on t2 bmt2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
(63 rows)
-- No. J-2-1-6
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t4.c1)
- -> Tid Scan on t4 b3t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t2.c1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
Filter: ((c1 <> $0) AND (c1 <> $1) AND (c1 <> $2))
- -> Materialize
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-(68 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+(64 rows)
/*+
Leading(bmt1 bmt2 bmt3 bmt4)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t4.c1 = b1t2.c1)
-> Tid Scan on t4 b1t4
Sort Key: b1t3.c1
-> Tid Scan on t3 b1t3
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t1.c1 = b2t3.c1)
-> Tid Scan on t1 b2t1
Sort Key: b2t4.c1
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b3t2.c1 = b3t1.c1)
-> Seq Scan on t2 b3t2
Sort Key: b3t4.c1
-> Tid Scan on t4 b3t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt1.c1)
-> Tid Scan on t3 bmt3
Sort Key: bmt2.c1
-> Seq Scan on t2 bmt2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
(84 rows)
-- No. J-2-1-7
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
CTE c2
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = c2.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = c1.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt4.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt3.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = c1.c1)
+ Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
- -> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
-> CTE Scan on c2
-(55 rows)
+(53 rows)
/*+
Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t4.c1 = b1t2.c1)
-> Tid Scan on t4 b1t4
Sort Key: b1t3.c1
-> Tid Scan on t3 b1t3
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
CTE c2
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t1.c1 = b2t3.c1)
-> Tid Scan on t1 b2t1
Sort Key: b2t4.c1
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt4.c1 = bmt1.c1)
-> Tid Scan on t4 bmt4
Sort Key: bmt1.c1
-> Nested Loop
Join Filter: (bmt1.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt1.c1 = c1.c1)
-> Tid Scan on t1 bmt1
-> Sort
Sort Key: c2.c1
-> CTE Scan on c2
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: bmt3.c1
-> Tid Scan on t3 bmt3
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
CTE c2
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
CTE c3
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t4.c1)
- -> Tid Scan on t4 b3t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t2.c1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = c3.c1)
-> Nested Loop
Join Filter: (bmt1.c1 = c2.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = c1.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt4.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt3.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = c1.c1)
+ Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
- -> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
-> CTE Scan on c2
-> CTE Scan on c3
-(75 rows)
+(72 rows)
/*+
Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t4.c1 = b1t2.c1)
-> Tid Scan on t4 b1t4
Sort Key: b1t3.c1
-> Tid Scan on t3 b1t3
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
CTE c2
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t1.c1 = b2t3.c1)
-> Tid Scan on t1 b2t1
Sort Key: b2t4.c1
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
CTE c3
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b3t2.c1 = b3t1.c1)
-> Seq Scan on t2 b3t2
Sort Key: b3t4.c1
-> Tid Scan on t4 b3t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt1.c1)
-> Tid Scan on t3 bmt3
Sort Key: bmt1.c1
-> Nested Loop
Join Filter: (c1.c1 = bmt1.c1)
- -> Tid Scan on t1 bmt1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (c2.c1 = c1.c1)
-> Merge Join
-> CTE Scan on c3
-> Hash
-> CTE Scan on c1
+ -> Tid Scan on t1 bmt1
+ TID Cond: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: bmt2.c1
-> Seq Scan on t2 bmt2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
(97 rows)
----
SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)'
)
;
- QUERY PLAN
------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------
Aggregate
CTE c1
-> Aggregate
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t2.c1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = c1.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = c1.c1)
+ Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 <> $2)
- -> CTE Scan on c1
-(38 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(35 rows)
/*+
Leading(c1 bmt2 bmt1)
SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)'
)
;
- QUERY PLAN
------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------
Aggregate
CTE c1
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 2 (returns $1)
-> Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t4.c1)
- -> Tid Scan on t4 b3t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t2.c1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = c1.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt4.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt3.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = c1.c1)
+ Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 <> $2)
- -> CTE Scan on c1
-(70 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(67 rows)
/*+
Leading(c1 bmt4 bmt3 bmt2 bmt1)
Sort Key: b1t2.c1
-> Nested Loop
Join Filter: (b1t3.c1 = b1t2.c1)
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t3.c1 = b1t4.c1)
-> Tid Scan on t3 b1t3
-> Hash
-> Tid Scan on t4 b1t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: b1t1.c1
-> Tid Scan on t1 b1t1
Sort Key: b2t2.c1
-> Nested Loop
Join Filter: (b2t3.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t3.c1 = b2t4.c1)
-> Tid Scan on t3 b2t3
-> Hash
-> Tid Scan on t4 b2t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: b2t1.c1
-> Tid Scan on t1 b2t1
Sort Key: b3t2.c1
-> Nested Loop
Join Filter: (b3t3.c1 = b3t2.c1)
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b3t3.c1 = b3t4.c1)
-> Tid Scan on t3 b3t3
-> Hash
-> Tid Scan on t4 b3t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: b3t1.c1
-> Tid Scan on t1 b3t1
Sort Key: bmt2.c1
-> Nested Loop
Join Filter: (bmt3.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt4.c1)
-> Tid Scan on t3 bmt3
-> Sort
Sort Key: c1.c1
-> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: bmt1.c1
-> Tid Scan on t1 bmt1
SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
)
;
- QUERY PLAN
------------------------------------------------------------------------
+ QUERY PLAN
+-------------------------------------------------------------------
Aggregate
CTE c1
-> Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Result
InitPlan 2 (returns $1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt4.c1)
- -> Tid Scan on t4 bmt4
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = c1.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt3.c1)
- -> Tid Scan on t3 bmt3
- TID Cond: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt4.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
+ Join Filter: (bmt1.c1 = bmt3.c1)
-> Nested Loop
- Join Filter: (bmt1.c1 = c1.c1)
+ Join Filter: (bmt1.c1 = bmt2.c1)
-> Tid Scan on t1 bmt1
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 <> $4)
- -> CTE Scan on c1
-(47 rows)
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 bmt3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 bmt4
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> CTE Scan on c1
+(46 rows)
/*+
Leading(c1 bmt4 bmt3 bmt2 bmt1)
-> Aggregate
-> Nested Loop
Join Filter: (b1t2.c1 = b1t1.c1)
- -> Tid Scan on t1 b1t1
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t2.c1 = b1t3.c1)
-> Seq Scan on t2 b1t2
Sort Key: b1t4.c1
-> Tid Scan on t4 b1t4
TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t1 b1t1
+ TID Cond: (ctid = '(1,1)'::tid)
InitPlan 3 (returns $2)
-> Result
InitPlan 2 (returns $1)
Sort Key: bmt2.c1
-> Nested Loop
Join Filter: (bmt3.c1 = bmt2.c1)
- -> Seq Scan on t2 bmt2
- Filter: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (bmt3.c1 = bmt4.c1)
-> Tid Scan on t3 bmt3
-> Sort
Sort Key: c1.c1
-> CTE Scan on c1
+ -> Seq Scan on t2 bmt2
+ Filter: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: bmt1.c1
-> Tid Scan on t1 bmt1
Aggregate
-> Nested Loop
Join Filter: (t1.c1 = t4.c1)
- -> Tid Scan on t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t3.c1)
- -> Tid Scan on t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t2.c1)
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r1
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
(19 rows)
/*+
Sort Key: t4.c1
-> Tid Scan on t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r1
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-(25 rows)
+(24 rows)
EXPLAIN (COSTS false) UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
QUERY PLAN
Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r1_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
(19 rows)
/*+
Sort Key: b1t4.c1
-> Tid Scan on t4 b1t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r1_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-(25 rows)
+(24 rows)
-- No. J-2-3-2
EXPLAIN (COSTS false) UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
Aggregate
-> Nested Loop
Join Filter: (t1.c1 = t4.c1)
- -> Tid Scan on t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t3.c1)
- -> Tid Scan on t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t2.c1)
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r2
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
Aggregate
-> Nested Loop
Join Filter: (t1.c1 = t4.c1)
- -> Tid Scan on t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t3.c1)
- -> Tid Scan on t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t2.c1)
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r2
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
(39 rows)
/*+
Sort Key: t4.c1
-> Tid Scan on t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r2
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
Sort Key: t4.c1
-> Tid Scan on t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r2
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-(51 rows)
+(49 rows)
EXPLAIN (COSTS false) UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
QUERY PLAN
Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r2_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r2_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
(39 rows)
/*+
-> Nested Loop
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t3.c1 = b1t1.c1)
-> Tid Scan on t3 b1t3
Sort Key: b1t2.c1
-> Seq Scan on t2 b1t2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Tid Scan on r2_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Nested Loop
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t3.c1 = b2t1.c1)
-> Tid Scan on t3 b2t3
Sort Key: b2t2.c1
-> Seq Scan on t2 b2t2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Tid Scan on r2_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
Aggregate
-> Nested Loop
Join Filter: (t1.c1 = t4.c1)
- -> Tid Scan on t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t3.c1)
- -> Tid Scan on t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t2.c1)
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r3
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
Aggregate
-> Nested Loop
Join Filter: (t1.c1 = t4.c1)
- -> Tid Scan on t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t3.c1)
- -> Tid Scan on t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t2.c1)
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r3
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
Aggregate
-> Nested Loop
Join Filter: (t1.c1 = t4.c1)
- -> Tid Scan on t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t3.c1)
- -> Tid Scan on t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (t1.c1 = t2.c1)
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r3
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4
+ TID Cond: (ctid = '(1,1)'::tid)
(59 rows)
/*+
Sort Key: t4.c1
-> Tid Scan on t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r3
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
Sort Key: t4.c1
-> Tid Scan on t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r3
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
Sort Key: t4.c1
-> Tid Scan on t4
TID Cond: (ctid = '(1,1)'::tid)
- -> Materialize
- -> Seq Scan on t2
- Filter: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+ Filter: (ctid = '(1,1)'::tid)
-> Tid Scan on r3
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-(77 rows)
+(74 rows)
EXPLAIN (COSTS false) UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1 AND ctid = '(1,1)';
QUERY PLAN
Aggregate
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t3.c1)
- -> Tid Scan on t3 b1t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b1t1.c1 = b1t2.c1)
- -> Seq Scan on t2 b1t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r3_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1 b1t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b1t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b1t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
Aggregate
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t3.c1)
- -> Tid Scan on t3 b2t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b2t1.c1 = b2t2.c1)
- -> Seq Scan on t2 b2t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r3_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1 b2t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b2t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b2t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
Aggregate
-> Nested Loop
Join Filter: (b3t1.c1 = b3t4.c1)
- -> Tid Scan on t4 b3t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t3.c1)
- -> Tid Scan on t3 b3t3
- TID Cond: (ctid = '(1,1)'::tid)
-> Nested Loop
Join Filter: (b3t1.c1 = b3t2.c1)
- -> Seq Scan on t2 b3t2
- Filter: (ctid = '(1,1)'::tid)
-> Nested Loop
-> Tid Scan on r3_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Tid Scan on t1 b3t1
TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2 b3t2
+ Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t3 b3t3
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
(59 rows)
/*+
-> Nested Loop
-> Nested Loop
Join Filter: (b1t1.c1 = b1t4.c1)
- -> Tid Scan on t4 b1t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b1t3.c1 = b1t1.c1)
-> Tid Scan on t3 b1t3
Sort Key: b1t2.c1
-> Seq Scan on t2 b1t2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b1t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Tid Scan on r3_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Nested Loop
-> Nested Loop
Join Filter: (b2t1.c1 = b2t4.c1)
- -> Tid Scan on t4 b2t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b2t3.c1 = b2t1.c1)
-> Tid Scan on t3 b2t3
Sort Key: b2t2.c1
-> Seq Scan on t2 b2t2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b2t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Tid Scan on r3_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
-> Nested Loop
-> Nested Loop
Join Filter: (b3t1.c1 = b3t4.c1)
- -> Tid Scan on t4 b3t4
- TID Cond: (ctid = '(1,1)'::tid)
-> Hash Join
Hash Cond: (b3t3.c1 = b3t1.c1)
-> Tid Scan on t3 b3t3
Sort Key: b3t2.c1
-> Seq Scan on t2 b3t2
Filter: (ctid = '(1,1)'::tid)
+ -> Tid Scan on t4 b3t4
+ TID Cond: (ctid = '(1,1)'::tid)
-> Tid Scan on r3_
TID Cond: (ctid = '(1,1)'::tid)
Filter: (c1 = 1)
SET enable_mergejoin TO on;
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
- QUERY PLAN
------------------------------------------------
+ QUERY PLAN
+-----------------------------------------
Nested Loop
Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
-> Seq Scan on t2
- -> Materialize
- -> Tid Scan on t1
- TID Cond: (ctid = '(1,1)'::tid)
-(6 rows)
+(5 rows)
/*+NoNestLoop(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
(19 rows)
----
+---- No. J-3-2-2 join partitioned tables
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.pt1, s1.p2 WHERE pt1.c1 = p2.c1;
+ QUERY PLAN
+--------------------------------------
+ Hash Join
+ Hash Cond: (p2.c1 = pt1_c1.c1)
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1
+ -> Seq Scan on p2c2
+ -> Seq Scan on p2c3
+ -> Seq Scan on p2c1c1
+ -> Seq Scan on p2c1c2
+ -> Seq Scan on p2c2c1
+ -> Seq Scan on p2c2c2
+ -> Seq Scan on p2c3c1
+ -> Seq Scan on p2c3c2
+ -> Hash
+ -> Append
+ -> Seq Scan on pt1_c1
+ -> Seq Scan on pt1_c2
+ -> Seq Scan on pt1_c3
+(18 rows)
+
+/*+MergeJoin(pt1 p2)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.pt1, s1.p2 WHERE pt1.c1 = p2.c1;
+LOG: pg_hint_plan:
+used hint:
+MergeJoin(p2 pt1)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Merge Join
+ Merge Cond: (pt1_c1.c1 = p2.c1)
+ -> Sort
+ Sort Key: pt1_c1.c1
+ -> Append
+ -> Seq Scan on pt1_c1
+ -> Seq Scan on pt1_c2
+ -> Seq Scan on pt1_c3
+ -> Sort
+ Sort Key: p2.c1
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1
+ -> Seq Scan on p2c2
+ -> Seq Scan on p2c3
+ -> Seq Scan on p2c1c1
+ -> Seq Scan on p2c1c2
+ -> Seq Scan on p2c2c1
+ -> Seq Scan on p2c2c2
+ -> Seq Scan on p2c3c1
+ -> Seq Scan on p2c3c2
+(21 rows)
+
+/*+MergeJoin(pt1_c1 p2c1)*/ /* will ignored */
+EXPLAIN (COSTS false) SELECT * FROM s1.pt1, s1.p2 WHERE pt1.c1 = p2.c1;
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+MergeJoin(p2c1 pt1_c1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Hash Join
+ Hash Cond: (p2.c1 = pt1_c1.c1)
+ -> Append
+ -> Seq Scan on p2
+ -> Seq Scan on p2c1
+ -> Seq Scan on p2c2
+ -> Seq Scan on p2c3
+ -> Seq Scan on p2c1c1
+ -> Seq Scan on p2c1c2
+ -> Seq Scan on p2c2c1
+ -> Seq Scan on p2c2c2
+ -> Seq Scan on p2c3c1
+ -> Seq Scan on p2c3c2
+ -> Hash
+ -> Append
+ -> Seq Scan on pt1_c1
+ -> Seq Scan on pt1_c2
+ -> Seq Scan on pt1_c3
+(18 rows)
+
+----
---- No. J-3-3 conflict join method hint
----
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;