OSDN Git Service

元のクエリの実行計画の変化に伴い、スキャン方式の試験の予測結果を修正した。
authorTakashi Suzuki <suzuki.takashi@metrosystems.co.jp>
Thu, 17 Oct 2013 06:36:21 +0000 (15:36 +0900)
committerTakashi Suzuki <suzuki.takashi@metrosystems.co.jp>
Thu, 17 Oct 2013 06:36:21 +0000 (15:36 +0900)
expected/ut-S.out

index a224538..3384be8 100644 (file)
@@ -628,33 +628,35 @@ SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1
                                QUERY PLAN                               
 ------------------------------------------------------------------------
  Aggregate
-   InitPlan 1 (returns $0)
+   InitPlan 1 (returns $1)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b1t1.c1 = b1t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b1t1.c1 = b1t4.c1)
+                       Merge Cond: (b1t1.c1 = b1t2.c1)
                        ->  Merge Join
                              Merge Cond: (b1t1.c1 = b1t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b1t1
                              ->  Index Only Scan using t3_i1 on t3 b1t3
-                       ->  Index Only Scan using t4_i1 on t4 b1t4
-                 ->  Sort
-                       Sort Key: b1t2.c1
-                       ->  Seq Scan on t2 b1t2
-   ->  Merge Join
-         Merge Cond: (bmt1.c1 = bmt2.c1)
+                       ->  Sort
+                             Sort Key: b1t2.c1
+                             ->  Seq Scan on t2 b1t2
+                 ->  Index Only Scan using t4_i1 on t4 b1t4
+                       Index Cond: (c1 = b1t3.c1)
+   ->  Nested Loop
+         Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Merge Join
-               Merge Cond: (bmt1.c1 = bmt4.c1)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
                ->  Merge Join
                      Merge Cond: (bmt1.c1 = bmt3.c1)
                      ->  Index Only Scan using t1_i1 on t1 bmt1
                      ->  Index Only Scan using t3_i1 on t3 bmt3
-               ->  Index Only Scan using t4_i1 on t4 bmt4
-         ->  Sort
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2
-(27 rows)
+               ->  Sort
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2
+         ->  Index Only Scan using t4_i1 on t4 bmt4
+               Index Cond: (c1 = bmt3.c1)
+(29 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
@@ -683,39 +685,39 @@ not used hint:
 duplication hint:
 error hint:
 
-                             QUERY PLAN                             
---------------------------------------------------------------------
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
  Aggregate
    InitPlan 1 (returns $2)
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b1t2.c1 = b1t1.c1)
-                 ->  Nested Loop
-                       Join Filter: (b1t2.c1 = b1t3.c1)
-                       ->  Nested Loop
-                             ->  Seq Scan on t2 b1t2
-                             ->  Bitmap Heap Scan on t4 b1t4
-                                   Recheck Cond: (c1 = b1t2.c1)
-                                   ->  Bitmap Index Scan on t4_pkey
-                                         Index Cond: (c1 = b1t2.c1)
-                       ->  Index Scan using t3_pkey on t3 b1t3
-                             Index Cond: (c1 = b1t4.c1)
+                 Hash Cond: (b1t1.c1 = b1t2.c1)
+                 ->  Seq Scan on t1 b1t1
                  ->  Hash
-                       ->  Seq Scan on t1 b1t1
+                       ->  Nested Loop
+                             Join Filter: (b1t2.c1 = b1t3.c1)
+                             ->  Nested Loop
+                                   ->  Seq Scan on t2 b1t2
+                                   ->  Bitmap Heap Scan on t4 b1t4
+                                         Recheck Cond: (c1 = b1t2.c1)
+                                         ->  Bitmap Index Scan on t4_pkey
+                                               Index Cond: (c1 = b1t2.c1)
+                             ->  Index Scan using t3_pkey on t3 b1t3
+                                   Index Cond: (c1 = b1t4.c1)
    ->  Hash Join
-         Hash Cond: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Hash Join
-                     Hash Cond: (bmt1.c1 = bmt2.c1)
-                     ->  Seq Scan on t1 bmt1
-                     ->  Hash
-                           ->  Index Scan using t2_pkey on t2 bmt2
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
          ->  Hash
-               ->  Seq Scan on t4 bmt4
+               ->  Nested Loop
+                     ->  Hash Join
+                           Hash Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Seq Scan on t1 bmt1
+                           ->  Hash
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
 (31 rows)
 
 -- No. S-2-1-2
@@ -730,47 +732,50 @@ SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2
                                QUERY PLAN                               
 ------------------------------------------------------------------------
  Aggregate
-   InitPlan 1 (returns $0)
+   InitPlan 1 (returns $1)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b1t1.c1 = b1t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b1t1.c1 = b1t4.c1)
+                       Merge Cond: (b1t1.c1 = b1t2.c1)
                        ->  Merge Join
                              Merge Cond: (b1t1.c1 = b1t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b1t1
                              ->  Index Only Scan using t3_i1 on t3 b1t3
-                       ->  Index Only Scan using t4_i1 on t4 b1t4
-                 ->  Sort
-                       Sort Key: b1t2.c1
-                       ->  Seq Scan on t2 b1t2
-   InitPlan 2 (returns $1)
+                       ->  Sort
+                             Sort Key: b1t2.c1
+                             ->  Seq Scan on t2 b1t2
+                 ->  Index Only Scan using t4_i1 on t4 b1t4
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b2t1.c1 = b2t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b2t1.c1 = b2t4.c1)
+                       Merge Cond: (b2t1.c1 = b2t2.c1)
                        ->  Merge Join
                              Merge Cond: (b2t1.c1 = b2t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b2t1
                              ->  Index Only Scan using t3_i1 on t3 b2t3
-                       ->  Index Only Scan using t4_i1 on t4 b2t4
-                 ->  Sort
-                       Sort Key: b2t2.c1
-                       ->  Seq Scan on t2 b2t2
-   ->  Merge Join
-         Merge Cond: (bmt1.c1 = bmt2.c1)
+                       ->  Sort
+                             Sort Key: b2t2.c1
+                             ->  Seq Scan on t2 b2t2
+                 ->  Index Only Scan using t4_i1 on t4 b2t4
+                       Index Cond: (c1 = b2t3.c1)
+   ->  Nested Loop
+         Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Merge Join
-               Merge Cond: (bmt1.c1 = bmt4.c1)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
                ->  Merge Join
                      Merge Cond: (bmt1.c1 = bmt3.c1)
                      ->  Index Only Scan using t1_i1 on t1 bmt1
                      ->  Index Only Scan using t3_i1 on t3 bmt3
-               ->  Index Only Scan using t4_i1 on t4 bmt4
-         ->  Sort
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2
-(41 rows)
+               ->  Sort
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2
+         ->  Index Only Scan using t4_i1 on t4 bmt4
+               Index Cond: (c1 = bmt3.c1)
+(44 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
@@ -808,56 +813,56 @@ not used hint:
 duplication hint:
 error hint:
 
-                             QUERY PLAN                              
----------------------------------------------------------------------
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
  Aggregate
    InitPlan 1 (returns $2)
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b1t2.c1 = b1t1.c1)
-                 ->  Nested Loop
-                       Join Filter: (b1t2.c1 = b1t3.c1)
-                       ->  Nested Loop
-                             ->  Seq Scan on t2 b1t2
-                             ->  Bitmap Heap Scan on t4 b1t4
-                                   Recheck Cond: (c1 = b1t2.c1)
-                                   ->  Bitmap Index Scan on t4_pkey
-                                         Index Cond: (c1 = b1t2.c1)
-                       ->  Index Scan using t3_pkey on t3 b1t3
-                             Index Cond: (c1 = b1t4.c1)
+                 Hash Cond: (b1t1.c1 = b1t2.c1)
+                 ->  Seq Scan on t1 b1t1
                  ->  Hash
-                       ->  Seq Scan on t1 b1t1
+                       ->  Nested Loop
+                             Join Filter: (b1t2.c1 = b1t3.c1)
+                             ->  Nested Loop
+                                   ->  Seq Scan on t2 b1t2
+                                   ->  Bitmap Heap Scan on t4 b1t4
+                                         Recheck Cond: (c1 = b1t2.c1)
+                                         ->  Bitmap Index Scan on t4_pkey
+                                               Index Cond: (c1 = b1t2.c1)
+                             ->  Index Scan using t3_pkey on t3 b1t3
+                                   Index Cond: (c1 = b1t4.c1)
    InitPlan 2 (returns $4)
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b2t1.c1 = b2t3.c1)
-                 ->  Merge Join
-                       Merge Cond: (b2t1.c1 = b2t2.c1)
-                       ->  Nested Loop
-                             ->  Index Scan using t4_pkey on t4 b2t4
-                             ->  Bitmap Heap Scan on t1 b2t1
-                                   Recheck Cond: (c1 = b2t4.c1)
-                                   ->  Bitmap Index Scan on t1_pkey
-                                         Index Cond: (c1 = b2t4.c1)
-                       ->  Sort
-                             Sort Key: b2t2.c1
-                             ->  Seq Scan on t2 b2t2
+                 Hash Cond: (b2t3.c1 = b2t1.c1)
+                 ->  Seq Scan on t3 b2t3
                  ->  Hash
-                       ->  Seq Scan on t3 b2t3
+                       ->  Merge Join
+                             Merge Cond: (b2t1.c1 = b2t2.c1)
+                             ->  Nested Loop
+                                   ->  Index Scan using t4_pkey on t4 b2t4
+                                   ->  Bitmap Heap Scan on t1 b2t1
+                                         Recheck Cond: (c1 = b2t4.c1)
+                                         ->  Bitmap Index Scan on t1_pkey
+                                               Index Cond: (c1 = b2t4.c1)
+                             ->  Sort
+                                   Sort Key: b2t2.c1
+                                   ->  Seq Scan on t2 b2t2
    ->  Hash Join
-         Hash Cond: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Hash Join
-                     Hash Cond: (bmt1.c1 = bmt2.c1)
-                     ->  Seq Scan on t1 bmt1
-                     ->  Hash
-                           ->  Index Scan using t2_pkey on t2 bmt2
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
          ->  Hash
-               ->  Seq Scan on t4 bmt4
+               ->  Nested Loop
+                     ->  Hash Join
+                           Hash Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Seq Scan on t1 bmt1
+                           ->  Hash
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
 (48 rows)
 
 -- No. S-2-1-3
@@ -865,19 +870,20 @@ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt
                            QUERY PLAN                           
 ----------------------------------------------------------------
  Aggregate
-   ->  Merge Join
-         Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Nested Loop
+         Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Merge Join
-               Merge Cond: (bmt1.c1 = bmt4.c1)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
                ->  Merge Join
                      Merge Cond: (bmt1.c1 = bmt3.c1)
                      ->  Index Only Scan using t1_i1 on t1 bmt1
                      ->  Index Only Scan using t3_i1 on t3 bmt3
-               ->  Index Only Scan using t4_i1 on t4 bmt4
-         ->  Sort
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2
-(13 rows)
+               ->  Sort
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2
+         ->  Index Only Scan using t4_i1 on t4 bmt4
+               Index Cond: (c1 = bmt3.c1)
+(14 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 */
@@ -894,23 +900,23 @@ not used hint:
 duplication hint:
 error hint:
 
-                            QUERY PLAN                             
--------------------------------------------------------------------
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
  Aggregate
    ->  Hash Join
-         Hash Cond: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Hash Join
-                     Hash Cond: (bmt1.c1 = bmt2.c1)
-                     ->  Seq Scan on t1 bmt1
-                     ->  Hash
-                           ->  Index Scan using t2_pkey on t2 bmt2
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
          ->  Hash
-               ->  Seq Scan on t4 bmt4
+               ->  Nested Loop
+                     ->  Hash Join
+                           Hash Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Seq Scan on t1 bmt1
+                           ->  Hash
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
 (15 rows)
 
 -- No. S-2-1-4
@@ -918,19 +924,20 @@ EXPLAIN (COSTS false) SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT *
                            QUERY PLAN                           
 ----------------------------------------------------------------
  Aggregate
-   ->  Merge Join
-         Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Nested Loop
+         Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Merge Join
-               Merge Cond: (bmt1.c1 = bmt4.c1)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
                ->  Merge Join
                      Merge Cond: (bmt1.c1 = bmt3.c1)
                      ->  Index Only Scan using t1_i1 on t1 bmt1
                      ->  Index Only Scan using t3_i1 on t3 bmt3
-               ->  Index Only Scan using t4_i1 on t4 bmt4
-         ->  Sort
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2
-(13 rows)
+               ->  Sort
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2
+         ->  Index Only Scan using t4_i1 on t4 bmt4
+               Index Cond: (c1 = bmt3.c1)
+(14 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 */
@@ -947,23 +954,23 @@ not used hint:
 duplication hint:
 error hint:
 
-                            QUERY PLAN                             
--------------------------------------------------------------------
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
  Aggregate
    ->  Hash Join
-         Hash Cond: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Hash Join
-                     Hash Cond: (bmt1.c1 = bmt2.c1)
-                     ->  Seq Scan on t1 bmt1
-                     ->  Hash
-                           ->  Index Scan using t2_pkey on t2 bmt2
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
          ->  Hash
-               ->  Seq Scan on t4 bmt4
+               ->  Nested Loop
+                     ->  Hash Join
+                           Hash Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Seq Scan on t1 bmt1
+                           ->  Hash
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
 (15 rows)
 
 -- No. S-2-1-5
@@ -976,34 +983,36 @@ SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1
                                QUERY PLAN                               
 ------------------------------------------------------------------------
  Aggregate
-   InitPlan 1 (returns $0)
+   InitPlan 1 (returns $1)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b1t1.c1 = b1t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b1t1.c1 = b1t4.c1)
+                       Merge Cond: (b1t1.c1 = b1t2.c1)
                        ->  Merge Join
                              Merge Cond: (b1t1.c1 = b1t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b1t1
                              ->  Index Only Scan using t3_i1 on t3 b1t3
-                       ->  Index Only Scan using t4_i1 on t4 b1t4
-                 ->  Sort
-                       Sort Key: b1t2.c1
-                       ->  Seq Scan on t2 b1t2
-   ->  Merge Join
-         Merge Cond: (bmt1.c1 = bmt2.c1)
+                       ->  Sort
+                             Sort Key: b1t2.c1
+                             ->  Seq Scan on t2 b1t2
+                 ->  Index Only Scan using t4_i1 on t4 b1t4
+                       Index Cond: (c1 = b1t3.c1)
+   ->  Nested Loop
+         Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Merge Join
-               Merge Cond: (bmt1.c1 = bmt4.c1)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
                ->  Merge Join
                      Merge Cond: (bmt1.c1 = bmt3.c1)
                      ->  Index Only Scan using t1_i1 on t1 bmt1
-                           Filter: (c1 <> $0)
+                           Filter: (c1 <> $1)
                      ->  Index Only Scan using t3_i1 on t3 bmt3
-               ->  Index Only Scan using t4_i1 on t4 bmt4
-         ->  Sort
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2
-(28 rows)
+               ->  Sort
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2
+         ->  Index Only Scan using t4_i1 on t4 bmt4
+               Index Cond: (c1 = bmt3.c1)
+(30 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
@@ -1032,40 +1041,40 @@ not used hint:
 duplication hint:
 error hint:
 
-                             QUERY PLAN                             
---------------------------------------------------------------------
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
  Aggregate
    InitPlan 1 (returns $2)
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b1t2.c1 = b1t1.c1)
-                 ->  Nested Loop
-                       Join Filter: (b1t2.c1 = b1t3.c1)
-                       ->  Nested Loop
-                             ->  Seq Scan on t2 b1t2
-                             ->  Bitmap Heap Scan on t4 b1t4
-                                   Recheck Cond: (c1 = b1t2.c1)
-                                   ->  Bitmap Index Scan on t4_pkey
-                                         Index Cond: (c1 = b1t2.c1)
-                       ->  Index Scan using t3_pkey on t3 b1t3
-                             Index Cond: (c1 = b1t4.c1)
+                 Hash Cond: (b1t1.c1 = b1t2.c1)
+                 ->  Seq Scan on t1 b1t1
                  ->  Hash
-                       ->  Seq Scan on t1 b1t1
+                       ->  Nested Loop
+                             Join Filter: (b1t2.c1 = b1t3.c1)
+                             ->  Nested Loop
+                                   ->  Seq Scan on t2 b1t2
+                                   ->  Bitmap Heap Scan on t4 b1t4
+                                         Recheck Cond: (c1 = b1t2.c1)
+                                         ->  Bitmap Index Scan on t4_pkey
+                                               Index Cond: (c1 = b1t2.c1)
+                             ->  Index Scan using t3_pkey on t3 b1t3
+                                   Index Cond: (c1 = b1t4.c1)
    ->  Hash Join
-         Hash Cond: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Hash Join
-                     Hash Cond: (bmt1.c1 = bmt2.c1)
-                     ->  Seq Scan on t1 bmt1
-                           Filter: (c1 <> $2)
-                     ->  Hash
-                           ->  Index Scan using t2_pkey on t2 bmt2
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
          ->  Hash
-               ->  Seq Scan on t4 bmt4
+               ->  Nested Loop
+                     ->  Hash Join
+                           Hash Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Seq Scan on t1 bmt1
+                                 Filter: (c1 <> $2)
+                           ->  Hash
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
 (32 rows)
 
 -- No. S-2-1-6
@@ -1080,48 +1089,51 @@ SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2
                                QUERY PLAN                               
 ------------------------------------------------------------------------
  Aggregate
-   InitPlan 1 (returns $0)
+   InitPlan 1 (returns $1)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b1t1.c1 = b1t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b1t1.c1 = b1t4.c1)
+                       Merge Cond: (b1t1.c1 = b1t2.c1)
                        ->  Merge Join
                              Merge Cond: (b1t1.c1 = b1t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b1t1
                              ->  Index Only Scan using t3_i1 on t3 b1t3
-                       ->  Index Only Scan using t4_i1 on t4 b1t4
-                 ->  Sort
-                       Sort Key: b1t2.c1
-                       ->  Seq Scan on t2 b1t2
-   InitPlan 2 (returns $1)
+                       ->  Sort
+                             Sort Key: b1t2.c1
+                             ->  Seq Scan on t2 b1t2
+                 ->  Index Only Scan using t4_i1 on t4 b1t4
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b2t1.c1 = b2t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b2t1.c1 = b2t4.c1)
+                       Merge Cond: (b2t1.c1 = b2t2.c1)
                        ->  Merge Join
                              Merge Cond: (b2t1.c1 = b2t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b2t1
                              ->  Index Only Scan using t3_i1 on t3 b2t3
-                       ->  Index Only Scan using t4_i1 on t4 b2t4
-                 ->  Sort
-                       Sort Key: b2t2.c1
-                       ->  Seq Scan on t2 b2t2
-   ->  Merge Join
-         Merge Cond: (bmt1.c1 = bmt2.c1)
+                       ->  Sort
+                             Sort Key: b2t2.c1
+                             ->  Seq Scan on t2 b2t2
+                 ->  Index Only Scan using t4_i1 on t4 b2t4
+                       Index Cond: (c1 = b2t3.c1)
+   ->  Nested Loop
+         Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Merge Join
-               Merge Cond: (bmt1.c1 = bmt4.c1)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
                ->  Merge Join
                      Merge Cond: (bmt1.c1 = bmt3.c1)
                      ->  Index Only Scan using t1_i1 on t1 bmt1
-                           Filter: ((c1 <> $0) AND (c1 <> $1))
+                           Filter: ((c1 <> $1) AND (c1 <> $3))
                      ->  Index Only Scan using t3_i1 on t3 bmt3
-               ->  Index Only Scan using t4_i1 on t4 bmt4
-         ->  Sort
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2
-(42 rows)
+               ->  Sort
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2
+         ->  Index Only Scan using t4_i1 on t4 bmt4
+               Index Cond: (c1 = bmt3.c1)
+(45 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
@@ -1159,57 +1171,57 @@ not used hint:
 duplication hint:
 error hint:
 
-                             QUERY PLAN                              
----------------------------------------------------------------------
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
  Aggregate
    InitPlan 1 (returns $2)
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b1t2.c1 = b1t1.c1)
-                 ->  Nested Loop
-                       Join Filter: (b1t2.c1 = b1t3.c1)
-                       ->  Nested Loop
-                             ->  Seq Scan on t2 b1t2
-                             ->  Bitmap Heap Scan on t4 b1t4
-                                   Recheck Cond: (c1 = b1t2.c1)
-                                   ->  Bitmap Index Scan on t4_pkey
-                                         Index Cond: (c1 = b1t2.c1)
-                       ->  Index Scan using t3_pkey on t3 b1t3
-                             Index Cond: (c1 = b1t4.c1)
+                 Hash Cond: (b1t1.c1 = b1t2.c1)
+                 ->  Seq Scan on t1 b1t1
                  ->  Hash
-                       ->  Seq Scan on t1 b1t1
+                       ->  Nested Loop
+                             Join Filter: (b1t2.c1 = b1t3.c1)
+                             ->  Nested Loop
+                                   ->  Seq Scan on t2 b1t2
+                                   ->  Bitmap Heap Scan on t4 b1t4
+                                         Recheck Cond: (c1 = b1t2.c1)
+                                         ->  Bitmap Index Scan on t4_pkey
+                                               Index Cond: (c1 = b1t2.c1)
+                             ->  Index Scan using t3_pkey on t3 b1t3
+                                   Index Cond: (c1 = b1t4.c1)
    InitPlan 2 (returns $4)
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b2t1.c1 = b2t3.c1)
-                 ->  Merge Join
-                       Merge Cond: (b2t1.c1 = b2t2.c1)
-                       ->  Nested Loop
-                             ->  Index Scan using t4_pkey on t4 b2t4
-                             ->  Bitmap Heap Scan on t1 b2t1
-                                   Recheck Cond: (c1 = b2t4.c1)
-                                   ->  Bitmap Index Scan on t1_pkey
-                                         Index Cond: (c1 = b2t4.c1)
-                       ->  Sort
-                             Sort Key: b2t2.c1
-                             ->  Seq Scan on t2 b2t2
+                 Hash Cond: (b2t3.c1 = b2t1.c1)
+                 ->  Seq Scan on t3 b2t3
                  ->  Hash
-                       ->  Seq Scan on t3 b2t3
+                       ->  Merge Join
+                             Merge Cond: (b2t1.c1 = b2t2.c1)
+                             ->  Nested Loop
+                                   ->  Index Scan using t4_pkey on t4 b2t4
+                                   ->  Bitmap Heap Scan on t1 b2t1
+                                         Recheck Cond: (c1 = b2t4.c1)
+                                         ->  Bitmap Index Scan on t1_pkey
+                                               Index Cond: (c1 = b2t4.c1)
+                             ->  Sort
+                                   Sort Key: b2t2.c1
+                                   ->  Seq Scan on t2 b2t2
    ->  Hash Join
-         Hash Cond: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Hash Join
-                     Hash Cond: (bmt1.c1 = bmt2.c1)
-                     ->  Seq Scan on t1 bmt1
-                           Filter: ((c1 <> $2) AND (c1 <> $4))
-                     ->  Hash
-                           ->  Index Scan using t2_pkey on t2 bmt2
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
          ->  Hash
-               ->  Seq Scan on t4 bmt4
+               ->  Nested Loop
+                     ->  Hash Join
+                           Hash Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Seq Scan on t1 bmt1
+                                 Filter: ((c1 <> $2) AND (c1 <> $4))
+                           ->  Hash
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
 (49 rows)
 
 -- No. S-2-1-7
@@ -1227,18 +1239,19 @@ AND bmt1.c1 = c1.c1
  Aggregate
    CTE c1
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b1t1.c1 = b1t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b1t1.c1 = b1t4.c1)
+                       Merge Cond: (b1t1.c1 = b1t2.c1)
                        ->  Merge Join
                              Merge Cond: (b1t1.c1 = b1t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b1t1
                              ->  Index Only Scan using t3_i1 on t3 b1t3
-                       ->  Index Only Scan using t4_i1 on t4 b1t4
-                 ->  Sort
-                       Sort Key: b1t2.c1
-                       ->  Seq Scan on t2 b1t2
+                       ->  Sort
+                             Sort Key: b1t2.c1
+                             ->  Seq Scan on t2 b1t2
+                 ->  Index Only Scan using t4_i1 on t4 b1t4
+                       Index Cond: (c1 = b1t3.c1)
    ->  Nested Loop
          Join Filter: (bmt1.c1 = bmt4.c1)
          ->  Nested Loop
@@ -1255,7 +1268,7 @@ AND bmt1.c1 = c1.c1
                      Index Cond: (c1 = bmt3.c1)
          ->  Index Only Scan using t4_i1 on t4 bmt4
                Index Cond: (c1 = bmt3.c1)
-(31 rows)
+(32 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
@@ -1287,42 +1300,43 @@ not used hint:
 duplication hint:
 error hint:
 
-                             QUERY PLAN                             
---------------------------------------------------------------------
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
  Aggregate
    CTE c1
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b1t2.c1 = b1t1.c1)
-                 ->  Nested Loop
-                       Join Filter: (b1t2.c1 = b1t3.c1)
-                       ->  Nested Loop
-                             ->  Seq Scan on t2 b1t2
-                             ->  Bitmap Heap Scan on t4 b1t4
-                                   Recheck Cond: (c1 = b1t2.c1)
-                                   ->  Bitmap Index Scan on t4_pkey
-                                         Index Cond: (c1 = b1t2.c1)
-                       ->  Index Scan using t3_pkey on t3 b1t3
-                             Index Cond: (c1 = b1t4.c1)
+                 Hash Cond: (b1t1.c1 = b1t2.c1)
+                 ->  Seq Scan on t1 b1t1
                  ->  Hash
-                       ->  Seq Scan on t1 b1t1
-   ->  Nested Loop
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               ->  Nested Loop
-                     ->  Hash Join
-                           Hash Cond: (bmt1.c1 = c1.c1)
-                           ->  Seq Scan on t1 bmt1
-                           ->  Hash
-                                 ->  CTE Scan on c1
-                     ->  Index Scan using t2_pkey on t2 bmt2
-                           Index Cond: (c1 = bmt1.c1)
-               ->  Bitmap Heap Scan on t3 bmt3
-                     Recheck Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Index Scan on t3_pkey
-                           Index Cond: (c1 = bmt1.c1)
+                       ->  Nested Loop
+                             Join Filter: (b1t2.c1 = b1t3.c1)
+                             ->  Nested Loop
+                                   ->  Seq Scan on t2 b1t2
+                                   ->  Bitmap Heap Scan on t4 b1t4
+                                         Recheck Cond: (c1 = b1t2.c1)
+                                         ->  Bitmap Index Scan on t4_pkey
+                                               Index Cond: (c1 = b1t2.c1)
+                             ->  Index Scan using t3_pkey on t3 b1t3
+                                   Index Cond: (c1 = b1t4.c1)
+   ->  Hash Join
+         Hash Cond: (bmt4.c1 = bmt1.c1)
          ->  Seq Scan on t4 bmt4
-(33 rows)
+         ->  Hash
+               ->  Nested Loop
+                     ->  Nested Loop
+                           ->  Hash Join
+                                 Hash Cond: (bmt1.c1 = c1.c1)
+                                 ->  Seq Scan on t1 bmt1
+                                 ->  Hash
+                                       ->  CTE Scan on c1
+                           ->  Index Scan using t2_pkey on t2 bmt2
+                                 Index Cond: (c1 = bmt1.c1)
+                     ->  Bitmap Heap Scan on t3 bmt3
+                           Recheck Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Index Scan on t3_pkey
+                                 Index Cond: (c1 = bmt1.c1)
+(34 rows)
 
 -- No. S-2-1-8
 EXPLAIN (COSTS false)
@@ -1343,32 +1357,34 @@ AND bmt1.c1 = c2.c1
  Aggregate
    CTE c1
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b1t1.c1 = b1t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b1t1.c1 = b1t4.c1)
+                       Merge Cond: (b1t1.c1 = b1t2.c1)
                        ->  Merge Join
                              Merge Cond: (b1t1.c1 = b1t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b1t1
                              ->  Index Only Scan using t3_i1 on t3 b1t3
-                       ->  Index Only Scan using t4_i1 on t4 b1t4
-                 ->  Sort
-                       Sort Key: b1t2.c1
-                       ->  Seq Scan on t2 b1t2
+                       ->  Sort
+                             Sort Key: b1t2.c1
+                             ->  Seq Scan on t2 b1t2
+                 ->  Index Only Scan using t4_i1 on t4 b1t4
+                       Index Cond: (c1 = b1t3.c1)
    CTE c2
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Nested Loop
+                 Join Filter: (b2t1.c1 = b2t4.c1)
                  ->  Merge Join
-                       Merge Cond: (b2t1.c1 = b2t4.c1)
+                       Merge Cond: (b2t1.c1 = b2t2.c1)
                        ->  Merge Join
                              Merge Cond: (b2t1.c1 = b2t3.c1)
                              ->  Index Only Scan using t1_i1 on t1 b2t1
                              ->  Index Only Scan using t3_i1 on t3 b2t3
-                       ->  Index Only Scan using t4_i1 on t4 b2t4
-                 ->  Sort
-                       Sort Key: b2t2.c1
-                       ->  Seq Scan on t2 b2t2
+                       ->  Sort
+                             Sort Key: b2t2.c1
+                             ->  Seq Scan on t2 b2t2
+                 ->  Index Only Scan using t4_i1 on t4 b2t4
+                       Index Cond: (c1 = b2t3.c1)
    ->  Nested Loop
          Join Filter: (bmt1.c1 = c2.c1)
          ->  Nested Loop
@@ -1388,7 +1404,7 @@ AND bmt1.c1 = c2.c1
                ->  Index Only Scan using t4_i1 on t4 bmt4
                      Index Cond: (c1 = bmt3.c1)
          ->  CTE Scan on c2
-(48 rows)
+(50 rows)
 
 /*+SeqScan(bmt1)IndexScan(bmt2 t2_pkey)BitmapScan(bmt3 t3_pkey)TidScan(bmt4)
 TidScan(b1t1)SeqScan(b1t2)IndexScan(b1t3 t3_pkey)BitmapScan(b1t4 t4_pkey)
@@ -1431,62 +1447,63 @@ not used hint:
 duplication hint:
 error hint:
 
-                             QUERY PLAN                              
----------------------------------------------------------------------
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
  Aggregate
    CTE c1
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b1t2.c1 = b1t1.c1)
-                 ->  Nested Loop
-                       Join Filter: (b1t2.c1 = b1t3.c1)
-                       ->  Nested Loop
-                             ->  Seq Scan on t2 b1t2
-                             ->  Bitmap Heap Scan on t4 b1t4
-                                   Recheck Cond: (c1 = b1t2.c1)
-                                   ->  Bitmap Index Scan on t4_pkey
-                                         Index Cond: (c1 = b1t2.c1)
-                       ->  Index Scan using t3_pkey on t3 b1t3
-                             Index Cond: (c1 = b1t4.c1)
+                 Hash Cond: (b1t1.c1 = b1t2.c1)
+                 ->  Seq Scan on t1 b1t1
                  ->  Hash
-                       ->  Seq Scan on t1 b1t1
+                       ->  Nested Loop
+                             Join Filter: (b1t2.c1 = b1t3.c1)
+                             ->  Nested Loop
+                                   ->  Seq Scan on t2 b1t2
+                                   ->  Bitmap Heap Scan on t4 b1t4
+                                         Recheck Cond: (c1 = b1t2.c1)
+                                         ->  Bitmap Index Scan on t4_pkey
+                                               Index Cond: (c1 = b1t2.c1)
+                             ->  Index Scan using t3_pkey on t3 b1t3
+                                   Index Cond: (c1 = b1t4.c1)
    CTE c2
      ->  Aggregate
            ->  Hash Join
-                 Hash Cond: (b2t1.c1 = b2t3.c1)
-                 ->  Merge Join
-                       Merge Cond: (b2t1.c1 = b2t2.c1)
-                       ->  Nested Loop
-                             ->  Index Scan using t4_pkey on t4 b2t4
-                             ->  Bitmap Heap Scan on t1 b2t1
-                                   Recheck Cond: (c1 = b2t4.c1)
-                                   ->  Bitmap Index Scan on t1_pkey
-                                         Index Cond: (c1 = b2t4.c1)
-                       ->  Sort
-                             Sort Key: b2t2.c1
-                             ->  Seq Scan on t2 b2t2
+                 Hash Cond: (b2t3.c1 = b2t1.c1)
+                 ->  Seq Scan on t3 b2t3
                  ->  Hash
-                       ->  Seq Scan on t3 b2t3
-   ->  Nested Loop
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Nested Loop
-               Join Filter: (bmt1.c1 = c2.c1)
+                       ->  Merge Join
+                             Merge Cond: (b2t1.c1 = b2t2.c1)
+                             ->  Nested Loop
+                                   ->  Index Scan using t4_pkey on t4 b2t4
+                                   ->  Bitmap Heap Scan on t1 b2t1
+                                         Recheck Cond: (c1 = b2t4.c1)
+                                         ->  Bitmap Index Scan on t1_pkey
+                                               Index Cond: (c1 = b2t4.c1)
+                             ->  Sort
+                                   Sort Key: b2t2.c1
+                                   ->  Seq Scan on t2 b2t2
+   ->  Hash Join
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4
+         ->  Hash
                ->  Nested Loop
+                     Join Filter: (bmt1.c1 = c2.c1)
                      ->  Nested Loop
-                           ->  Hash Join
-                                 Hash Cond: (bmt1.c1 = c1.c1)
-                                 ->  Seq Scan on t1 bmt1
-                                 ->  Hash
-                                       ->  CTE Scan on c1
-                           ->  Index Scan using t2_pkey on t2 bmt2
-                                 Index Cond: (c1 = bmt1.c1)
-                     ->  Bitmap Heap Scan on t3 bmt3
-                           Recheck Cond: (c1 = bmt1.c1)
-                           ->  Bitmap Index Scan on t3_pkey
-                                 Index Cond: (c1 = bmt1.c1)
-               ->  CTE Scan on c2
-         ->  Seq Scan on t4 bmt4
-(53 rows)
+                           ->  Nested Loop
+                                 ->  Hash Join
+                                       Hash Cond: (bmt1.c1 = c1.c1)
+                                       ->  Seq Scan on t1 bmt1
+                                       ->  Hash
+                                             ->  CTE Scan on c1
+                                 ->  Index Scan using t2_pkey on t2 bmt2
+                                       Index Cond: (c1 = bmt1.c1)
+                           ->  Bitmap Heap Scan on t3 bmt3
+                                 Recheck Cond: (c1 = bmt1.c1)
+                                 ->  Bitmap Index Scan on t3_pkey
+                                       Index Cond: (c1 = bmt1.c1)
+                     ->  CTE Scan on c2
+(54 rows)
 
 ----
 ---- No. S-2-2 the number of the tables per quiry block
@@ -3548,7 +3565,7 @@ SET enable_tidscan TO off;
 EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
            QUERY PLAN            
 ---------------------------------
- Index Scan using ti1_i2 on ti1
+ Index Scan using ti1_i4 on ti1
    Index Cond: (c2 = 1)
    Filter: (ctid = '(1,1)'::tid)
 (3 rows)
@@ -3560,7 +3577,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
  Bitmap Heap Scan on ti1
    Recheck Cond: (c2 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on ti1_i2
+   ->  Bitmap Index Scan on ti1_i4
          Index Cond: (c2 = 1)
 (5 rows)
 
@@ -3592,19 +3609,19 @@ error hint:
 (3 rows)
 
 -- No. S-3-3-2
-/*+IndexScan(ti1 ti1_i3 ti1_i2)*/
+/*+IndexScan(ti1 ti1_i3 ti1_i4)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
-LOG:  available indexes for IndexScan(ti1): ti1_i3 ti1_i2
+LOG:  available indexes for IndexScan(ti1): ti1_i4 ti1_i3
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(ti1 ti1_i3 ti1_i2)
+IndexScan(ti1 ti1_i3 ti1_i4)
 not used hint:
 duplication hint:
 error hint:
 
            QUERY PLAN            
 ---------------------------------
- Index Scan using ti1_i2 on ti1
+ Index Scan using ti1_i4 on ti1
    Index Cond: (c2 = 1)
    Filter: (ctid = '(1,1)'::tid)
 (3 rows)
@@ -3622,7 +3639,7 @@ error hint:
 
            QUERY PLAN            
 ---------------------------------
- Index Scan using ti1_i2 on ti1
+ Index Scan using ti1_i4 on ti1
    Index Cond: (c2 = 1)
    Filter: (ctid = '(1,1)'::tid)
 (3 rows)
@@ -3648,12 +3665,12 @@ error hint:
 (5 rows)
 
 -- No. S-3-3-5
-/*+BitmapScan(ti1 ti1_i3 ti1_i2)*/
+/*+BitmapScan(ti1 ti1_i3 ti1_i4)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE ti1.c2 = 1 AND ctid = '(1,1)';
-LOG:  available indexes for BitmapScan(ti1): ti1_i3 ti1_i2
+LOG:  available indexes for BitmapScan(ti1): ti1_i4 ti1_i3
 LOG:  pg_hint_plan:
 used hint:
-BitmapScan(ti1 ti1_i3 ti1_i2)
+BitmapScan(ti1 ti1_i3 ti1_i4)
 not used hint:
 duplication hint:
 error hint:
@@ -3663,7 +3680,7 @@ error hint:
  Bitmap Heap Scan on ti1
    Recheck Cond: (c2 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on ti1_i2
+   ->  Bitmap Index Scan on ti1_i4
          Index Cond: (c2 = 1)
 (5 rows)
 
@@ -3683,7 +3700,7 @@ error hint:
  Bitmap Heap Scan on ti1
    Recheck Cond: (c2 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on ti1_i2
+   ->  Bitmap Index Scan on ti1_i4
          Index Cond: (c2 = 1)
 (5 rows)
 
@@ -3705,19 +3722,19 @@ error hint:
 (2 rows)
 
 -- No. S-3-3-8
-/*+IndexOnlyScan(ti1 ti1_i3 ti1_i2)*/
+/*+IndexOnlyScan(ti1 ti1_i3 ti1_i4)*/
 EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE ti1.c2 >= 1;
-LOG:  available indexes for IndexOnlyScan(ti1): ti1_i3 ti1_i2
+LOG:  available indexes for IndexOnlyScan(ti1): ti1_i4 ti1_i3
 LOG:  pg_hint_plan:
 used hint:
-IndexOnlyScan(ti1 ti1_i3 ti1_i2)
+IndexOnlyScan(ti1 ti1_i3 ti1_i4)
 not used hint:
 duplication hint:
 error hint:
 
              QUERY PLAN              
 -------------------------------------
- Index Only Scan using ti1_i2 on ti1
+ Index Only Scan using ti1_i4 on ti1
    Index Cond: (c2 >= 1)
 (2 rows)
 
@@ -4217,9 +4234,9 @@ error hint:
 
 -- No. S-3-4-24
 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
-              QUERY PLAN               
----------------------------------------
- Index Only Scan using ti1_uniq on ti1
+            QUERY PLAN            
+----------------------------------
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -4265,9 +4282,9 @@ error hint:
 
 -- No. S-3-4-26
 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 = 1;
-              QUERY PLAN               
----------------------------------------
- Index Only Scan using ti1_uniq on ti1
+            QUERY PLAN            
+----------------------------------
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -4281,11 +4298,13 @@ not used hint:
 duplication hint:
 error hint:
 
-     QUERY PLAN     
---------------------
- Seq Scan on ti1
-   Filter: (c1 = 1)
-(2 rows)
+             QUERY PLAN             
+------------------------------------
+ Bitmap Heap Scan on ti1
+   Recheck Cond: (c1 = 1)
+   ->  Bitmap Index Scan on ti1_gin
+         Index Cond: (c1 = 1)
+(4 rows)
 
 -- No. S-3-4-27
 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 < 100;
@@ -4404,11 +4423,13 @@ not used hint:
 duplication hint:
 error hint:
 
-                                  QUERY PLAN                                   
--------------------------------------------------------------------------------
- Seq Scan on ti1
-   Filter: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
-(2 rows)
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Bitmap Heap Scan on ti1
+   Recheck Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+   ->  Bitmap Index Scan on ti1_ts
+         Index Cond: (to_tsvector('english'::regconfig, c4) @@ '''a'' & ''b'''::tsquery)
+(4 rows)
 
 -- No. S-3-4-32
 EXPLAIN (COSTS false) SELECT c1 FROM s1.ti1 WHERE c1 >= 1;
@@ -5233,7 +5254,7 @@ error hint:
  Bitmap Heap Scan on ti1
    Recheck Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on ti1_uniq
+   ->  Bitmap Index Scan on ti1_hash
          Index Cond: (c1 = 1)
 (5 rows)
 
@@ -5281,7 +5302,7 @@ error hint:
  Bitmap Heap Scan on ti1
    Recheck Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on ti1_uniq
+   ->  Bitmap Index Scan on ti1_hash
          Index Cond: (c1 = 1)
 (5 rows)
 
@@ -5380,7 +5401,7 @@ error hint:
 
             QUERY PLAN            
 ----------------------------------
- Index Scan using ti1_uniq on ti1
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
 (3 rows)
@@ -5436,7 +5457,7 @@ error hint:
  Bitmap Heap Scan on ti1
    Recheck Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on ti1_uniq
+   ->  Bitmap Index Scan on ti1_hash
          Index Cond: (c1 = 1)
 (5 rows)
 
@@ -5712,7 +5733,7 @@ error hint:
 
             QUERY PLAN            
 ----------------------------------
- Index Scan using ti1_uniq on ti1
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
 (3 rows)
@@ -5817,7 +5838,7 @@ error hint:
 
             QUERY PLAN            
 ----------------------------------
- Index Scan using ti1_uniq on ti1
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -5833,9 +5854,9 @@ duplication hint:
 error hint:
 NoIndexOnlyScan(ti1 ti1_pkey)
 
-              QUERY PLAN               
----------------------------------------
- Index Only Scan using ti1_uniq on ti1
+            QUERY PLAN            
+----------------------------------
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -5851,9 +5872,9 @@ duplication hint:
 error hint:
 NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)
 
-              QUERY PLAN               
----------------------------------------
- Index Only Scan using ti1_uniq on ti1
+            QUERY PLAN            
+----------------------------------
+ Index Scan using ti1_hash on ti1
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -5863,7 +5884,7 @@ NoIndexOnlyScan(ti1 ti1_pkey ti1_btree)
 EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1;
            QUERY PLAN           
 --------------------------------
- Index Scan using ti1_i2 on ti1
+ Index Scan using ti1_i4 on ti1
    Index Cond: (c2 = 1)
 (2 rows)
 
@@ -5897,7 +5918,7 @@ error hint:
 
            QUERY PLAN           
 --------------------------------
- Index Scan using ti1_i2 on ti1
+ Index Scan using ti1_i4 on ti1
    Index Cond: (c2 = 1)
 (2 rows)