-> Seq Scan on t2
(6 rows)
+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
+-----------------------------------------
+ Nested Loop
+ Join Filter: (t1.c1 = t2.c1)
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
+ -> Seq Scan on t2
+(5 rows)
+
/*+NoNestLoop(t1 t2)*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
LOG: pg_hint_plan:
used hint:
NoNestLoop(t1 t2)
duplication hint:
error hint:
- QUERY PLAN
-------------------------------------
+ QUERY PLAN
+-----------------------------------------------
Merge Join
Merge Cond: (t1.c1 = t2.c1)
- -> Index Scan using t1_i1 on t1
+ -> Sort
+ Sort Key: t1.c1
+ -> Tid Scan on t1
+ TID Cond: (ctid = '(1,1)'::tid)
-> Sort
Sort Key: t2.c1
-> Seq Scan on t2
-(6 rows)
+(9 rows)
+SET enable_mergejoin TO off;
/*+NoHashJoin(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
QUERY PLAN
------------------------------------
- Merge Join
- Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+ -> Seq Scan on t2
-> Index Scan using t1_i1 on t1
- -> Sort
- Sort Key: t2.c1
- -> Seq Scan on t2
-(6 rows)
+ Index Cond: (c1 = t2.c1)
+(4 rows)
/*+NoMergeJoin(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
duplication hint:
error hint:
- QUERY PLAN
-------------------------------
- Hash Join
- Hash Cond: (t1.c1 = t2.c1)
- -> Seq Scan on t1
- -> Hash
- -> Seq Scan on t2
-(5 rows)
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
-- No. J-3-1-7~12
SET enable_nestloop TO off;
duplication hint:
error hint:
- QUERY PLAN
-------------------------------------
- Merge Join
- Merge Cond: (t1.c1 = t2.c1)
- -> Index Scan using t1_i1 on t1
- -> Sort
- Sort Key: t2.c1
+ QUERY PLAN
+------------------------------
+ Hash Join
+ Hash Cond: (t1.c1 = t2.c1)
+ -> Seq Scan on t1
+ -> Hash
-> Seq Scan on t2
-(6 rows)
+(5 rows)
/*+NoHashJoin(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
------------------------------------
- Merge Join
- Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+ -> Seq Scan on t2
-> Index Scan using t1_i1 on t1
- -> Sort
- Sort Key: t2.c1
- -> Seq Scan on t2
-(6 rows)
+ Index Cond: (c1 = t2.c1)
+(4 rows)
/*+NoMergeJoin(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
duplication hint:
error hint:
- QUERY PLAN
-------------------------------
- Hash Join
- Hash Cond: (t1.c1 = t2.c1)
- -> Seq Scan on t1
- -> Hash
- -> Seq Scan on t2
-(5 rows)
+ QUERY PLAN
+------------------------------------
+ Nested Loop
+ -> Seq Scan on t2
+ -> Index Scan using t1_i1 on t1
+ Index Cond: (c1 = t2.c1)
+(4 rows)
SET enable_nestloop TO on;
SET enable_mergejoin TO on;
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
/*+MergeJoin(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+SET enable_mergejoin TO on;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
/*+NoNestLoop(t1 t2)*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.ctid = '(1,1)';;
+SET enable_mergejoin TO off;
/*+NoHashJoin(t1 t2)*/
EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
/*+NoMergeJoin(t1 t2)*/