OSDN Git Service

R-2-4-*の試験とR-2-5-*の試験を追加した。
authorTakashi Suzuki <suzuki.takashi@metrosystems.co.jp>
Thu, 16 Jan 2014 06:57:30 +0000 (15:57 +0900)
committerTakashi Suzuki <suzuki.takashi@metrosystems.co.jp>
Thu, 16 Jan 2014 06:57:30 +0000 (15:57 +0900)
expected/R_2-4-1.out [new file with mode: 0644]
expected/R_2-4-2.out [new file with mode: 0644]
expected/R_2-5-1.out [new file with mode: 0644]
expected/R_2-5-2.out [new file with mode: 0644]
expected/R_2-5-3.out [new file with mode: 0644]
expected/ut-R.out
sql/ut-R.sql

diff --git a/expected/R_2-4-1.out b/expected/R_2-4-1.out
new file mode 100644 (file)
index 0000000..f6018a5
--- /dev/null
@@ -0,0 +1,35 @@
+                                   QUERY PLAN                                   
+--------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=73)
+   ->  Hash Join  (cost=xxx rows=1 width=58)
+         Hash Cond: (t2.c1 = "*VALUES*".column1)
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
+         ->  Hash  (cost=xxx rows=1 width=44)
+               ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
+         Index Cond: (c1 = t2.c1)
+(8 rows)
+
+                                   QUERY PLAN                                   
+--------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=73)
+   ->  Hash Join  (cost=xxx rows=1 width=58)
+         Hash Cond: (t2.c1 = "*VALUES*".column1)
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
+         ->  Hash  (cost=xxx rows=1 width=44)
+               ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
+         Index Cond: (c1 = t2.c1)
+(8 rows)
+
+                                 QUERY PLAN                                  
+-----------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=73)
+   ->  Nested Loop  (cost=xxx rows=2 width=59)
+         ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
+               Index Cond: (c1 = "*VALUES*".column1)
+   ->  Index Scan using t2_i1 on t2  (cost=xxx rows=1 width=14)
+         Index Cond: (c1 = t1.c1)
+(7 rows)
+
diff --git a/expected/R_2-4-2.out b/expected/R_2-4-2.out
new file mode 100644 (file)
index 0000000..10489ef
--- /dev/null
@@ -0,0 +1,45 @@
+                                      QUERY PLAN                                      
+--------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=117)
+   Join Filter: (t1.c1 = "*VALUES*_1".column1)
+   ->  Nested Loop  (cost=xxx rows=1 width=73)
+         ->  Hash Join  (cost=xxx rows=1 width=58)
+               Hash Cond: (t2.c1 = "*VALUES*".column1)
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
+               ->  Hash  (cost=xxx rows=1 width=44)
+                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
+               Index Cond: (c1 = t2.c1)
+   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=44)
+(11 rows)
+
+                                      QUERY PLAN                                      
+--------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=117)
+   Join Filter: (t1.c1 = "*VALUES*_1".column1)
+   ->  Nested Loop  (cost=xxx rows=1 width=73)
+         ->  Hash Join  (cost=xxx rows=1 width=58)
+               Hash Cond: (t2.c1 = "*VALUES*".column1)
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
+               ->  Hash  (cost=xxx rows=1 width=44)
+                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
+               Index Cond: (c1 = t2.c1)
+   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=44)
+(11 rows)
+
+                                      QUERY PLAN                                      
+--------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=117)
+   Join Filter: (t1.c1 = "*VALUES*_1".column1)
+   ->  Nested Loop  (cost=xxx rows=1 width=73)
+         ->  Hash Join  (cost=xxx rows=1 width=58)
+               Hash Cond: (t2.c1 = "*VALUES*".column1)
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
+               ->  Hash  (cost=xxx rows=1 width=44)
+                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
+               Index Cond: (c1 = t2.c1)
+   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=44)
+(11 rows)
+
diff --git a/expected/R_2-5-1.out b/expected/R_2-5-1.out
new file mode 100644 (file)
index 0000000..3d3f19b
--- /dev/null
@@ -0,0 +1,36 @@
+                                              QUERY PLAN                                              
+------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=4)
+   ->  Nested Loop  (cost=xxx rows=100 width=4)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Merge Join  (cost=xxx rows=100 width=12)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
+               ->  Merge Join  (cost=xxx rows=1000 width=8)
+                     Merge Cond: (bmt1.c1 = bmt3.c1)
+                     ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
+                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
+               ->  Sort  (cost=xxx rows=100 width=4)
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
+               Index Cond: (c1 = bmt3.c1)
+(14 rows)
+
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=70 width=4)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
+   ->  Sort  (cost=xxx rows=100 width=12)
+         Sort Key: bmt2.c1
+         ->  Hash Join  (cost=xxx rows=100 width=12)
+               Hash Cond: (bmt3.c1 = bmt2.c1)
+               ->  Hash Join  (cost=xxx rows=1100 width=8)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
+                     ->  Hash  (cost=xxx rows=1100 width=4)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
+               ->  Hash  (cost=xxx rows=100 width=4)
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
+(14 rows)
+
diff --git a/expected/R_2-5-2.out b/expected/R_2-5-2.out
new file mode 100644 (file)
index 0000000..1481d5d
--- /dev/null
@@ -0,0 +1,35 @@
+                                           QUERY PLAN                                           
+------------------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=100 width=4)
+   Join Filter: (bmt1.c1 = bmt4.c1)
+   ->  Merge Join  (cost=xxx rows=100 width=12)
+         Merge Cond: (bmt1.c1 = bmt2.c1)
+         ->  Merge Join  (cost=xxx rows=1000 width=8)
+               Merge Cond: (bmt1.c1 = bmt3.c1)
+               ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
+               ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
+         ->  Sort  (cost=xxx rows=100 width=4)
+               Sort Key: bmt2.c1
+               ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
+   ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
+         Index Cond: (c1 = bmt3.c1)
+(13 rows)
+
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=60 width=4)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
+   ->  Sort  (cost=xxx rows=60 width=12)
+         Sort Key: bmt2.c1
+         ->  Hash Join  (cost=xxx rows=60 width=12)
+               Hash Cond: (bmt3.c1 = bmt2.c1)
+               ->  Hash Join  (cost=xxx rows=660 width=8)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
+                     ->  Hash  (cost=xxx rows=1100 width=4)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
+               ->  Hash  (cost=xxx rows=100 width=4)
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
+(14 rows)
+
diff --git a/expected/R_2-5-3.out b/expected/R_2-5-3.out
new file mode 100644 (file)
index 0000000..8e34184
--- /dev/null
@@ -0,0 +1,35 @@
+                                           QUERY PLAN                                           
+------------------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=100 width=4)
+   Join Filter: (bmt1.c1 = bmt4.c1)
+   ->  Merge Join  (cost=xxx rows=100 width=12)
+         Merge Cond: (bmt1.c1 = bmt2.c1)
+         ->  Merge Join  (cost=xxx rows=1000 width=8)
+               Merge Cond: (bmt1.c1 = bmt3.c1)
+               ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
+               ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
+         ->  Sort  (cost=xxx rows=100 width=4)
+               Sort Key: bmt2.c1
+               ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
+   ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
+         Index Cond: (c1 = bmt3.c1)
+(13 rows)
+
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=50 width=4)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
+   ->  Sort  (cost=xxx rows=100 width=12)
+         Sort Key: bmt2.c1
+         ->  Hash Join  (cost=xxx rows=100 width=12)
+               Hash Cond: (bmt3.c1 = bmt2.c1)
+               ->  Hash Join  (cost=xxx rows=1100 width=8)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
+                     ->  Hash  (cost=xxx rows=1100 width=4)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
+               ->  Hash  (cost=xxx rows=100 width=4)
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
+(14 rows)
+
index 1c8c2ca..cc6bab9 100644 (file)
@@ -2048,3 +2048,130 @@ error hint:
 \o
 \! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-7.out.log > results/R_2-3-7.out
 \! diff expected/R_2-3-7.out results/R_2-3-7.out
+----
+---- No. R-2-4 VALUES clause
+----
+-- No. R-2-4-1
+\o results/R_2-4-1.out.log
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(t3 t1 t2) Rows(t3 t1 #2)Rows(t3 t1 t2 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+Leading(t3 t1 t2)
+Rows(t1 t3 #2)
+Rows(t1 t2 t3 #2)
+duplication hint:
+error hint:
+
+/*+ Leading(*VALUES* t1 t2) Rows(*VALUES* t1 #2)Rows(*VALUES* t1 t2 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+LOG:  pg_hint_plan:
+used hint:
+Leading(*VALUES* t1 t2)
+Rows(*VALUES* t1 #2)
+Rows(*VALUES* t1 t2 #2)
+not used hint:
+duplication hint:
+error hint:
+
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-1.out.log > results/R_2-4-1.out
+\! diff expected/R_2-4-1.out results/R_2-4-1.out
+-- No. R-2-4-2
+\o results/R_2-4-2.out.log
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(t4 t3 t2 t1) Rows(t4 t3 #2) Rows(t4 t3 t2 #2)Rows(t4 t3 t2 t1 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+Leading(t4 t3 t2 t1)
+Rows(t3 t4 #2)
+Rows(t2 t3 t4 #2)
+Rows(t1 t2 t3 t4 #2)
+duplication hint:
+error hint:
+
+/*+ Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO:  hint syntax error at or near "Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)"
+DETAIL:  Relation name "*VALUES*" is ambiguous.
+INFO:  hint syntax error at or near "Rows(*VALUES* t3 t2 t1 #2)"
+DETAIL:  Relation name "*VALUES*" is ambiguous.
+INFO:  hint syntax error at or near "Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)"
+DETAIL:  Relation name "*VALUES*" is ambiguous.
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+Rows(t3 t4 #2)
+duplication hint:
+error hint:
+Leading(*VALUES* t3 t2 t1)
+Rows(*VALUES* t2 t3 #2)
+Rows(*VALUES* t1 t2 t3 #2)
+
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-2.out.log > results/R_2-4-2.out
+\! diff expected/R_2-4-2.out results/R_2-4-2.out
+----
+---- No. R-2-5
+----
+-- No. R-2-5-1
+\o results/R_2-5-1.out.log
+EXPLAIN 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
+*/
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG:  pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
+not used hint:
+duplication hint:
+error hint:
+
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-1.out.log > results/R_2-5-1.out
+\! diff expected/R_2-5-1.out results/R_2-5-1.out
+-- No. R-2-5-2
+\o results/R_2-5-2.out.log
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt4 bmt3 *0.6)
+*/
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG:  pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt3 bmt4 *0.6)
+not used hint:
+duplication hint:
+error hint:
+
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-2.out.log > results/R_2-5-2.out
+\! diff expected/R_2-5-2.out results/R_2-5-2.out
+-- No. R-2-5-3
+\o results/R_2-5-3.out.log
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt4 bmt1 *0.5)
+*/
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+LOG:  pg_hint_plan:
+used hint:
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt1 bmt4 *0.5)
+not used hint:
+duplication hint:
+error hint:
+
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-3.out.log > results/R_2-5-3.out
+\! diff expected/R_2-5-3.out results/R_2-5-3.out
index 40dd65e..6c58d5d 100644 (file)
@@ -1013,3 +1013,70 @@ EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
 \o
 \! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-7.out.log > results/R_2-3-7.out
 \! diff expected/R_2-3-7.out results/R_2-3-7.out
+
+----
+---- No. R-2-4 VALUES clause
+----
+
+-- No. R-2-4-1
+\o results/R_2-4-1.out.log
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(t3 t1 t2) Rows(t3 t1 #2)Rows(t3 t1 t2 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+/*+ Leading(*VALUES* t1 t2) Rows(*VALUES* t1 #2)Rows(*VALUES* t1 t2 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-1.out.log > results/R_2-4-1.out
+\! diff expected/R_2-4-1.out results/R_2-4-1.out
+
+-- No. R-2-4-2
+\o results/R_2-4-2.out.log
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(t4 t3 t2 t1) Rows(t4 t3 #2) Rows(t4 t3 t2 #2)Rows(t4 t3 t2 t1 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+/*+ Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)*/
+EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-2.out.log > results/R_2-4-2.out
+\! diff expected/R_2-4-2.out results/R_2-4-2.out
+
+----
+---- No. R-2-5
+----
+
+-- No. R-2-5-1
+\o results/R_2-5-1.out.log
+EXPLAIN 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
+*/
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-1.out.log > results/R_2-5-1.out
+\! diff expected/R_2-5-1.out results/R_2-5-1.out
+
+-- No. R-2-5-2
+\o results/R_2-5-2.out.log
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt4 bmt3 *0.6)
+*/
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-2.out.log > results/R_2-5-2.out
+\! diff expected/R_2-5-2.out results/R_2-5-2.out
+
+-- No. R-2-5-3
+\o results/R_2-5-3.out.log
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+/*+
+Leading(bmt4 bmt3 bmt2 bmt1)
+Rows(bmt4 bmt1 *0.5)
+*/
+EXPLAIN SELECT 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.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-3.out.log > results/R_2-5-3.out
+\! diff expected/R_2-5-3.out results/R_2-5-3.out
+