OSDN Git Service

否定形の結合方式のバグ修正によって正しい予想結果となった内容を
authorMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Fri, 24 Aug 2012 05:32:27 +0000 (14:32 +0900)
committerMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Fri, 24 Aug 2012 05:32:27 +0000 (14:32 +0900)
反映した。

expected/ut-J.out
sql/ut-J.sql

index 2affd3b..6284c60 100644 (file)
@@ -3804,8 +3804,19 @@ error hint:
          ->  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)
@@ -3813,16 +3824,20 @@ not used hint:
 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:
@@ -3834,13 +3849,11 @@ error hint:
 
              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;
@@ -3851,14 +3864,13 @@ not used hint:
 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;
@@ -3937,15 +3949,14 @@ not used hint:
 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;
@@ -3958,13 +3969,11 @@ error hint:
 
              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;
@@ -4100,14 +4109,13 @@ not used hint:
 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;
index 73eca8a..85e6ad9 100644 (file)
@@ -629,8 +629,11 @@ 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;
 /*+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)*/