OSDN Git Service

Support PostgreSQL 10 beta 1 step 1/2
[pghintplan/pg_hint_plan.git] / expected / ut-R.out
1 LOAD 'pg_hint_plan';
2 SET pg_hint_plan.enable_hint TO on;
3 SET pg_hint_plan.debug_print TO on;
4 SET client_min_messages TO LOG;
5 SET search_path TO public;
6 \o results/ut-R.tmpout
7 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
8 \o
9 \! sql/maskout.sh results/ut-R.tmpout
10                                 QUERY PLAN                                 
11 ---------------------------------------------------------------------------
12  Merge Join  (cost=xxx rows=100 width=xxx)
13    Merge Cond: (t1.c1 = t2.c1)
14    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
15    ->  Sort  (cost=xxx rows=100 width=xxx)
16          Sort Key: t2.c1
17          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
18 (6 rows)
19
20 ----
21 ---- No. R-1-1 specified pattern of the object name
22 ----
23 -- No. R-1-1-1
24 \o results/ut-R.tmpout
25 /*+Rows(t1 t2 #1)*/
26 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
27 LOG:  pg_hint_plan:
28 used hint:
29 Rows(t1 t2 #1)
30 not used hint:
31 duplication hint:
32 error hint:
33
34 \o
35 \! sql/maskout.sh results/ut-R.tmpout
36                                 QUERY PLAN                                 
37 ---------------------------------------------------------------------------
38  Merge Join  (cost=xxx rows=1 width=xxx)
39    Merge Cond: (t1.c1 = t2.c1)
40    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
41    ->  Sort  (cost=xxx rows=100 width=xxx)
42          Sort Key: t2.c1
43          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
44 (6 rows)
45
46 -- No. R-1-1-2
47 \o results/ut-R.tmpout
48 /*+Rows(t1 t2 #1)*/
49 EXPLAIN SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
50 LOG:  pg_hint_plan:
51 used hint:
52 not used hint:
53 Rows(t1 t2 #1)
54 duplication hint:
55 error hint:
56
57 \o
58 \! sql/maskout.sh results/ut-R.tmpout
59                                   QUERY PLAN                                   
60 -------------------------------------------------------------------------------
61  Merge Join  (cost=xxx rows=100 width=xxx)
62    Merge Cond: (t_1.c1 = t_2.c1)
63    ->  Index Scan using t1_i1 on t1 t_1  (cost=xxx rows=1000 width=xxx)
64    ->  Sort  (cost=xxx rows=100 width=xxx)
65          Sort Key: t_2.c1
66          ->  Seq Scan on t2 t_2  (cost=xxx rows=100 width=xxx)
67 (6 rows)
68
69 -- No. R-1-1-3
70 \o results/ut-R.tmpout
71 /*+Rows(t_1 t_2 #1)*/
72 EXPLAIN SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
73 LOG:  pg_hint_plan:
74 used hint:
75 Rows(t_1 t_2 #1)
76 not used hint:
77 duplication hint:
78 error hint:
79
80 \o
81 \! sql/maskout.sh results/ut-R.tmpout
82                                   QUERY PLAN                                   
83 -------------------------------------------------------------------------------
84  Merge Join  (cost=xxx rows=1 width=xxx)
85    Merge Cond: (t_1.c1 = t_2.c1)
86    ->  Index Scan using t1_i1 on t1 t_1  (cost=xxx rows=1000 width=xxx)
87    ->  Sort  (cost=xxx rows=100 width=xxx)
88          Sort Key: t_2.c1
89          ->  Seq Scan on t2 t_2  (cost=xxx rows=100 width=xxx)
90 (6 rows)
91
92 ----
93 ---- No. R-1-2 specified schema name in the hint option
94 ----
95 -- No. R-1-2-1
96 \o results/ut-R.tmpout
97 /*+Rows(t1 t2 #1)*/
98 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
99 LOG:  pg_hint_plan:
100 used hint:
101 Rows(t1 t2 #1)
102 not used hint:
103 duplication hint:
104 error hint:
105
106 \o
107 \! sql/maskout.sh results/ut-R.tmpout
108                                 QUERY PLAN                                 
109 ---------------------------------------------------------------------------
110  Merge Join  (cost=xxx rows=1 width=xxx)
111    Merge Cond: (t1.c1 = t2.c1)
112    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
113    ->  Sort  (cost=xxx rows=100 width=xxx)
114          Sort Key: t2.c1
115          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
116 (6 rows)
117
118 -- No. R-1-2-2
119 \o results/ut-R.tmpout
120 /*+Rows(s1.t1 s1.t2 #1)*/
121 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
122 LOG:  pg_hint_plan:
123 used hint:
124 not used hint:
125 Rows(s1.t1 s1.t2 #1)
126 duplication hint:
127 error hint:
128
129 \o
130 \! sql/maskout.sh results/ut-R.tmpout
131                                 QUERY PLAN                                 
132 ---------------------------------------------------------------------------
133  Merge Join  (cost=xxx rows=100 width=xxx)
134    Merge Cond: (t1.c1 = t2.c1)
135    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
136    ->  Sort  (cost=xxx rows=100 width=xxx)
137          Sort Key: t2.c1
138          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
139 (6 rows)
140
141 ----
142 ---- No. R-1-3 table doesn't exist in the hint option
143 ----
144 -- No. R-1-3-1
145 \o results/ut-R.tmpout
146 /*+Rows(t1 t2 #1)*/
147 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
148 LOG:  pg_hint_plan:
149 used hint:
150 Rows(t1 t2 #1)
151 not used hint:
152 duplication hint:
153 error hint:
154
155 \o
156 \! sql/maskout.sh results/ut-R.tmpout
157                                 QUERY PLAN                                 
158 ---------------------------------------------------------------------------
159  Merge Join  (cost=xxx rows=1 width=xxx)
160    Merge Cond: (t1.c1 = t2.c1)
161    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
162    ->  Sort  (cost=xxx rows=100 width=xxx)
163          Sort Key: t2.c1
164          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
165 (6 rows)
166
167 -- No. R-1-3-2
168 \o results/ut-R.tmpout
169 /*+Rows(t3 t4 #1)*/
170 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
171 LOG:  pg_hint_plan:
172 used hint:
173 not used hint:
174 Rows(t3 t4 #1)
175 duplication hint:
176 error hint:
177
178 \o
179 \! sql/maskout.sh results/ut-R.tmpout
180                                 QUERY PLAN                                 
181 ---------------------------------------------------------------------------
182  Merge Join  (cost=xxx rows=100 width=xxx)
183    Merge Cond: (t1.c1 = t2.c1)
184    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
185    ->  Sort  (cost=xxx rows=100 width=xxx)
186          Sort Key: t2.c1
187          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
188 (6 rows)
189
190 ----
191 ---- No. R-1-4 conflict table name
192 ----
193 -- No. R-1-4-1
194 \o results/ut-R.tmpout
195 /*+Rows(t1 t2 #1)*/
196 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
197 LOG:  pg_hint_plan:
198 used hint:
199 Rows(t1 t2 #1)
200 not used hint:
201 duplication hint:
202 error hint:
203
204 \o
205 \! sql/maskout.sh results/ut-R.tmpout
206                                 QUERY PLAN                                 
207 ---------------------------------------------------------------------------
208  Merge Join  (cost=xxx rows=1 width=xxx)
209    Merge Cond: (t1.c1 = t2.c1)
210    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
211    ->  Sort  (cost=xxx rows=100 width=xxx)
212          Sort Key: t2.c1
213          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
214 (6 rows)
215
216 -- No. R-1-4-2
217 \o results/ut-R.tmpout
218 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
219 \o
220 \! sql/maskout.sh results/ut-R.tmpout
221                                 QUERY PLAN                                 
222 ---------------------------------------------------------------------------
223  Merge Join  (cost=xxx rows=100 width=xxx)
224    Merge Cond: (t1.c1 = t1_1.c1)
225    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
226    ->  Sort  (cost=xxx rows=100 width=xxx)
227          Sort Key: t1_1.c1
228          ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=xxx)
229 (6 rows)
230
231 \o results/ut-R.tmpout
232 /*+Rows(t1 t1 #1)*/
233 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
234 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t1 #1)"
235 DETAIL:  Relation name "t1" is ambiguous.
236 LOG:  pg_hint_plan:
237 used hint:
238 not used hint:
239 duplication hint:
240 error hint:
241 Rows(t1 t1 #1)
242
243 \o
244 \! sql/maskout.sh results/ut-R.tmpout
245                                 QUERY PLAN                                 
246 ---------------------------------------------------------------------------
247  Merge Join  (cost=xxx rows=100 width=xxx)
248    Merge Cond: (t1.c1 = t1_1.c1)
249    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
250    ->  Sort  (cost=xxx rows=100 width=xxx)
251          Sort Key: t1_1.c1
252          ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=xxx)
253 (6 rows)
254
255 \o results/ut-R.tmpout
256 /*+Rows(s1.t1 s2.t1 #1)*/
257 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
258 LOG:  pg_hint_plan:
259 used hint:
260 not used hint:
261 Rows(s1.t1 s2.t1 #1)
262 duplication hint:
263 error hint:
264
265 \o
266 \! sql/maskout.sh results/ut-R.tmpout
267                                 QUERY PLAN                                 
268 ---------------------------------------------------------------------------
269  Merge Join  (cost=xxx rows=100 width=xxx)
270    Merge Cond: (t1.c1 = t1_1.c1)
271    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
272    ->  Sort  (cost=xxx rows=100 width=xxx)
273          Sort Key: t1_1.c1
274          ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=xxx)
275 (6 rows)
276
277 \o results/ut-R.tmpout
278 EXPLAIN SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
279 \o
280 \! sql/maskout.sh results/ut-R.tmpout
281                                 QUERY PLAN                                 
282 ---------------------------------------------------------------------------
283  Merge Join  (cost=xxx rows=100 width=xxx)
284    Merge Cond: (t1.c1 = s2t1.c1)
285    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
286    ->  Sort  (cost=xxx rows=100 width=xxx)
287          Sort Key: s2t1.c1
288          ->  Seq Scan on t1 s2t1  (cost=xxx rows=100 width=xxx)
289 (6 rows)
290
291 \o results/ut-R.tmpout
292 /*+Rows(t1 s2t1 #1)*/
293 EXPLAIN SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
294 LOG:  pg_hint_plan:
295 used hint:
296 Rows(s2t1 t1 #1)
297 not used hint:
298 duplication hint:
299 error hint:
300
301 \o
302 \! sql/maskout.sh results/ut-R.tmpout
303                                 QUERY PLAN                                 
304 ---------------------------------------------------------------------------
305  Merge Join  (cost=xxx rows=1 width=xxx)
306    Merge Cond: (t1.c1 = s2t1.c1)
307    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
308    ->  Sort  (cost=xxx rows=100 width=xxx)
309          Sort Key: s2t1.c1
310          ->  Seq Scan on t1 s2t1  (cost=xxx rows=100 width=xxx)
311 (6 rows)
312
313 -- No. R-1-4-3
314 \o results/ut-R.tmpout
315 EXPLAIN SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
316 \o
317 \! sql/maskout.sh results/ut-R.tmpout
318                                             QUERY PLAN                                            
319 --------------------------------------------------------------------------------------------------
320  Merge Join  (cost=xxx rows=100 width=xxx)
321    Merge Cond: (t1.c1 = t2.c1)
322    InitPlan 1 (returns $0)
323      ->  Aggregate  (cost=xxx rows=1 width=xxx)
324            ->  Merge Join  (cost=xxx rows=100 width=xxx)
325                  Merge Cond: (t1_1.c1 = t2_1.c1)
326                  ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
327                  ->  Sort  (cost=xxx rows=100 width=xxx)
328                        Sort Key: t2_1.c1
329                        ->  Seq Scan on t2 t2_1  (cost=xxx rows=100 width=xxx)
330    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
331    ->  Sort  (cost=xxx rows=100 width=xxx)
332          Sort Key: t2.c1
333          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
334 (14 rows)
335
336 \o results/ut-R.tmpout
337 /*+Rows(t1 t2 #1)*/
338 EXPLAIN SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
339 LOG:  pg_hint_plan:
340 used hint:
341 Rows(t1 t2 #1)
342 not used hint:
343 duplication hint:
344 error hint:
345
346 \o
347 \! sql/maskout.sh results/ut-R.tmpout
348                                             QUERY PLAN                                            
349 --------------------------------------------------------------------------------------------------
350  Merge Join  (cost=xxx rows=100 width=xxx)
351    Merge Cond: (t1.c1 = t2.c1)
352    InitPlan 1 (returns $0)
353      ->  Aggregate  (cost=xxx rows=1 width=xxx)
354            ->  Merge Join  (cost=xxx rows=1 width=xxx)
355                  Merge Cond: (t1_1.c1 = t2_1.c1)
356                  ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
357                  ->  Sort  (cost=xxx rows=100 width=xxx)
358                        Sort Key: t2_1.c1
359                        ->  Seq Scan on t2 t2_1  (cost=xxx rows=100 width=xxx)
360    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
361    ->  Sort  (cost=xxx rows=100 width=xxx)
362          Sort Key: t2.c1
363          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
364 (14 rows)
365
366 \o results/ut-R.tmpout
367 /*+Rows(st1 st2 #1)Rows(t1 t2 #1)*/
368 EXPLAIN SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
369 LOG:  pg_hint_plan:
370 used hint:
371 Rows(st1 st2 #1)
372 Rows(t1 t2 #1)
373 not used hint:
374 duplication hint:
375 error hint:
376
377 \o
378 \! sql/maskout.sh results/ut-R.tmpout
379                                            QUERY PLAN                                            
380 -------------------------------------------------------------------------------------------------
381  Merge Join  (cost=xxx rows=1 width=xxx)
382    Merge Cond: (t1.c1 = t2.c1)
383    InitPlan 1 (returns $0)
384      ->  Aggregate  (cost=xxx rows=1 width=xxx)
385            ->  Merge Join  (cost=xxx rows=1 width=xxx)
386                  Merge Cond: (st1.c1 = st2.c1)
387                  ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=xxx)
388                  ->  Sort  (cost=xxx rows=100 width=xxx)
389                        Sort Key: st2.c1
390                        ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
391    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
392    ->  Sort  (cost=xxx rows=100 width=xxx)
393          Sort Key: t2.c1
394          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
395 (14 rows)
396
397 ----
398 ---- No. R-1-5 conflict table name
399 ----
400 -- No. R-1-5-1
401 \o results/ut-R.tmpout
402 /*+Rows(t1 t2 #1)*/
403 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
404 LOG:  pg_hint_plan:
405 used hint:
406 Rows(t1 t2 #1)
407 not used hint:
408 duplication hint:
409 error hint:
410
411 \o
412 \! sql/maskout.sh results/ut-R.tmpout
413                                 QUERY PLAN                                 
414 ---------------------------------------------------------------------------
415  Merge Join  (cost=xxx rows=1 width=xxx)
416    Merge Cond: (t1.c1 = t2.c1)
417    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
418    ->  Sort  (cost=xxx rows=100 width=xxx)
419          Sort Key: t2.c1
420          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
421 (6 rows)
422
423 -- No. R-1-5-2
424 \o results/ut-R.tmpout
425 /*+Rows(t1 t1 #1)*/
426 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
427 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t1 #1)"
428 DETAIL:  Relation name "t1" is duplicated.
429 LOG:  pg_hint_plan:
430 used hint:
431 not used hint:
432 duplication hint:
433 error hint:
434 Rows(t1 t1 #1)
435
436 \o
437 \! sql/maskout.sh results/ut-R.tmpout
438                                 QUERY PLAN                                 
439 ---------------------------------------------------------------------------
440  Merge Join  (cost=xxx rows=100 width=xxx)
441    Merge Cond: (t1.c1 = t2.c1)
442    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
443    ->  Sort  (cost=xxx rows=100 width=xxx)
444          Sort Key: t2.c1
445          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
446 (6 rows)
447
448 -- No. R-1-5-3
449 \o results/ut-R.tmpout
450 /*+(t1 t1)(t2 t2)*/
451 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
452 INFO:  pg_hint_plan: hint syntax error at or near "(t1 t1)(t2 t2)"
453 DETAIL:  Unrecognized hint keyword "".
454 \o
455 \! sql/maskout.sh results/ut-R.tmpout
456                                 QUERY PLAN                                 
457 ---------------------------------------------------------------------------
458  Merge Join  (cost=xxx rows=100 width=xxx)
459    Merge Cond: (t1.c1 = t2.c1)
460    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
461    ->  Sort  (cost=xxx rows=100 width=xxx)
462          Sort Key: t2.c1
463          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
464 (6 rows)
465
466 \o results/ut-R.tmpout
467 EXPLAIN SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
468 \o
469 \! sql/maskout.sh results/ut-R.tmpout
470                                    QUERY PLAN                                    
471 ---------------------------------------------------------------------------------
472  Merge Join  (cost=xxx rows=100 width=xxx)
473    Merge Cond: (t1.c1 = t2.c1)
474    ->  Merge Join  (cost=xxx rows=1000 width=xxx)
475          Merge Cond: (t1.c1 = t3.c1)
476          ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
477          ->  Index Scan using t3_i1 on t3  (cost=xxx rows=1130 width=xxx)
478    ->  Sort  (cost=xxx rows=100 width=xxx)
479          Sort Key: t2.c1
480          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
481 (9 rows)
482
483 \o results/ut-R.tmpout
484 /*+(t1 t2 t1 t2)*/
485 EXPLAIN SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
486 INFO:  pg_hint_plan: hint syntax error at or near "(t1 t2 t1 t2)"
487 DETAIL:  Unrecognized hint keyword "".
488 \o
489 \! sql/maskout.sh results/ut-R.tmpout
490                                       QUERY PLAN                                       
491 ---------------------------------------------------------------------------------------
492  Nested Loop  (cost=xxx rows=100 width=xxx)
493    ->  Merge Join  (cost=xxx rows=100 width=xxx)
494          Merge Cond: (t1.c1 = t2.c1)
495          ->  Merge Join  (cost=xxx rows=1000 width=xxx)
496                Merge Cond: (t1.c1 = t3.c1)
497                ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
498                ->  Index Scan using t3_i1 on t3  (cost=xxx rows=1130 width=xxx)
499          ->  Sort  (cost=xxx rows=100 width=xxx)
500                Sort Key: t2.c1
501                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
502    ->  Index Scan using t4_i1 on t4  (cost=xxx rows=1 width=xxx)
503          Index Cond: (c1 = t1.c1)
504 (12 rows)
505
506 ----
507 ---- No. R-1-6 object type for the hint
508 ----
509 -- No. R-1-6-1
510 \o results/ut-R.tmpout
511 /*+Rows(t1 t2 #1)*/
512 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
513 LOG:  pg_hint_plan:
514 used hint:
515 Rows(t1 t2 #1)
516 not used hint:
517 duplication hint:
518 error hint:
519
520 \o
521 \! sql/maskout.sh results/ut-R.tmpout
522                                 QUERY PLAN                                 
523 ---------------------------------------------------------------------------
524  Merge Join  (cost=xxx rows=1 width=xxx)
525    Merge Cond: (t1.c1 = t2.c1)
526    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
527    ->  Sort  (cost=xxx rows=100 width=xxx)
528          Sort Key: t2.c1
529          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
530 (6 rows)
531
532 -- No. R-1-6-2
533 \o results/ut-R.tmpout
534 EXPLAIN SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
535 \o
536 \! sql/maskout.sh results/ut-R.tmpout
537                                   QUERY PLAN                                  
538 ------------------------------------------------------------------------------
539  Hash Join  (cost=xxx rows=301 width=xxx)
540    Hash Cond: (t1.c1 = t2.c1)
541    ->  Append  (cost=xxx rows=301 width=xxx)
542          ->  Seq Scan on p1 t1  (cost=xxx rows=1 width=xxx)
543          ->  Seq Scan on p1c1 t1_1  (cost=xxx rows=100 width=xxx)
544          ->  Seq Scan on p1c2 t1_2  (cost=xxx rows=100 width=xxx)
545          ->  Seq Scan on p1c3 t1_3  (cost=xxx rows=100 width=xxx)
546    ->  Hash  (cost=xxx rows=301 width=xxx)
547          ->  Append  (cost=xxx rows=301 width=xxx)
548                ->  Seq Scan on p1 t2  (cost=xxx rows=1 width=xxx)
549                ->  Seq Scan on p1c1 t2_1  (cost=xxx rows=100 width=xxx)
550                ->  Seq Scan on p1c2 t2_2  (cost=xxx rows=100 width=xxx)
551                ->  Seq Scan on p1c3 t2_3  (cost=xxx rows=100 width=xxx)
552 (13 rows)
553
554 \o results/ut-R.tmpout
555 /*+Rows(t1 t2 #1)*/
556 EXPLAIN SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
557 LOG:  pg_hint_plan:
558 used hint:
559 Rows(t1 t2 #1)
560 not used hint:
561 duplication hint:
562 error hint:
563
564 \o
565 \! sql/maskout.sh results/ut-R.tmpout
566                                   QUERY PLAN                                  
567 ------------------------------------------------------------------------------
568  Hash Join  (cost=xxx rows=1 width=xxx)
569    Hash Cond: (t1.c1 = t2.c1)
570    ->  Append  (cost=xxx rows=301 width=xxx)
571          ->  Seq Scan on p1 t1  (cost=xxx rows=1 width=xxx)
572          ->  Seq Scan on p1c1 t1_1  (cost=xxx rows=100 width=xxx)
573          ->  Seq Scan on p1c2 t1_2  (cost=xxx rows=100 width=xxx)
574          ->  Seq Scan on p1c3 t1_3  (cost=xxx rows=100 width=xxx)
575    ->  Hash  (cost=xxx rows=301 width=xxx)
576          ->  Append  (cost=xxx rows=301 width=xxx)
577                ->  Seq Scan on p1 t2  (cost=xxx rows=1 width=xxx)
578                ->  Seq Scan on p1c1 t2_1  (cost=xxx rows=100 width=xxx)
579                ->  Seq Scan on p1c2 t2_2  (cost=xxx rows=100 width=xxx)
580                ->  Seq Scan on p1c3 t2_3  (cost=xxx rows=100 width=xxx)
581 (13 rows)
582
583 -- No. R-1-6-3
584 \o results/ut-R.tmpout
585 EXPLAIN SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
586 \o
587 \! sql/maskout.sh results/ut-R.tmpout
588                               QUERY PLAN                               
589 -----------------------------------------------------------------------
590  Hash Join  (cost=xxx rows=1130 width=xxx)
591    Hash Cond: (t1.c1 = t2.c1)
592    ->  Seq Scan on ul1 t1  (cost=xxx rows=1130 width=xxx)
593    ->  Hash  (cost=xxx rows=1130 width=xxx)
594          ->  Seq Scan on ul1 t2  (cost=xxx rows=1130 width=xxx)
595 (5 rows)
596
597 \o results/ut-R.tmpout
598 /*+Rows(t1 t2 #1)*/
599 EXPLAIN SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
600 LOG:  pg_hint_plan:
601 used hint:
602 Rows(t1 t2 #1)
603 not used hint:
604 duplication hint:
605 error hint:
606
607 \o
608 \! sql/maskout.sh results/ut-R.tmpout
609                               QUERY PLAN                               
610 -----------------------------------------------------------------------
611  Hash Join  (cost=xxx rows=1 width=xxx)
612    Hash Cond: (t1.c1 = t2.c1)
613    ->  Seq Scan on ul1 t1  (cost=xxx rows=1130 width=xxx)
614    ->  Hash  (cost=xxx rows=1130 width=xxx)
615          ->  Seq Scan on ul1 t2  (cost=xxx rows=1130 width=xxx)
616 (5 rows)
617
618 -- No. R-1-6-4
619 CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
620 \o results/ut-R.tmpout
621 EXPLAIN SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
622 \o
623 \! sql/maskout.sh results/ut-R.tmpout
624                               QUERY PLAN                               
625 -----------------------------------------------------------------------
626  Hash Join  (cost=xxx rows=1130 width=xxx)
627    Hash Cond: (t1.c1 = t2.c1)
628    ->  Seq Scan on tm1 t1  (cost=xxx rows=1130 width=xxx)
629    ->  Hash  (cost=xxx rows=1130 width=xxx)
630          ->  Seq Scan on tm1 t2  (cost=xxx rows=1130 width=xxx)
631 (5 rows)
632
633 \o results/ut-R.tmpout
634 /*+Rows(t1 t2 #1)*/
635 EXPLAIN SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
636 LOG:  pg_hint_plan:
637 used hint:
638 Rows(t1 t2 #1)
639 not used hint:
640 duplication hint:
641 error hint:
642
643 \o
644 \! sql/maskout.sh results/ut-R.tmpout
645                               QUERY PLAN                               
646 -----------------------------------------------------------------------
647  Hash Join  (cost=xxx rows=1 width=xxx)
648    Hash Cond: (t1.c1 = t2.c1)
649    ->  Seq Scan on tm1 t1  (cost=xxx rows=1130 width=xxx)
650    ->  Hash  (cost=xxx rows=1130 width=xxx)
651          ->  Seq Scan on tm1 t2  (cost=xxx rows=1130 width=xxx)
652 (5 rows)
653
654 -- No. R-1-6-5
655 CREATE TEMP TABLE t_pg_class WITH OIDS AS SELECT * from pg_class LIMIT 100;
656 \o results/ut-R.tmpout
657 EXPLAIN SELECT * FROM t_pg_class t1, t_pg_class t2 WHERE t1.oid = t2.oid;
658 \o
659 \! sql/maskout.sh results/ut-R.tmpout
660                                   QUERY PLAN                                  
661 ------------------------------------------------------------------------------
662  Hash Join  (cost=xxx rows=310 width=xxx)
663    Hash Cond: (t1.oid = t2.oid)
664    ->  Seq Scan on t_pg_class t1  (cost=xxx rows=310 width=xxx)
665    ->  Hash  (cost=xxx rows=310 width=xxx)
666          ->  Seq Scan on t_pg_class t2  (cost=xxx rows=310 width=xxx)
667 (5 rows)
668
669 \o results/ut-R.tmpout
670 /*+Rows(t1 t2 #1)*/
671 EXPLAIN SELECT * FROM t_pg_class t1, t_pg_class t2 WHERE t1.oid = t2.oid;
672 LOG:  pg_hint_plan:
673 used hint:
674 Rows(t1 t2 #1)
675 not used hint:
676 duplication hint:
677 error hint:
678
679 \o
680 \! sql/maskout.sh results/ut-R.tmpout
681                                   QUERY PLAN                                  
682 ------------------------------------------------------------------------------
683  Hash Join  (cost=xxx rows=1 width=xxx)
684    Hash Cond: (t1.oid = t2.oid)
685    ->  Seq Scan on t_pg_class t1  (cost=xxx rows=310 width=xxx)
686    ->  Hash  (cost=xxx rows=310 width=xxx)
687          ->  Seq Scan on t_pg_class t2  (cost=xxx rows=310 width=xxx)
688 (5 rows)
689
690 -- No. R-1-6-6
691 -- refer ut-fdw.sql
692 -- No. R-1-6-7
693 \o results/ut-R.tmpout
694 EXPLAIN SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
695 \o
696 \! sql/maskout.sh results/ut-R.tmpout
697                            QUERY PLAN                            
698 -----------------------------------------------------------------
699  Nested Loop  (cost=xxx rows=1 width=xxx)
700    Join Filter: (t1.c1 = t2.c1)
701    ->  Function Scan on f1 t1  (cost=xxx rows=1 width=xxx)
702    ->  Function Scan on f1 t2  (cost=xxx rows=1 width=xxx)
703 (4 rows)
704
705 \o results/ut-R.tmpout
706 /*+Rows(t1 t2 #1)*/
707 EXPLAIN SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
708 LOG:  pg_hint_plan:
709 used hint:
710 Rows(t1 t2 #1)
711 not used hint:
712 duplication hint:
713 error hint:
714
715 \o
716 \! sql/maskout.sh results/ut-R.tmpout
717                            QUERY PLAN                            
718 -----------------------------------------------------------------
719  Nested Loop  (cost=xxx rows=1 width=xxx)
720    Join Filter: (t1.c1 = t2.c1)
721    ->  Function Scan on f1 t1  (cost=xxx rows=1 width=xxx)
722    ->  Function Scan on f1 t2  (cost=xxx rows=1 width=xxx)
723 (4 rows)
724
725 -- No. R-1-6-8
726 \o results/ut-R.tmpout
727 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
728 \o
729 \! sql/maskout.sh results/ut-R.tmpout
730                                 QUERY PLAN                                
731 --------------------------------------------------------------------------
732  Hash Join  (cost=xxx rows=3 width=xxx)
733    Hash Cond: (t2.c1 = "*VALUES*".column1)
734    ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
735    ->  Hash  (cost=xxx rows=3 width=xxx)
736          ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=xxx)
737 (5 rows)
738
739 \o results/ut-R.tmpout
740 /*+Rows(t1 t2 #1)*/
741 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
742 LOG:  pg_hint_plan:
743 used hint:
744 not used hint:
745 Rows(t1 t2 #1)
746 duplication hint:
747 error hint:
748
749 \o
750 \! sql/maskout.sh results/ut-R.tmpout
751                                 QUERY PLAN                                
752 --------------------------------------------------------------------------
753  Hash Join  (cost=xxx rows=3 width=xxx)
754    Hash Cond: (t2.c1 = "*VALUES*".column1)
755    ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
756    ->  Hash  (cost=xxx rows=3 width=xxx)
757          ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=xxx)
758 (5 rows)
759
760 \o results/ut-R.tmpout
761 /*+Rows(*VALUES* t2 #1)*/
762 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
763 LOG:  pg_hint_plan:
764 used hint:
765 Rows(*VALUES* t2 #1)
766 not used hint:
767 duplication hint:
768 error hint:
769
770 \o
771 \! sql/maskout.sh results/ut-R.tmpout
772                                 QUERY PLAN                                
773 --------------------------------------------------------------------------
774  Hash Join  (cost=xxx rows=1 width=xxx)
775    Hash Cond: (t2.c1 = "*VALUES*".column1)
776    ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
777    ->  Hash  (cost=xxx rows=3 width=xxx)
778          ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=xxx)
779 (5 rows)
780
781 -- No. R-1-6-9
782 \o results/ut-R.tmpout
783 EXPLAIN WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
784 \o
785 \! sql/maskout.sh results/ut-R.tmpout
786                                             QUERY PLAN                                            
787 --------------------------------------------------------------------------------------------------
788  Nested Loop  (cost=xxx rows=1 width=xxx)
789    CTE c1
790      ->  Aggregate  (cost=xxx rows=1 width=xxx)
791            ->  Merge Join  (cost=xxx rows=100 width=xxx)
792                  Merge Cond: (t1_1.c1 = t2.c1)
793                  ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
794                  ->  Sort  (cost=xxx rows=100 width=xxx)
795                        Sort Key: t2.c1
796                        ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
797    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
798    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
799          Index Cond: (c1 = c1.c1)
800 (12 rows)
801
802 \o results/ut-R.tmpout
803 /*+Rows(t1 t2 #1)Rows(t1 c1 +1)*/
804 EXPLAIN WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
805 LOG:  pg_hint_plan:
806 used hint:
807 Rows(c1 t1 +1)
808 Rows(t1 t2 #1)
809 not used hint:
810 duplication hint:
811 error hint:
812
813 \o
814 \! sql/maskout.sh results/ut-R.tmpout
815                                             QUERY PLAN                                            
816 --------------------------------------------------------------------------------------------------
817  Nested Loop  (cost=xxx rows=2 width=xxx)
818    CTE c1
819      ->  Aggregate  (cost=xxx rows=1 width=xxx)
820            ->  Merge Join  (cost=xxx rows=1 width=xxx)
821                  Merge Cond: (t1_1.c1 = t2.c1)
822                  ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
823                  ->  Sort  (cost=xxx rows=100 width=xxx)
824                        Sort Key: t2.c1
825                        ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
826    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
827    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
828          Index Cond: (c1 = c1.c1)
829 (12 rows)
830
831 -- No. R-1-6-10
832 \o results/ut-R.tmpout
833 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
834 \o
835 \! sql/maskout.sh results/ut-R.tmpout
836                                 QUERY PLAN                                
837 --------------------------------------------------------------------------
838  Hash Join  (cost=xxx rows=1000 width=xxx)
839    Hash Cond: (v1t1.c1 = v1t1_1.c1)
840    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
841    ->  Hash  (cost=xxx rows=1000 width=xxx)
842          ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
843 (5 rows)
844
845 \o results/ut-R.tmpout
846 /*+Rows(t1 t2 #1)*/
847 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
848 LOG:  pg_hint_plan:
849 used hint:
850 not used hint:
851 Rows(t1 t2 #1)
852 duplication hint:
853 error hint:
854
855 \o
856 \! sql/maskout.sh results/ut-R.tmpout
857                                 QUERY PLAN                                
858 --------------------------------------------------------------------------
859  Hash Join  (cost=xxx rows=1000 width=xxx)
860    Hash Cond: (v1t1.c1 = v1t1_1.c1)
861    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
862    ->  Hash  (cost=xxx rows=1000 width=xxx)
863          ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
864 (5 rows)
865
866 \o results/ut-R.tmpout
867 /*+Rows(v1t1 v1t1_ #1)*/
868 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
869 LOG:  pg_hint_plan:
870 used hint:
871 Rows(v1t1 v1t1_ #1)
872 not used hint:
873 duplication hint:
874 error hint:
875
876 \o
877 \! sql/maskout.sh results/ut-R.tmpout
878                                QUERY PLAN                                
879 -------------------------------------------------------------------------
880  Hash Join  (cost=xxx rows=1 width=xxx)
881    Hash Cond: (v1t1.c1 = v1t1_.c1)
882    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
883    ->  Hash  (cost=xxx rows=1000 width=xxx)
884          ->  Seq Scan on t1 v1t1_  (cost=xxx rows=1000 width=xxx)
885 (5 rows)
886
887 -- No. R-1-6-11
888 \o results/ut-R.tmpout
889 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
890 \o
891 \! sql/maskout.sh results/ut-R.tmpout
892                                            QUERY PLAN                                            
893 -------------------------------------------------------------------------------------------------
894  Nested Loop  (cost=xxx rows=1 width=xxx)
895    InitPlan 1 (returns $0)
896      ->  Aggregate  (cost=xxx rows=1 width=xxx)
897            ->  Merge Join  (cost=xxx rows=100 width=xxx)
898                  Merge Cond: (st1.c1 = st2.c1)
899                  ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=xxx)
900                  ->  Sort  (cost=xxx rows=100 width=xxx)
901                        Sort Key: st2.c1
902                        ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
903    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
904          Index Cond: (c1 = $0)
905    ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
906          Filter: (c1 = $0)
907 (13 rows)
908
909 \o results/ut-R.tmpout
910 /*+Rows(t1 t2 #1)Rows(st1 st2 #1)*/
911 EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
912 LOG:  pg_hint_plan:
913 used hint:
914 Rows(st1 st2 #1)
915 Rows(t1 t2 #1)
916 not used hint:
917 duplication hint:
918 error hint:
919
920 \o
921 \! sql/maskout.sh results/ut-R.tmpout
922                                            QUERY PLAN                                            
923 -------------------------------------------------------------------------------------------------
924  Nested Loop  (cost=xxx rows=1 width=xxx)
925    InitPlan 1 (returns $0)
926      ->  Aggregate  (cost=xxx rows=1 width=xxx)
927            ->  Merge Join  (cost=xxx rows=1 width=xxx)
928                  Merge Cond: (st1.c1 = st2.c1)
929                  ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=xxx)
930                  ->  Sort  (cost=xxx rows=100 width=xxx)
931                        Sort Key: st2.c1
932                        ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
933    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
934          Index Cond: (c1 = $0)
935    ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
936          Filter: (c1 = $0)
937 (13 rows)
938
939 --
940 -- There are cases where difference in the measured value and predicted value
941 -- depending upon the version of PostgreSQL
942 --
943 \o results/ut-R.tmpout
944 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
945 \o
946 \! sql/maskout.sh results/ut-R.tmpout
947                                 QUERY PLAN                                 
948 ---------------------------------------------------------------------------
949  Merge Join  (cost=xxx rows=100 width=xxx)
950    Merge Cond: (t1.c1 = t2.c1)
951    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
952    ->  Sort  (cost=xxx rows=100 width=xxx)
953          Sort Key: t2.c1
954          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
955 (6 rows)
956
957 \o results/ut-R.tmpout
958 /*+Rows(t1 st2 #1)*/
959 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
960 LOG:  pg_hint_plan:
961 used hint:
962 not used hint:
963 Rows(st2 t1 #1)
964 duplication hint:
965 error hint:
966
967 \o
968 \! sql/maskout.sh results/ut-R.tmpout
969                                 QUERY PLAN                                 
970 ---------------------------------------------------------------------------
971  Merge Join  (cost=xxx rows=100 width=xxx)
972    Merge Cond: (t1.c1 = t2.c1)
973    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
974    ->  Sort  (cost=xxx rows=100 width=xxx)
975          Sort Key: t2.c1
976          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
977 (6 rows)
978
979 \o results/ut-R.tmpout
980 /*+Rows(t1 t2 #1)*/
981 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
982 LOG:  pg_hint_plan:
983 used hint:
984 Rows(t1 t2 #1)
985 not used hint:
986 duplication hint:
987 error hint:
988
989 \o
990 \! sql/maskout.sh results/ut-R.tmpout
991                                 QUERY PLAN                                 
992 ---------------------------------------------------------------------------
993  Merge Join  (cost=xxx rows=1 width=xxx)
994    Merge Cond: (t1.c1 = t2.c1)
995    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
996    ->  Sort  (cost=xxx rows=100 width=xxx)
997          Sort Key: t2.c1
998          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
999 (6 rows)
1000
1001 ----
1002 ---- No. R-1-7 specified number of conditions
1003 ----
1004 -- No. R-1-7-1
1005 \o results/ut-R.tmpout
1006 /*+Rows(t1 #1)*/
1007 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
1008 INFO:  pg_hint_plan: hint syntax error at or near ""
1009 DETAIL:  Rows hint requires at least two relations.
1010 LOG:  pg_hint_plan:
1011 used hint:
1012 not used hint:
1013 duplication hint:
1014 error hint:
1015 Rows(t1 #1)
1016
1017 \o
1018 \! sql/maskout.sh results/ut-R.tmpout
1019                                 QUERY PLAN                                 
1020 ---------------------------------------------------------------------------
1021  Merge Join  (cost=xxx rows=100 width=xxx)
1022    Merge Cond: (t1.c1 = t2.c1)
1023    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
1024    ->  Sort  (cost=xxx rows=100 width=xxx)
1025          Sort Key: t2.c1
1026          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
1027 (6 rows)
1028
1029 -- No. R-1-7-2
1030 \o results/ut-R.tmpout
1031 /*+Rows(t1 t2 1)*/
1032 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
1033 INFO:  pg_hint_plan: hint syntax error at or near "1"
1034 DETAIL:  Unrecognized rows value type notation.
1035 LOG:  pg_hint_plan:
1036 used hint:
1037 not used hint:
1038 duplication hint:
1039 error hint:
1040 Rows(t1 t2 1)
1041
1042 \o
1043 \! sql/maskout.sh results/ut-R.tmpout
1044                                 QUERY PLAN                                 
1045 ---------------------------------------------------------------------------
1046  Merge Join  (cost=xxx rows=100 width=xxx)
1047    Merge Cond: (t1.c1 = t2.c1)
1048    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
1049    ->  Sort  (cost=xxx rows=100 width=xxx)
1050          Sort Key: t2.c1
1051          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
1052 (6 rows)
1053
1054 -- No. R-1-7-3
1055 \o results/ut-R.tmpout
1056 /*+Rows(t1 t2 #notrows)*/
1057 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
1058 INFO:  pg_hint_plan: hint syntax error at or near "notrows"
1059 DETAIL:  Rows hint requires valid number as rows estimation.
1060 LOG:  pg_hint_plan:
1061 used hint:
1062 not used hint:
1063 duplication hint:
1064 error hint:
1065 Rows(t1 t2 #notrows)
1066
1067 \o
1068 \! sql/maskout.sh results/ut-R.tmpout
1069                                 QUERY PLAN                                 
1070 ---------------------------------------------------------------------------
1071  Merge Join  (cost=xxx rows=100 width=xxx)
1072    Merge Cond: (t1.c1 = t2.c1)
1073    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
1074    ->  Sort  (cost=xxx rows=100 width=xxx)
1075          Sort Key: t2.c1
1076          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
1077 (6 rows)
1078
1079 ----
1080 ---- No. R-2-1 some complexity query blocks
1081 ----
1082 -- No. R-2-1-1
1083 \o results/ut-R.tmpout
1084 /*+
1085 Leading(bmt1 bmt2 bmt3 bmt4)
1086 Leading(b1t2 b1t3 b1t4 b1t1)
1087 Leading(b2t3 b2t4 b2t1 b2t2)
1088 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1089 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1090 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1091 */
1092 EXPLAIN
1093 SELECT max(bmt1.c1), (
1094 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1095 ), (
1096 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1097 )
1098                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1099 ;
1100 LOG:  pg_hint_plan:
1101 used hint:
1102 MergeJoin(b1t2 b1t3)
1103 MergeJoin(b2t3 b2t4)
1104 MergeJoin(bmt1 bmt2)
1105 HashJoin(b1t2 b1t3 b1t4)
1106 HashJoin(b2t1 b2t3 b2t4)
1107 HashJoin(bmt1 bmt2 bmt3)
1108 NestLoop(b1t1 b1t2 b1t3 b1t4)
1109 NestLoop(b2t1 b2t2 b2t3 b2t4)
1110 NestLoop(bmt1 bmt2 bmt3 bmt4)
1111 Leading(bmt1 bmt2 bmt3 bmt4)
1112 Leading(b1t2 b1t3 b1t4 b1t1)
1113 Leading(b2t3 b2t4 b2t1 b2t2)
1114 not used hint:
1115 duplication hint:
1116 error hint:
1117
1118 \o
1119 \! sql/maskout.sh results/ut-R.tmpout
1120                                                      QUERY PLAN                                                     
1121 --------------------------------------------------------------------------------------------------------------------
1122  Aggregate  (cost=xxx rows=1 width=xxx)
1123    InitPlan 1 (returns $1)
1124      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1125            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1126                  Join Filter: (b1t2.c1 = b1t1.c1)
1127                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
1128                        Hash Cond: (b1t4.c1 = b1t2.c1)
1129                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1130                        ->  Hash  (cost=xxx rows=100 width=xxx)
1131                              ->  Merge Join  (cost=xxx rows=100 width=xxx)
1132                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1133                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1134                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1135                                          Sort Key: b1t2.c1
1136                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1137                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1138                        Index Cond: (c1 = b1t3.c1)
1139    InitPlan 2 (returns $3)
1140      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1141            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1142                  ->  Hash Join  (cost=xxx rows=1000 width=xxx)
1143                        Hash Cond: (b2t3.c1 = b2t1.c1)
1144                        ->  Merge Join  (cost=xxx rows=1130 width=xxx)
1145                              Merge Cond: (b2t3.c1 = b2t4.c1)
1146                              ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1147                              ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1148                        ->  Hash  (cost=xxx rows=1000 width=xxx)
1149                              ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1150                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1151                        Index Cond: (c1 = b2t1.c1)
1152    ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1153          ->  Hash Join  (cost=xxx rows=100 width=xxx)
1154                Hash Cond: (bmt3.c1 = bmt1.c1)
1155                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1156                ->  Hash  (cost=xxx rows=100 width=xxx)
1157                      ->  Merge Join  (cost=xxx rows=100 width=xxx)
1158                            Merge Cond: (bmt1.c1 = bmt2.c1)
1159                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
1160                            ->  Sort  (cost=xxx rows=100 width=xxx)
1161                                  Sort Key: bmt2.c1
1162                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1163          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1164                Index Cond: (c1 = bmt1.c1)
1165 (43 rows)
1166
1167 \o results/ut-R.tmpout
1168 /*+
1169 Leading(bmt1 bmt2 bmt3 bmt4)
1170 Leading(b1t2 b1t3 b1t4 b1t1)
1171 Leading(b2t3 b2t4 b2t1 b2t2)
1172 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1173 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1174 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1175 Rows(bmt1 bmt2 #1)Rows(bmt1 bmt2 bmt3 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
1176 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
1177 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
1178 */
1179 EXPLAIN
1180 SELECT max(bmt1.c1), (
1181 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1182 ), (
1183 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1)
1184                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1185 ;
1186 LOG:  pg_hint_plan:
1187 used hint:
1188 MergeJoin(b1t2 b1t3)
1189 MergeJoin(b2t3 b2t4)
1190 MergeJoin(bmt1 bmt2)
1191 HashJoin(b1t2 b1t3 b1t4)
1192 HashJoin(b2t1 b2t3 b2t4)
1193 HashJoin(bmt1 bmt2 bmt3)
1194 NestLoop(b1t1 b1t2 b1t3 b1t4)
1195 NestLoop(b2t1 b2t2 b2t3 b2t4)
1196 NestLoop(bmt1 bmt2 bmt3 bmt4)
1197 Leading(bmt1 bmt2 bmt3 bmt4)
1198 Leading(b1t2 b1t3 b1t4 b1t1)
1199 Leading(b2t3 b2t4 b2t1 b2t2)
1200 Rows(b1t2 b1t3 #1)
1201 Rows(b2t3 b2t4 #1)
1202 Rows(bmt1 bmt2 #1)
1203 Rows(b1t2 b1t3 b1t4 #1)
1204 Rows(b2t1 b2t3 b2t4 #1)
1205 Rows(bmt1 bmt2 bmt3 #1)
1206 Rows(b1t1 b1t2 b1t3 b1t4 #1)
1207 Rows(b2t1 b2t2 b2t3 b2t4 #1)
1208 Rows(bmt1 bmt2 bmt3 bmt4 #1)
1209 not used hint:
1210 duplication hint:
1211 error hint:
1212
1213 \o
1214 \! sql/maskout.sh results/ut-R.tmpout
1215                                                      QUERY PLAN                                                     
1216 --------------------------------------------------------------------------------------------------------------------
1217  Aggregate  (cost=xxx rows=1 width=xxx)
1218    InitPlan 1 (returns $1)
1219      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1220            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1221                  Join Filter: (b1t2.c1 = b1t1.c1)
1222                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1223                        Hash Cond: (b1t4.c1 = b1t2.c1)
1224                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1225                        ->  Hash  (cost=xxx rows=1 width=xxx)
1226                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1227                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1228                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1229                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1230                                          Sort Key: b1t2.c1
1231                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1232                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1233                        Index Cond: (c1 = b1t3.c1)
1234    InitPlan 2 (returns $3)
1235      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1236            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1237                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1238                        Hash Cond: (b2t1.c1 = b2t3.c1)
1239                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1240                        ->  Hash  (cost=xxx rows=1 width=xxx)
1241                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1242                                    Merge Cond: (b2t3.c1 = b2t4.c1)
1243                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1244                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1245                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1246                        Index Cond: (c1 = b2t1.c1)
1247    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1248          ->  Hash Join  (cost=xxx rows=1 width=xxx)
1249                Hash Cond: (bmt3.c1 = bmt1.c1)
1250                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1251                ->  Hash  (cost=xxx rows=1 width=xxx)
1252                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
1253                            Merge Cond: (bmt1.c1 = bmt2.c1)
1254                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
1255                            ->  Sort  (cost=xxx rows=100 width=xxx)
1256                                  Sort Key: bmt2.c1
1257                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1258          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1259                Index Cond: (c1 = bmt1.c1)
1260 (43 rows)
1261
1262 -- No. R-2-1-2
1263 \o results/ut-R.tmpout
1264 /*+
1265 Leading(bmt1 bmt2 bmt3 bmt4)
1266 Leading(b1t2 b1t3 b1t4 b1t1)
1267 Leading(b2t3 b2t4 b2t1 b2t2)
1268 Leading(b3t4 b3t1 b3t2 b3t3)
1269 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1270 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1271 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1272 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
1273 */
1274 EXPLAIN
1275 SELECT max(bmt1.c1), (
1276 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1277 ), (
1278 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1279 ), (
1280 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
1281 )
1282                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1283 ;
1284 LOG:  pg_hint_plan:
1285 used hint:
1286 MergeJoin(b1t2 b1t3)
1287 MergeJoin(b2t3 b2t4)
1288 MergeJoin(b3t1 b3t4)
1289 MergeJoin(bmt1 bmt2)
1290 HashJoin(b1t2 b1t3 b1t4)
1291 HashJoin(b2t1 b2t3 b2t4)
1292 HashJoin(b3t1 b3t2 b3t4)
1293 HashJoin(bmt1 bmt2 bmt3)
1294 NestLoop(b1t1 b1t2 b1t3 b1t4)
1295 NestLoop(b2t1 b2t2 b2t3 b2t4)
1296 NestLoop(b3t1 b3t2 b3t3 b3t4)
1297 NestLoop(bmt1 bmt2 bmt3 bmt4)
1298 Leading(bmt1 bmt2 bmt3 bmt4)
1299 Leading(b1t2 b1t3 b1t4 b1t1)
1300 Leading(b2t3 b2t4 b2t1 b2t2)
1301 Leading(b3t4 b3t1 b3t2 b3t3)
1302 not used hint:
1303 duplication hint:
1304 error hint:
1305
1306 \o
1307 \! sql/maskout.sh results/ut-R.tmpout
1308                                                      QUERY PLAN                                                     
1309 --------------------------------------------------------------------------------------------------------------------
1310  Aggregate  (cost=xxx rows=1 width=xxx)
1311    InitPlan 1 (returns $1)
1312      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1313            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1314                  Join Filter: (b1t2.c1 = b1t1.c1)
1315                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
1316                        Hash Cond: (b1t4.c1 = b1t2.c1)
1317                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1318                        ->  Hash  (cost=xxx rows=100 width=xxx)
1319                              ->  Merge Join  (cost=xxx rows=100 width=xxx)
1320                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1321                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1322                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1323                                          Sort Key: b1t2.c1
1324                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1325                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1326                        Index Cond: (c1 = b1t3.c1)
1327    InitPlan 2 (returns $3)
1328      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1329            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1330                  ->  Hash Join  (cost=xxx rows=1000 width=xxx)
1331                        Hash Cond: (b2t3.c1 = b2t1.c1)
1332                        ->  Merge Join  (cost=xxx rows=1130 width=xxx)
1333                              Merge Cond: (b2t3.c1 = b2t4.c1)
1334                              ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1335                              ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1336                        ->  Hash  (cost=xxx rows=1000 width=xxx)
1337                              ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1338                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1339                        Index Cond: (c1 = b2t1.c1)
1340    InitPlan 3 (returns $5)
1341      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1342            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1343                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
1344                        Hash Cond: (b3t1.c1 = b3t2.c1)
1345                        ->  Merge Join  (cost=xxx rows=1000 width=xxx)
1346                              Merge Cond: (b3t1.c1 = b3t4.c1)
1347                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
1348                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
1349                        ->  Hash  (cost=xxx rows=100 width=xxx)
1350                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
1351                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
1352                        Index Cond: (c1 = b3t1.c1)
1353    ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1354          ->  Hash Join  (cost=xxx rows=100 width=xxx)
1355                Hash Cond: (bmt3.c1 = bmt1.c1)
1356                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1357                ->  Hash  (cost=xxx rows=100 width=xxx)
1358                      ->  Merge Join  (cost=xxx rows=100 width=xxx)
1359                            Merge Cond: (bmt1.c1 = bmt2.c1)
1360                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
1361                            ->  Sort  (cost=xxx rows=100 width=xxx)
1362                                  Sort Key: bmt2.c1
1363                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1364          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1365                Index Cond: (c1 = bmt1.c1)
1366 (56 rows)
1367
1368 \o results/ut-R.tmpout
1369 /*+
1370 Leading(bmt1 bmt2 bmt3 bmt4)
1371 Leading(b1t2 b1t3 b1t4 b1t1)
1372 Leading(b2t3 b2t4 b2t1 b2t2)
1373 Leading(b3t4 b3t1 b3t2 b3t3)
1374 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1375 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1376 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1377 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
1378 Rows(bmt1 bmt2 #1)Rows(bmt1 bmt2 bmt3 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
1379 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
1380 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
1381 Rows(b3t4 b3t1 #1)Rows(b3t4 b3t1 b3t2 #1)Rows(b3t1 b3t2 b3t3 b3t4 #1)
1382 */
1383 EXPLAIN
1384 SELECT max(bmt1.c1), (
1385 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1386 ), (
1387 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1388 ), (
1389 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
1390 )
1391                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1392 ;
1393 LOG:  pg_hint_plan:
1394 used hint:
1395 MergeJoin(b1t2 b1t3)
1396 MergeJoin(b2t3 b2t4)
1397 MergeJoin(b3t1 b3t4)
1398 MergeJoin(bmt1 bmt2)
1399 HashJoin(b1t2 b1t3 b1t4)
1400 HashJoin(b2t1 b2t3 b2t4)
1401 HashJoin(b3t1 b3t2 b3t4)
1402 HashJoin(bmt1 bmt2 bmt3)
1403 NestLoop(b1t1 b1t2 b1t3 b1t4)
1404 NestLoop(b2t1 b2t2 b2t3 b2t4)
1405 NestLoop(b3t1 b3t2 b3t3 b3t4)
1406 NestLoop(bmt1 bmt2 bmt3 bmt4)
1407 Leading(bmt1 bmt2 bmt3 bmt4)
1408 Leading(b1t2 b1t3 b1t4 b1t1)
1409 Leading(b2t3 b2t4 b2t1 b2t2)
1410 Leading(b3t4 b3t1 b3t2 b3t3)
1411 Rows(b1t2 b1t3 #1)
1412 Rows(b2t3 b2t4 #1)
1413 Rows(b3t1 b3t4 #1)
1414 Rows(bmt1 bmt2 #1)
1415 Rows(b1t2 b1t3 b1t4 #1)
1416 Rows(b2t1 b2t3 b2t4 #1)
1417 Rows(b3t1 b3t2 b3t4 #1)
1418 Rows(bmt1 bmt2 bmt3 #1)
1419 Rows(b1t1 b1t2 b1t3 b1t4 #1)
1420 Rows(b2t1 b2t2 b2t3 b2t4 #1)
1421 Rows(b3t1 b3t2 b3t3 b3t4 #1)
1422 Rows(bmt1 bmt2 bmt3 bmt4 #1)
1423 not used hint:
1424 duplication hint:
1425 error hint:
1426
1427 \o
1428 \! sql/maskout.sh results/ut-R.tmpout
1429                                                      QUERY PLAN                                                     
1430 --------------------------------------------------------------------------------------------------------------------
1431  Aggregate  (cost=xxx rows=1 width=xxx)
1432    InitPlan 1 (returns $1)
1433      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1434            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1435                  Join Filter: (b1t2.c1 = b1t1.c1)
1436                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1437                        Hash Cond: (b1t4.c1 = b1t2.c1)
1438                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1439                        ->  Hash  (cost=xxx rows=1 width=xxx)
1440                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1441                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1442                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1443                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1444                                          Sort Key: b1t2.c1
1445                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1446                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1447                        Index Cond: (c1 = b1t3.c1)
1448    InitPlan 2 (returns $3)
1449      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1450            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1451                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1452                        Hash Cond: (b2t1.c1 = b2t3.c1)
1453                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1454                        ->  Hash  (cost=xxx rows=1 width=xxx)
1455                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1456                                    Merge Cond: (b2t3.c1 = b2t4.c1)
1457                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1458                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1459                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1460                        Index Cond: (c1 = b2t1.c1)
1461    InitPlan 3 (returns $5)
1462      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1463            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1464                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1465                        Hash Cond: (b3t1.c1 = b3t2.c1)
1466                        ->  Merge Join  (cost=xxx rows=1 width=xxx)
1467                              Merge Cond: (b3t1.c1 = b3t4.c1)
1468                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
1469                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
1470                        ->  Hash  (cost=xxx rows=100 width=xxx)
1471                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
1472                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
1473                        Index Cond: (c1 = b3t1.c1)
1474    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1475          ->  Hash Join  (cost=xxx rows=1 width=xxx)
1476                Hash Cond: (bmt3.c1 = bmt1.c1)
1477                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1478                ->  Hash  (cost=xxx rows=1 width=xxx)
1479                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
1480                            Merge Cond: (bmt1.c1 = bmt2.c1)
1481                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
1482                            ->  Sort  (cost=xxx rows=100 width=xxx)
1483                                  Sort Key: bmt2.c1
1484                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1485          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1486                Index Cond: (c1 = bmt1.c1)
1487 (56 rows)
1488
1489 -- No. R-2-1-3
1490 \o results/ut-R.tmpout
1491 /*+
1492 Leading(bmt4 bmt3 bmt2 bmt1)
1493 */
1494 EXPLAIN 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.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
1495 LOG:  pg_hint_plan:
1496 used hint:
1497 Leading(bmt4 bmt3 bmt2 bmt1)
1498 not used hint:
1499 duplication hint:
1500 error hint:
1501
1502 \o
1503 \! sql/maskout.sh results/ut-R.tmpout
1504                                           QUERY PLAN                                           
1505 -----------------------------------------------------------------------------------------------
1506  Aggregate  (cost=xxx rows=1 width=xxx)
1507    ->  Merge Join  (cost=xxx rows=100 width=xxx)
1508          Merge Cond: (bmt1.c1 = bmt2.c1)
1509          ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
1510          ->  Sort  (cost=xxx rows=100 width=xxx)
1511                Sort Key: bmt2.c1
1512                ->  Hash Join  (cost=xxx rows=100 width=xxx)
1513                      Hash Cond: (bmt3.c1 = bmt2.c1)
1514                      ->  Hash Join  (cost=xxx rows=1130 width=xxx)
1515                            Hash Cond: (bmt3.c1 = bmt4.c1)
1516                            ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1517                            ->  Hash  (cost=xxx rows=1130 width=xxx)
1518                                  ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
1519                      ->  Hash  (cost=xxx rows=100 width=xxx)
1520                            ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1521 (15 rows)
1522
1523 \o results/ut-R.tmpout
1524 /*+
1525 Leading(bmt4 bmt3 bmt2 bmt1)
1526 Rows(bmt4 bmt3 #1)Rows(bmt4 bmt3 bmt2 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
1527 */
1528 EXPLAIN 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.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
1529 LOG:  pg_hint_plan:
1530 used hint:
1531 Leading(bmt4 bmt3 bmt2 bmt1)
1532 Rows(bmt3 bmt4 #1)
1533 Rows(bmt2 bmt3 bmt4 #1)
1534 Rows(bmt1 bmt2 bmt3 bmt4 #1)
1535 not used hint:
1536 duplication hint:
1537 error hint:
1538
1539 \o
1540 \! sql/maskout.sh results/ut-R.tmpout
1541                                          QUERY PLAN                                         
1542 --------------------------------------------------------------------------------------------
1543  Aggregate  (cost=xxx rows=1 width=xxx)
1544    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1545          Join Filter: (bmt2.c1 = bmt1.c1)
1546          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1547                ->  Hash Join  (cost=xxx rows=1 width=xxx)
1548                      Hash Cond: (bmt3.c1 = bmt4.c1)
1549                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1550                      ->  Hash  (cost=xxx rows=1130 width=xxx)
1551                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
1552                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
1553                      Index Cond: (c1 = bmt3.c1)
1554          ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
1555                Index Cond: (c1 = bmt3.c1)
1556 (13 rows)
1557
1558 -- No. R-2-1-4
1559 \o results/ut-R.tmpout
1560 /*+
1561 Leading(bmt4 bmt3 bmt2 bmt1)
1562 */
1563 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;
1564 LOG:  pg_hint_plan:
1565 used hint:
1566 Leading(bmt4 bmt3 bmt2 bmt1)
1567 not used hint:
1568 duplication hint:
1569 error hint:
1570
1571 \o
1572 \! sql/maskout.sh results/ut-R.tmpout
1573                                           QUERY PLAN                                           
1574 -----------------------------------------------------------------------------------------------
1575  Aggregate  (cost=xxx rows=1 width=xxx)
1576    ->  Merge Join  (cost=xxx rows=100 width=xxx)
1577          Merge Cond: (bmt1.c1 = bmt2.c1)
1578          ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
1579          ->  Sort  (cost=xxx rows=100 width=xxx)
1580                Sort Key: bmt2.c1
1581                ->  Hash Join  (cost=xxx rows=100 width=xxx)
1582                      Hash Cond: (bmt3.c1 = bmt2.c1)
1583                      ->  Hash Join  (cost=xxx rows=1130 width=xxx)
1584                            Hash Cond: (bmt3.c1 = bmt4.c1)
1585                            ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1586                            ->  Hash  (cost=xxx rows=1130 width=xxx)
1587                                  ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
1588                      ->  Hash  (cost=xxx rows=100 width=xxx)
1589                            ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1590 (15 rows)
1591
1592 \o results/ut-R.tmpout
1593 /*+
1594 Leading(bmt4 bmt3 bmt2 bmt1)
1595 Rows(bmt4 bmt3 #1)Rows(bmt4 bmt3 bmt2 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
1596 */
1597 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;
1598 LOG:  pg_hint_plan:
1599 used hint:
1600 Leading(bmt4 bmt3 bmt2 bmt1)
1601 Rows(bmt3 bmt4 #1)
1602 Rows(bmt2 bmt3 bmt4 #1)
1603 Rows(bmt1 bmt2 bmt3 bmt4 #1)
1604 not used hint:
1605 duplication hint:
1606 error hint:
1607
1608 \o
1609 \! sql/maskout.sh results/ut-R.tmpout
1610                                          QUERY PLAN                                         
1611 --------------------------------------------------------------------------------------------
1612  Aggregate  (cost=xxx rows=1 width=xxx)
1613    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1614          Join Filter: (bmt2.c1 = bmt1.c1)
1615          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1616                ->  Hash Join  (cost=xxx rows=1 width=xxx)
1617                      Hash Cond: (bmt3.c1 = bmt4.c1)
1618                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1619                      ->  Hash  (cost=xxx rows=1130 width=xxx)
1620                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
1621                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
1622                      Index Cond: (c1 = bmt3.c1)
1623          ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
1624                Index Cond: (c1 = bmt3.c1)
1625 (13 rows)
1626
1627 -- No. R-2-1-5
1628 \o results/ut-R.tmpout
1629 /*+
1630 Leading(bmt1 bmt2 bmt3 bmt4)
1631 Leading(b1t2 b1t3 b1t4 b1t1)
1632 Leading(b2t3 b2t4 b2t1 b2t2)
1633 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1634 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1635 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1636 */
1637 EXPLAIN
1638 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1639 AND bmt1.c1 <> (
1640 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1641 ) AND bmt1.c1 <> (
1642 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1643 );
1644 LOG:  pg_hint_plan:
1645 used hint:
1646 MergeJoin(b1t2 b1t3)
1647 MergeJoin(b2t3 b2t4)
1648 MergeJoin(bmt1 bmt2)
1649 HashJoin(b1t2 b1t3 b1t4)
1650 HashJoin(b2t1 b2t3 b2t4)
1651 HashJoin(bmt1 bmt2 bmt3)
1652 NestLoop(b1t1 b1t2 b1t3 b1t4)
1653 NestLoop(b2t1 b2t2 b2t3 b2t4)
1654 NestLoop(bmt1 bmt2 bmt3 bmt4)
1655 Leading(bmt1 bmt2 bmt3 bmt4)
1656 Leading(b1t2 b1t3 b1t4 b1t1)
1657 Leading(b2t3 b2t4 b2t1 b2t2)
1658 not used hint:
1659 duplication hint:
1660 error hint:
1661
1662 \o
1663 \! sql/maskout.sh results/ut-R.tmpout
1664                                                      QUERY PLAN                                                     
1665 --------------------------------------------------------------------------------------------------------------------
1666  Aggregate  (cost=xxx rows=1 width=xxx)
1667    InitPlan 1 (returns $1)
1668      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1669            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1670                  Join Filter: (b1t2.c1 = b1t1.c1)
1671                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
1672                        Hash Cond: (b1t4.c1 = b1t2.c1)
1673                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1674                        ->  Hash  (cost=xxx rows=100 width=xxx)
1675                              ->  Merge Join  (cost=xxx rows=100 width=xxx)
1676                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1677                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1678                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1679                                          Sort Key: b1t2.c1
1680                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1681                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1682                        Index Cond: (c1 = b1t3.c1)
1683    InitPlan 2 (returns $3)
1684      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1685            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1686                  ->  Hash Join  (cost=xxx rows=1000 width=xxx)
1687                        Hash Cond: (b2t3.c1 = b2t1.c1)
1688                        ->  Merge Join  (cost=xxx rows=1130 width=xxx)
1689                              Merge Cond: (b2t3.c1 = b2t4.c1)
1690                              ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1691                              ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1692                        ->  Hash  (cost=xxx rows=1000 width=xxx)
1693                              ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1694                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1695                        Index Cond: (c1 = b2t1.c1)
1696    ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1697          ->  Hash Join  (cost=xxx rows=100 width=xxx)
1698                Hash Cond: (bmt3.c1 = bmt1.c1)
1699                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1700                ->  Hash  (cost=xxx rows=100 width=xxx)
1701                      ->  Merge Join  (cost=xxx rows=100 width=xxx)
1702                            Merge Cond: (bmt1.c1 = bmt2.c1)
1703                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=998 width=xxx)
1704                                  Filter: ((c1 <> $1) AND (c1 <> $3))
1705                            ->  Sort  (cost=xxx rows=100 width=xxx)
1706                                  Sort Key: bmt2.c1
1707                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1708          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1709                Index Cond: (c1 = bmt1.c1)
1710 (44 rows)
1711
1712 \o results/ut-R.tmpout
1713 /*+
1714 Leading(bmt1 bmt2 bmt3 bmt4)
1715 Leading(b1t2 b1t3 b1t4 b1t1)
1716 Leading(b2t3 b2t4 b2t1 b2t2)
1717 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1718 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1719 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1720 Rows(bmt1 bmt2 #1)Rows(bmt1 bmt2 bmt3 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
1721 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
1722 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
1723 */
1724 EXPLAIN
1725 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1726 AND bmt1.c1 <> (
1727 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1728 ) AND bmt1.c1 <> (
1729 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1730 )
1731 ;
1732 LOG:  pg_hint_plan:
1733 used hint:
1734 MergeJoin(b1t2 b1t3)
1735 MergeJoin(b2t3 b2t4)
1736 MergeJoin(bmt1 bmt2)
1737 HashJoin(b1t2 b1t3 b1t4)
1738 HashJoin(b2t1 b2t3 b2t4)
1739 HashJoin(bmt1 bmt2 bmt3)
1740 NestLoop(b1t1 b1t2 b1t3 b1t4)
1741 NestLoop(b2t1 b2t2 b2t3 b2t4)
1742 NestLoop(bmt1 bmt2 bmt3 bmt4)
1743 Leading(bmt1 bmt2 bmt3 bmt4)
1744 Leading(b1t2 b1t3 b1t4 b1t1)
1745 Leading(b2t3 b2t4 b2t1 b2t2)
1746 Rows(b1t2 b1t3 #1)
1747 Rows(b2t3 b2t4 #1)
1748 Rows(bmt1 bmt2 #1)
1749 Rows(b1t2 b1t3 b1t4 #1)
1750 Rows(b2t1 b2t3 b2t4 #1)
1751 Rows(bmt1 bmt2 bmt3 #1)
1752 Rows(b1t1 b1t2 b1t3 b1t4 #1)
1753 Rows(b2t1 b2t2 b2t3 b2t4 #1)
1754 Rows(bmt1 bmt2 bmt3 bmt4 #1)
1755 not used hint:
1756 duplication hint:
1757 error hint:
1758
1759 \o
1760 \! sql/maskout.sh results/ut-R.tmpout
1761                                                      QUERY PLAN                                                     
1762 --------------------------------------------------------------------------------------------------------------------
1763  Aggregate  (cost=xxx rows=1 width=xxx)
1764    InitPlan 1 (returns $1)
1765      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1766            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1767                  Join Filter: (b1t2.c1 = b1t1.c1)
1768                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1769                        Hash Cond: (b1t4.c1 = b1t2.c1)
1770                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1771                        ->  Hash  (cost=xxx rows=1 width=xxx)
1772                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1773                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1774                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1775                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1776                                          Sort Key: b1t2.c1
1777                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1778                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1779                        Index Cond: (c1 = b1t3.c1)
1780    InitPlan 2 (returns $3)
1781      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1782            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1783                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1784                        Hash Cond: (b2t1.c1 = b2t3.c1)
1785                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1786                        ->  Hash  (cost=xxx rows=1 width=xxx)
1787                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1788                                    Merge Cond: (b2t3.c1 = b2t4.c1)
1789                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1790                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1791                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1792                        Index Cond: (c1 = b2t1.c1)
1793    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1794          ->  Hash Join  (cost=xxx rows=1 width=xxx)
1795                Hash Cond: (bmt3.c1 = bmt1.c1)
1796                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1797                ->  Hash  (cost=xxx rows=1 width=xxx)
1798                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
1799                            Merge Cond: (bmt1.c1 = bmt2.c1)
1800                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=998 width=xxx)
1801                                  Filter: ((c1 <> $1) AND (c1 <> $3))
1802                            ->  Sort  (cost=xxx rows=100 width=xxx)
1803                                  Sort Key: bmt2.c1
1804                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1805          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1806                Index Cond: (c1 = bmt1.c1)
1807 (44 rows)
1808
1809 -- No. R-2-1-6
1810 \o results/ut-R.tmpout
1811 /*+
1812 Leading(bmt1 bmt2 bmt3 bmt4)
1813 Leading(b1t2 b1t3 b1t4 b1t1)
1814 Leading(b2t3 b2t4 b2t1 b2t2)
1815 Leading(b3t4 b3t1 b3t2 b3t3)
1816 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1817 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1818 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1819 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
1820 */
1821 EXPLAIN
1822 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1823   AND bmt1.c1 <> (
1824 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1825 ) AND bmt1.c1 <> (
1826 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1827 ) AND bmt1.c1 <> (
1828 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
1829 )
1830 ;
1831 LOG:  pg_hint_plan:
1832 used hint:
1833 MergeJoin(b1t2 b1t3)
1834 MergeJoin(b2t3 b2t4)
1835 MergeJoin(b3t1 b3t4)
1836 MergeJoin(bmt1 bmt2)
1837 HashJoin(b1t2 b1t3 b1t4)
1838 HashJoin(b2t1 b2t3 b2t4)
1839 HashJoin(b3t1 b3t2 b3t4)
1840 HashJoin(bmt1 bmt2 bmt3)
1841 NestLoop(b1t1 b1t2 b1t3 b1t4)
1842 NestLoop(b2t1 b2t2 b2t3 b2t4)
1843 NestLoop(b3t1 b3t2 b3t3 b3t4)
1844 NestLoop(bmt1 bmt2 bmt3 bmt4)
1845 Leading(bmt1 bmt2 bmt3 bmt4)
1846 Leading(b1t2 b1t3 b1t4 b1t1)
1847 Leading(b2t3 b2t4 b2t1 b2t2)
1848 Leading(b3t4 b3t1 b3t2 b3t3)
1849 not used hint:
1850 duplication hint:
1851 error hint:
1852
1853 \o
1854 \! sql/maskout.sh results/ut-R.tmpout
1855                                                      QUERY PLAN                                                     
1856 --------------------------------------------------------------------------------------------------------------------
1857  Aggregate  (cost=xxx rows=1 width=xxx)
1858    InitPlan 1 (returns $1)
1859      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1860            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1861                  Join Filter: (b1t2.c1 = b1t1.c1)
1862                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
1863                        Hash Cond: (b1t4.c1 = b1t2.c1)
1864                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1865                        ->  Hash  (cost=xxx rows=100 width=xxx)
1866                              ->  Merge Join  (cost=xxx rows=100 width=xxx)
1867                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1868                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1869                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1870                                          Sort Key: b1t2.c1
1871                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1872                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1873                        Index Cond: (c1 = b1t3.c1)
1874    InitPlan 2 (returns $3)
1875      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1876            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1877                  ->  Hash Join  (cost=xxx rows=1000 width=xxx)
1878                        Hash Cond: (b2t3.c1 = b2t1.c1)
1879                        ->  Merge Join  (cost=xxx rows=1130 width=xxx)
1880                              Merge Cond: (b2t3.c1 = b2t4.c1)
1881                              ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
1882                              ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
1883                        ->  Hash  (cost=xxx rows=1000 width=xxx)
1884                              ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
1885                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
1886                        Index Cond: (c1 = b2t1.c1)
1887    InitPlan 3 (returns $5)
1888      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1889            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1890                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
1891                        Hash Cond: (b3t1.c1 = b3t2.c1)
1892                        ->  Merge Join  (cost=xxx rows=1000 width=xxx)
1893                              Merge Cond: (b3t1.c1 = b3t4.c1)
1894                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
1895                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
1896                        ->  Hash  (cost=xxx rows=100 width=xxx)
1897                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
1898                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
1899                        Index Cond: (c1 = b3t1.c1)
1900    ->  Nested Loop  (cost=xxx rows=100 width=xxx)
1901          ->  Hash Join  (cost=xxx rows=100 width=xxx)
1902                Hash Cond: (bmt3.c1 = bmt1.c1)
1903                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
1904                ->  Hash  (cost=xxx rows=100 width=xxx)
1905                      ->  Merge Join  (cost=xxx rows=100 width=xxx)
1906                            Merge Cond: (bmt1.c1 = bmt2.c1)
1907                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=997 width=xxx)
1908                                  Filter: ((c1 <> $1) AND (c1 <> $3) AND (c1 <> $5))
1909                            ->  Sort  (cost=xxx rows=100 width=xxx)
1910                                  Sort Key: bmt2.c1
1911                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
1912          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
1913                Index Cond: (c1 = bmt1.c1)
1914 (57 rows)
1915
1916 \o results/ut-R.tmpout
1917 /*+
1918 Leading(bmt1 bmt2 bmt3 bmt4)
1919 Leading(b1t2 b1t3 b1t4 b1t1)
1920 Leading(b2t3 b2t4 b2t1 b2t2)
1921 Leading(b3t4 b3t1 b3t2 b3t3)
1922 MergeJoin(bmt1 bmt2)HashJoin(bmt1 bmt2 bmt3)NestLoop(bmt1 bmt2 bmt3 bmt4)
1923 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
1924 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
1925 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
1926 Rows(bmt1 bmt2 #1)Rows(bmt1 bmt2 bmt3 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
1927 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
1928 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
1929 Rows(b3t4 b3t1 #1)Rows(b3t4 b3t1 b3t2 #1)Rows(b3t1 b3t2 b3t3 b3t4 #1)
1930 */
1931 EXPLAIN
1932 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
1933   AND bmt1.c1 <> (
1934 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
1935 ) AND bmt1.c1 <> (
1936 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
1937 ) AND bmt1.c1 <> (
1938 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
1939 )
1940 ;
1941 LOG:  pg_hint_plan:
1942 used hint:
1943 MergeJoin(b1t2 b1t3)
1944 MergeJoin(b2t3 b2t4)
1945 MergeJoin(b3t1 b3t4)
1946 MergeJoin(bmt1 bmt2)
1947 HashJoin(b1t2 b1t3 b1t4)
1948 HashJoin(b2t1 b2t3 b2t4)
1949 HashJoin(b3t1 b3t2 b3t4)
1950 HashJoin(bmt1 bmt2 bmt3)
1951 NestLoop(b1t1 b1t2 b1t3 b1t4)
1952 NestLoop(b2t1 b2t2 b2t3 b2t4)
1953 NestLoop(b3t1 b3t2 b3t3 b3t4)
1954 NestLoop(bmt1 bmt2 bmt3 bmt4)
1955 Leading(bmt1 bmt2 bmt3 bmt4)
1956 Leading(b1t2 b1t3 b1t4 b1t1)
1957 Leading(b2t3 b2t4 b2t1 b2t2)
1958 Leading(b3t4 b3t1 b3t2 b3t3)
1959 Rows(b1t2 b1t3 #1)
1960 Rows(b2t3 b2t4 #1)
1961 Rows(b3t1 b3t4 #1)
1962 Rows(bmt1 bmt2 #1)
1963 Rows(b1t2 b1t3 b1t4 #1)
1964 Rows(b2t1 b2t3 b2t4 #1)
1965 Rows(b3t1 b3t2 b3t4 #1)
1966 Rows(bmt1 bmt2 bmt3 #1)
1967 Rows(b1t1 b1t2 b1t3 b1t4 #1)
1968 Rows(b2t1 b2t2 b2t3 b2t4 #1)
1969 Rows(b3t1 b3t2 b3t3 b3t4 #1)
1970 Rows(bmt1 bmt2 bmt3 bmt4 #1)
1971 not used hint:
1972 duplication hint:
1973 error hint:
1974
1975 \o
1976 \! sql/maskout.sh results/ut-R.tmpout
1977                                                      QUERY PLAN                                                     
1978 --------------------------------------------------------------------------------------------------------------------
1979  Aggregate  (cost=xxx rows=1 width=xxx)
1980    InitPlan 1 (returns $1)
1981      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1982            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1983                  Join Filter: (b1t2.c1 = b1t1.c1)
1984                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
1985                        Hash Cond: (b1t4.c1 = b1t2.c1)
1986                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
1987                        ->  Hash  (cost=xxx rows=1 width=xxx)
1988                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
1989                                    Merge Cond: (b1t3.c1 = b1t2.c1)
1990                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
1991                                    ->  Sort  (cost=xxx rows=100 width=xxx)
1992                                          Sort Key: b1t2.c1
1993                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
1994                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
1995                        Index Cond: (c1 = b1t3.c1)
1996    InitPlan 2 (returns $3)
1997      ->  Aggregate  (cost=xxx rows=1 width=xxx)
1998            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
1999                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2000                        Hash Cond: (b2t1.c1 = b2t3.c1)
2001                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2002                        ->  Hash  (cost=xxx rows=1 width=xxx)
2003                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2004                                    Merge Cond: (b2t3.c1 = b2t4.c1)
2005                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2006                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2007                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2008                        Index Cond: (c1 = b2t1.c1)
2009    InitPlan 3 (returns $5)
2010      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2011            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2012                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2013                        Hash Cond: (b3t1.c1 = b3t2.c1)
2014                        ->  Merge Join  (cost=xxx rows=1 width=xxx)
2015                              Merge Cond: (b3t1.c1 = b3t4.c1)
2016                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2017                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
2018                        ->  Hash  (cost=xxx rows=100 width=xxx)
2019                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2020                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
2021                        Index Cond: (c1 = b3t1.c1)
2022    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2023          ->  Hash Join  (cost=xxx rows=1 width=xxx)
2024                Hash Cond: (bmt3.c1 = bmt1.c1)
2025                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2026                ->  Hash  (cost=xxx rows=1 width=xxx)
2027                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2028                            Merge Cond: (bmt1.c1 = bmt2.c1)
2029                            ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=997 width=xxx)
2030                                  Filter: ((c1 <> $1) AND (c1 <> $3) AND (c1 <> $5))
2031                            ->  Sort  (cost=xxx rows=100 width=xxx)
2032                                  Sort Key: bmt2.c1
2033                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2034          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
2035                Index Cond: (c1 = bmt1.c1)
2036 (57 rows)
2037
2038 -- No. R-2-1-7
2039 \o results/ut-R.tmpout
2040 /*+
2041 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
2042 Leading(b1t2 b1t3 b1t4 b1t1)
2043 Leading(b2t3 b2t4 b2t1 b2t2)
2044 MergeJoin(c2 c1)HashJoin(c2 c1 bmt1)NestLoop(c2 c1 bmt1 bmt2)MergeJoin(c2 c1 bmt1 bmt2 bmt3)HashJoin(c2 c1 bmt1 bmt2 bmt3 bmt4)
2045 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
2046 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
2047 */
2048 EXPLAIN
2049 WITH c1 (c1) AS (
2050 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
2051 )
2052 , c2 (c1) AS (
2053 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
2054 )
2055 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
2056 , c1, c2
2057                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
2058 AND bmt1.c1 = c1.c1
2059 AND bmt1.c1 = c2.c1
2060 ;
2061 LOG:  pg_hint_plan:
2062 used hint:
2063 MergeJoin(b1t2 b1t3)
2064 MergeJoin(b2t3 b2t4)
2065 MergeJoin(c1 c2)
2066 HashJoin(b1t2 b1t3 b1t4)
2067 HashJoin(b2t1 b2t3 b2t4)
2068 HashJoin(bmt1 c1 c2)
2069 NestLoop(b1t1 b1t2 b1t3 b1t4)
2070 NestLoop(b2t1 b2t2 b2t3 b2t4)
2071 NestLoop(bmt1 bmt2 c1 c2)
2072 MergeJoin(bmt1 bmt2 bmt3 c1 c2)
2073 HashJoin(bmt1 bmt2 bmt3 bmt4 c1 c2)
2074 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
2075 Leading(b1t2 b1t3 b1t4 b1t1)
2076 Leading(b2t3 b2t4 b2t1 b2t2)
2077 not used hint:
2078 duplication hint:
2079 error hint:
2080
2081 \o
2082 \! sql/maskout.sh results/ut-R.tmpout
2083                                                      QUERY PLAN                                                     
2084 --------------------------------------------------------------------------------------------------------------------
2085  Aggregate  (cost=xxx rows=1 width=xxx)
2086    CTE c1
2087      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2088            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2089                  Join Filter: (b1t2.c1 = b1t1.c1)
2090                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
2091                        Hash Cond: (b1t4.c1 = b1t2.c1)
2092                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2093                        ->  Hash  (cost=xxx rows=100 width=xxx)
2094                              ->  Merge Join  (cost=xxx rows=100 width=xxx)
2095                                    Merge Cond: (b1t3.c1 = b1t2.c1)
2096                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2097                                    ->  Sort  (cost=xxx rows=100 width=xxx)
2098                                          Sort Key: b1t2.c1
2099                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2100                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2101                        Index Cond: (c1 = b1t3.c1)
2102    CTE c2
2103      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2104            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2105                  ->  Hash Join  (cost=xxx rows=1000 width=xxx)
2106                        Hash Cond: (b2t3.c1 = b2t1.c1)
2107                        ->  Merge Join  (cost=xxx rows=1130 width=xxx)
2108                              Merge Cond: (b2t3.c1 = b2t4.c1)
2109                              ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2110                              ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2111                        ->  Hash  (cost=xxx rows=1000 width=xxx)
2112                              ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2113                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2114                        Index Cond: (c1 = b2t1.c1)
2115    ->  Hash Join  (cost=xxx rows=1 width=xxx)
2116          Hash Cond: (bmt4.c1 = bmt1.c1)
2117          ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
2118          ->  Hash  (cost=xxx rows=1 width=xxx)
2119                ->  Merge Join  (cost=xxx rows=1 width=xxx)
2120                      Merge Cond: (bmt3.c1 = bmt1.c1)
2121                      ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2122                      ->  Sort  (cost=xxx rows=1 width=xxx)
2123                            Sort Key: bmt1.c1
2124                            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2125                                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2126                                        Hash Cond: (bmt1.c1 = c1.c1)
2127                                        ->  Seq Scan on t1 bmt1  (cost=xxx rows=1000 width=xxx)
2128                                        ->  Hash  (cost=xxx rows=1 width=xxx)
2129                                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2130                                                    Merge Cond: (c1.c1 = c2.c1)
2131                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2132                                                          Sort Key: c1.c1
2133                                                          ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2134                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2135                                                          Sort Key: c2.c1
2136                                                          ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
2137                                  ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
2138                                        Index Cond: (c1 = bmt1.c1)
2139 (54 rows)
2140
2141 \o results/ut-R.tmpout
2142 /*+
2143 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
2144 Leading(b1t2 b1t3 b1t4 b1t1)
2145 Leading(b2t3 b2t4 b2t1 b2t2)
2146 MergeJoin(c2 c1)HashJoin(c2 c1 bmt1)NestLoop(c2 c1 bmt1 bmt2)MergeJoin(c2 c1 bmt1 bmt2 bmt3)HashJoin(c2 c1 bmt1 bmt2 bmt3 bmt4)
2147 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
2148 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
2149 Rows(c2 c1 #1)Rows(c2 c1 bmt1 #1)Rows(c2 c1 bmt1 bmt2 #1)Rows(c2 c1 bmt1 bmt2 bmt3 #1)Rows(c2 c1 bmt1 bmt2 bmt3 bmt4 #1)
2150 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
2151 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
2152 */
2153 EXPLAIN
2154 WITH c1 (c1) AS (
2155 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
2156 )
2157 , c2 (c1) AS (
2158 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
2159 )
2160 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
2161 , c1, c2
2162                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
2163 AND bmt1.c1 = c1.c1
2164 AND bmt1.c1 = c2.c1;
2165 LOG:  pg_hint_plan:
2166 used hint:
2167 MergeJoin(b1t2 b1t3)
2168 MergeJoin(b2t3 b2t4)
2169 MergeJoin(c1 c2)
2170 HashJoin(b1t2 b1t3 b1t4)
2171 HashJoin(b2t1 b2t3 b2t4)
2172 HashJoin(bmt1 c1 c2)
2173 NestLoop(b1t1 b1t2 b1t3 b1t4)
2174 NestLoop(b2t1 b2t2 b2t3 b2t4)
2175 NestLoop(bmt1 bmt2 c1 c2)
2176 MergeJoin(bmt1 bmt2 bmt3 c1 c2)
2177 HashJoin(bmt1 bmt2 bmt3 bmt4 c1 c2)
2178 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
2179 Leading(b1t2 b1t3 b1t4 b1t1)
2180 Leading(b2t3 b2t4 b2t1 b2t2)
2181 Rows(b1t2 b1t3 #1)
2182 Rows(b2t3 b2t4 #1)
2183 Rows(c1 c2 #1)
2184 Rows(b1t2 b1t3 b1t4 #1)
2185 Rows(b2t1 b2t3 b2t4 #1)
2186 Rows(bmt1 c1 c2 #1)
2187 Rows(b1t1 b1t2 b1t3 b1t4 #1)
2188 Rows(b2t1 b2t2 b2t3 b2t4 #1)
2189 Rows(bmt1 bmt2 c1 c2 #1)
2190 Rows(bmt1 bmt2 bmt3 c1 c2 #1)
2191 Rows(bmt1 bmt2 bmt3 bmt4 c1 c2 #1)
2192 not used hint:
2193 duplication hint:
2194 error hint:
2195
2196 \o
2197 \! sql/maskout.sh results/ut-R.tmpout
2198                                                      QUERY PLAN                                                     
2199 --------------------------------------------------------------------------------------------------------------------
2200  Aggregate  (cost=xxx rows=1 width=xxx)
2201    CTE c1
2202      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2203            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2204                  Join Filter: (b1t2.c1 = b1t1.c1)
2205                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2206                        Hash Cond: (b1t4.c1 = b1t2.c1)
2207                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2208                        ->  Hash  (cost=xxx rows=1 width=xxx)
2209                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2210                                    Merge Cond: (b1t3.c1 = b1t2.c1)
2211                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2212                                    ->  Sort  (cost=xxx rows=100 width=xxx)
2213                                          Sort Key: b1t2.c1
2214                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2215                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2216                        Index Cond: (c1 = b1t3.c1)
2217    CTE c2
2218      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2219            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2220                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2221                        Hash Cond: (b2t1.c1 = b2t3.c1)
2222                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2223                        ->  Hash  (cost=xxx rows=1 width=xxx)
2224                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2225                                    Merge Cond: (b2t3.c1 = b2t4.c1)
2226                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2227                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2228                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2229                        Index Cond: (c1 = b2t1.c1)
2230    ->  Hash Join  (cost=xxx rows=1 width=xxx)
2231          Hash Cond: (bmt4.c1 = bmt1.c1)
2232          ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
2233          ->  Hash  (cost=xxx rows=1 width=xxx)
2234                ->  Merge Join  (cost=xxx rows=1 width=xxx)
2235                      Merge Cond: (bmt3.c1 = bmt1.c1)
2236                      ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2237                      ->  Sort  (cost=xxx rows=1 width=xxx)
2238                            Sort Key: bmt1.c1
2239                            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2240                                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2241                                        Hash Cond: (bmt1.c1 = c1.c1)
2242                                        ->  Seq Scan on t1 bmt1  (cost=xxx rows=1000 width=xxx)
2243                                        ->  Hash  (cost=xxx rows=1 width=xxx)
2244                                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2245                                                    Merge Cond: (c1.c1 = c2.c1)
2246                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2247                                                          Sort Key: c1.c1
2248                                                          ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2249                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2250                                                          Sort Key: c2.c1
2251                                                          ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
2252                                  ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
2253                                        Index Cond: (c1 = bmt1.c1)
2254 (54 rows)
2255
2256 -- No. R-2-1-8
2257 \o results/ut-R.tmpout
2258 /*+
2259 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2260 Leading(b1t2 b1t3 b1t4 b1t1)
2261 Leading(b2t3 b2t4 b2t1 b2t2)
2262 Leading(b3t4 b3t1 b3t2 b3t3)
2263 MergeJoin(c3 c2)HashJoin(c3 c2 c1)NestLoop(c3 c2 c1 bmt1)MergeJoin(c3 c2 c1 bmt1 bmt2)HashJoin(c3 c2 c1 bmt1 bmt2 bmt3)NestLoop(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2264 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
2265 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
2266 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
2267 */
2268 EXPLAIN
2269 WITH c1 (c1) AS (
2270 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
2271 )
2272 , c2 (c1) AS (
2273 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
2274 )
2275 , c3 (c1) AS (
2276 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
2277 )
2278 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
2279 , c1, c2, c3
2280                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
2281 AND bmt1.c1 = c1.c1
2282 AND bmt1.c1 = c2.c1
2283 AND bmt1.c1 = c3.c1;
2284 LOG:  pg_hint_plan:
2285 used hint:
2286 MergeJoin(b1t2 b1t3)
2287 MergeJoin(b2t3 b2t4)
2288 MergeJoin(b3t1 b3t4)
2289 MergeJoin(c2 c3)
2290 HashJoin(b1t2 b1t3 b1t4)
2291 HashJoin(b2t1 b2t3 b2t4)
2292 HashJoin(b3t1 b3t2 b3t4)
2293 HashJoin(c1 c2 c3)
2294 NestLoop(b1t1 b1t2 b1t3 b1t4)
2295 NestLoop(b2t1 b2t2 b2t3 b2t4)
2296 NestLoop(b3t1 b3t2 b3t3 b3t4)
2297 NestLoop(bmt1 c1 c2 c3)
2298 MergeJoin(bmt1 bmt2 c1 c2 c3)
2299 HashJoin(bmt1 bmt2 bmt3 c1 c2 c3)
2300 NestLoop(bmt1 bmt2 bmt3 bmt4 c1 c2 c3)
2301 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2302 Leading(b1t2 b1t3 b1t4 b1t1)
2303 Leading(b2t3 b2t4 b2t1 b2t2)
2304 Leading(b3t4 b3t1 b3t2 b3t3)
2305 not used hint:
2306 duplication hint:
2307 error hint:
2308
2309 \o
2310 \! sql/maskout.sh results/ut-R.tmpout
2311                                                      QUERY PLAN                                                     
2312 --------------------------------------------------------------------------------------------------------------------
2313  Aggregate  (cost=xxx rows=1 width=xxx)
2314    CTE c1
2315      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2316            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2317                  Join Filter: (b1t2.c1 = b1t1.c1)
2318                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
2319                        Hash Cond: (b1t4.c1 = b1t2.c1)
2320                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2321                        ->  Hash  (cost=xxx rows=100 width=xxx)
2322                              ->  Merge Join  (cost=xxx rows=100 width=xxx)
2323                                    Merge Cond: (b1t3.c1 = b1t2.c1)
2324                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2325                                    ->  Sort  (cost=xxx rows=100 width=xxx)
2326                                          Sort Key: b1t2.c1
2327                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2328                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2329                        Index Cond: (c1 = b1t3.c1)
2330    CTE c2
2331      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2332            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2333                  ->  Hash Join  (cost=xxx rows=1000 width=xxx)
2334                        Hash Cond: (b2t3.c1 = b2t1.c1)
2335                        ->  Merge Join  (cost=xxx rows=1130 width=xxx)
2336                              Merge Cond: (b2t3.c1 = b2t4.c1)
2337                              ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2338                              ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2339                        ->  Hash  (cost=xxx rows=1000 width=xxx)
2340                              ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2341                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2342                        Index Cond: (c1 = b2t1.c1)
2343    CTE c3
2344      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2345            ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2346                  ->  Hash Join  (cost=xxx rows=100 width=xxx)
2347                        Hash Cond: (b3t1.c1 = b3t2.c1)
2348                        ->  Merge Join  (cost=xxx rows=1000 width=xxx)
2349                              Merge Cond: (b3t1.c1 = b3t4.c1)
2350                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2351                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
2352                        ->  Hash  (cost=xxx rows=100 width=xxx)
2353                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2354                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
2355                        Index Cond: (c1 = b3t1.c1)
2356    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2357          ->  Hash Join  (cost=xxx rows=1 width=xxx)
2358                Hash Cond: (bmt3.c1 = bmt1.c1)
2359                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2360                ->  Hash  (cost=xxx rows=1 width=xxx)
2361                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2362                            Merge Cond: (bmt1.c1 = bmt2.c1)
2363                            ->  Sort  (cost=xxx rows=1 width=xxx)
2364                                  Sort Key: bmt1.c1
2365                                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2366                                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
2367                                              Hash Cond: (c2.c1 = c1.c1)
2368                                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2369                                                    Merge Cond: (c2.c1 = c3.c1)
2370                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2371                                                          Sort Key: c2.c1
2372                                                          ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
2373                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2374                                                          Sort Key: c3.c1
2375                                                          ->  CTE Scan on c3  (cost=xxx rows=1 width=xxx)
2376                                              ->  Hash  (cost=xxx rows=1 width=xxx)
2377                                                    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2378                                        ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2379                                              Index Cond: (c1 = c1.c1)
2380                            ->  Sort  (cost=xxx rows=100 width=xxx)
2381                                  Sort Key: bmt2.c1
2382                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2383          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
2384                Index Cond: (c1 = bmt1.c1)
2385 (72 rows)
2386
2387 \o results/ut-R.tmpout
2388 /*+
2389 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2390 Leading(b1t2 b1t3 b1t4 b1t1)
2391 Leading(b2t3 b2t4 b2t1 b2t2)
2392 Leading(b3t4 b3t1 b3t2 b3t3)
2393 MergeJoin(c3 c2)HashJoin(c3 c2 c1)NestLoop(c3 c2 c1 bmt1)MergeJoin(c3 c2 c1 bmt1 bmt2)HashJoin(c3 c2 c1 bmt1 bmt2 bmt3)NestLoop(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2394 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
2395 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
2396 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
2397 Rows(c3 c2 #1)Rows(c3 c2 c1 #1)Rows(c3 c2 c1 bmt1 #1)Rows(c3 c2 c1 bmt1 bmt2 #1)Rows(c3 c2 c1 bmt1 bmt2 bmt3 #1)Rows(c3 c2 c1 bmt1 bmt2 bmt3 bmt4 #1)
2398 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
2399 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
2400 Rows(b3t4 b3t1 #1)Rows(b3t4 b3t1 b3t2 #1)Rows(b3t1 b3t2 b3t3 b3t4 #1)
2401 */
2402 EXPLAIN
2403 WITH c1 (c1) AS (
2404 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
2405 )
2406 , c2 (c1) AS (
2407 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
2408 )
2409 , c3 (c1) AS (
2410 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
2411 )
2412 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
2413 , c1, c2, c3
2414                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
2415 AND bmt1.c1 = c1.c1
2416 AND bmt1.c1 = c2.c1
2417 AND bmt1.c1 = c3.c1;
2418 LOG:  pg_hint_plan:
2419 used hint:
2420 MergeJoin(b1t2 b1t3)
2421 MergeJoin(b2t3 b2t4)
2422 MergeJoin(b3t1 b3t4)
2423 MergeJoin(c2 c3)
2424 HashJoin(b1t2 b1t3 b1t4)
2425 HashJoin(b2t1 b2t3 b2t4)
2426 HashJoin(b3t1 b3t2 b3t4)
2427 HashJoin(c1 c2 c3)
2428 NestLoop(b1t1 b1t2 b1t3 b1t4)
2429 NestLoop(b2t1 b2t2 b2t3 b2t4)
2430 NestLoop(b3t1 b3t2 b3t3 b3t4)
2431 NestLoop(bmt1 c1 c2 c3)
2432 MergeJoin(bmt1 bmt2 c1 c2 c3)
2433 HashJoin(bmt1 bmt2 bmt3 c1 c2 c3)
2434 NestLoop(bmt1 bmt2 bmt3 bmt4 c1 c2 c3)
2435 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2436 Leading(b1t2 b1t3 b1t4 b1t1)
2437 Leading(b2t3 b2t4 b2t1 b2t2)
2438 Leading(b3t4 b3t1 b3t2 b3t3)
2439 Rows(b1t2 b1t3 #1)
2440 Rows(b2t3 b2t4 #1)
2441 Rows(b3t1 b3t4 #1)
2442 Rows(c2 c3 #1)
2443 Rows(b1t2 b1t3 b1t4 #1)
2444 Rows(b2t1 b2t3 b2t4 #1)
2445 Rows(b3t1 b3t2 b3t4 #1)
2446 Rows(c1 c2 c3 #1)
2447 Rows(b1t1 b1t2 b1t3 b1t4 #1)
2448 Rows(b2t1 b2t2 b2t3 b2t4 #1)
2449 Rows(b3t1 b3t2 b3t3 b3t4 #1)
2450 Rows(bmt1 c1 c2 c3 #1)
2451 Rows(bmt1 bmt2 c1 c2 c3 #1)
2452 Rows(bmt1 bmt2 bmt3 c1 c2 c3 #1)
2453 Rows(bmt1 bmt2 bmt3 bmt4 c1 c2 c3 #1)
2454 not used hint:
2455 duplication hint:
2456 error hint:
2457
2458 \o
2459 \! sql/maskout.sh results/ut-R.tmpout
2460                                                      QUERY PLAN                                                     
2461 --------------------------------------------------------------------------------------------------------------------
2462  Aggregate  (cost=xxx rows=1 width=xxx)
2463    CTE c1
2464      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2465            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2466                  Join Filter: (b1t2.c1 = b1t1.c1)
2467                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2468                        Hash Cond: (b1t4.c1 = b1t2.c1)
2469                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2470                        ->  Hash  (cost=xxx rows=1 width=xxx)
2471                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2472                                    Merge Cond: (b1t3.c1 = b1t2.c1)
2473                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2474                                    ->  Sort  (cost=xxx rows=100 width=xxx)
2475                                          Sort Key: b1t2.c1
2476                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2477                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2478                        Index Cond: (c1 = b1t3.c1)
2479    CTE c2
2480      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2481            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2482                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2483                        Hash Cond: (b2t1.c1 = b2t3.c1)
2484                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2485                        ->  Hash  (cost=xxx rows=1 width=xxx)
2486                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2487                                    Merge Cond: (b2t3.c1 = b2t4.c1)
2488                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2489                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2490                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2491                        Index Cond: (c1 = b2t1.c1)
2492    CTE c3
2493      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2494            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2495                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2496                        Hash Cond: (b3t1.c1 = b3t2.c1)
2497                        ->  Merge Join  (cost=xxx rows=1 width=xxx)
2498                              Merge Cond: (b3t1.c1 = b3t4.c1)
2499                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2500                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
2501                        ->  Hash  (cost=xxx rows=100 width=xxx)
2502                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2503                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
2504                        Index Cond: (c1 = b3t1.c1)
2505    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2506          ->  Hash Join  (cost=xxx rows=1 width=xxx)
2507                Hash Cond: (bmt3.c1 = bmt1.c1)
2508                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2509                ->  Hash  (cost=xxx rows=1 width=xxx)
2510                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2511                            Merge Cond: (bmt1.c1 = bmt2.c1)
2512                            ->  Sort  (cost=xxx rows=1 width=xxx)
2513                                  Sort Key: bmt1.c1
2514                                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2515                                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
2516                                              Hash Cond: (c2.c1 = c1.c1)
2517                                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2518                                                    Merge Cond: (c2.c1 = c3.c1)
2519                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2520                                                          Sort Key: c2.c1
2521                                                          ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
2522                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2523                                                          Sort Key: c3.c1
2524                                                          ->  CTE Scan on c3  (cost=xxx rows=1 width=xxx)
2525                                              ->  Hash  (cost=xxx rows=1 width=xxx)
2526                                                    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2527                                        ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2528                                              Index Cond: (c1 = c1.c1)
2529                            ->  Sort  (cost=xxx rows=100 width=xxx)
2530                                  Sort Key: bmt2.c1
2531                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2532          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
2533                Index Cond: (c1 = bmt1.c1)
2534 (72 rows)
2535
2536 ----
2537 ---- No. R-2-2 the number of the tables per quiry block
2538 ----
2539 -- No. R-2-2-1
2540 \o results/ut-R.tmpout
2541 /*+
2542 Leading(c1 bmt1)
2543 */
2544 EXPLAIN
2545 WITH c1 (c1) AS (
2546 SELECT b1t1.c1 FROM s1.t1 b1t1 WHERE b1t1.c1 = 1
2547 )
2548 SELECT bmt1.c1, (
2549 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
2550 )
2551                     FROM s1.t1 bmt1, c1 WHERE bmt1.c1 = 1
2552 AND bmt1.c1 = c1.c1
2553 AND bmt1.c1 <> (
2554 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
2555 );
2556 LOG:  pg_hint_plan:
2557 used hint:
2558 Leading(c1 bmt1)
2559 not used hint:
2560 duplication hint:
2561 error hint:
2562
2563 \o
2564 \! sql/maskout.sh results/ut-R.tmpout
2565                                     QUERY PLAN                                    
2566 ----------------------------------------------------------------------------------
2567  Nested Loop  (cost=xxx rows=1 width=xxx)
2568    CTE c1
2569      ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2570            Index Cond: (c1 = 1)
2571    InitPlan 2 (returns $1)
2572      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
2573            Index Cond: (c1 = 1)
2574    InitPlan 3 (returns $2)
2575      ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
2576            Index Cond: (c1 = 1)
2577    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2578          Index Cond: (c1 = 1)
2579          Filter: (c1 <> $2)
2580    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2581          Filter: (c1 = 1)
2582 (15 rows)
2583
2584 \o results/ut-R.tmpout
2585 /*+
2586 Leading(c1 bmt1)
2587 Rows(bmt1 c1 #1)
2588 Rows(b1t1 c1 #1)
2589 Rows(b2t1 c1 #1)
2590 Rows(b3t1 c1 #1)
2591 */
2592 EXPLAIN
2593 WITH c1 (c1) AS (
2594 SELECT b1t1.c1 FROM s1.t1 b1t1 WHERE b1t1.c1 = 1
2595 )
2596 SELECT bmt1.c1, (
2597 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
2598 )
2599                     FROM s1.t1 bmt1, c1 WHERE bmt1.c1 = 1
2600 AND bmt1.c1 = c1.c1
2601 AND bmt1.c1 <> (
2602 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
2603 );
2604 LOG:  pg_hint_plan:
2605 used hint:
2606 Leading(c1 bmt1)
2607 Rows(bmt1 c1 #1)
2608 not used hint:
2609 Rows(b1t1 c1 #1)
2610 Rows(b2t1 c1 #1)
2611 Rows(b3t1 c1 #1)
2612 duplication hint:
2613 error hint:
2614
2615 \o
2616 \! sql/maskout.sh results/ut-R.tmpout
2617                                     QUERY PLAN                                    
2618 ----------------------------------------------------------------------------------
2619  Nested Loop  (cost=xxx rows=1 width=xxx)
2620    CTE c1
2621      ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2622            Index Cond: (c1 = 1)
2623    InitPlan 2 (returns $1)
2624      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
2625            Index Cond: (c1 = 1)
2626    InitPlan 3 (returns $2)
2627      ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
2628            Index Cond: (c1 = 1)
2629    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2630          Index Cond: (c1 = 1)
2631          Filter: (c1 <> $2)
2632    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2633          Filter: (c1 = 1)
2634 (15 rows)
2635
2636 -- No. R-2-2-2
2637 \o results/ut-R.tmpout
2638 /*+
2639 Leading(c1 bmt2 bmt1)
2640 Leading(b1t2 b1t1)
2641 Leading(b2t2 b2t1)
2642 Leading(b3t2 b3t1)
2643 MergeJoin(c1 bmt2)
2644 HashJoin(c1 bmt1 bmt2)
2645 MergeJoin(b1t1 b1t2)
2646 MergeJoin(b2t1 b2t2)
2647 MergeJoin(b3t1 b3t2)
2648 */
2649 EXPLAIN
2650 WITH c1 (c1) AS (
2651 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.c1 = b1t2.c1
2652 )
2653 SELECT bmt1.c1, (
2654 SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.c1 = b2t2.c1
2655 )
2656                     FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.c1 = bmt2.c1
2657 AND bmt1.c1 = c1.c1
2658 AND bmt1.c1 <> (
2659 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
2660 );
2661 LOG:  pg_hint_plan:
2662 used hint:
2663 MergeJoin(b1t1 b1t2)
2664 MergeJoin(b2t1 b2t2)
2665 MergeJoin(b3t1 b3t2)
2666 MergeJoin(bmt2 c1)
2667 HashJoin(bmt1 bmt2 c1)
2668 Leading(c1 bmt2 bmt1)
2669 Leading(b1t2 b1t1)
2670 Leading(b2t2 b2t1)
2671 Leading(b3t2 b3t1)
2672 not used hint:
2673 duplication hint:
2674 error hint:
2675
2676 \o
2677 \! sql/maskout.sh results/ut-R.tmpout
2678                                          QUERY PLAN                                         
2679 --------------------------------------------------------------------------------------------
2680  Hash Join  (cost=xxx rows=10 width=xxx)
2681    Hash Cond: (bmt1.c1 = bmt2.c1)
2682    CTE c1
2683      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2684            Merge Cond: (b1t1.c1 = b1t2.c1)
2685            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
2686            ->  Sort  (cost=xxx rows=100 width=xxx)
2687                  Sort Key: b1t2.c1
2688                  ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2689    InitPlan 2 (returns $1)
2690      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2691            Merge Cond: (b2t1.c1 = b2t2.c1)
2692            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2693            ->  Sort  (cost=xxx rows=100 width=xxx)
2694                  Sort Key: b2t2.c1
2695                  ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=xxx)
2696    InitPlan 3 (returns $2)
2697      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2698            Merge Cond: (b3t1.c1 = b3t2.c1)
2699            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2700            ->  Sort  (cost=xxx rows=100 width=xxx)
2701                  Sort Key: b3t2.c1
2702                  ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2703    ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=xxx)
2704          Filter: (c1 <> $2)
2705    ->  Hash  (cost=xxx rows=100 width=xxx)
2706          ->  Merge Join  (cost=xxx rows=100 width=xxx)
2707                Merge Cond: (bmt2.c1 = c1.c1)
2708                ->  Sort  (cost=xxx rows=100 width=xxx)
2709                      Sort Key: bmt2.c1
2710                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2711                ->  Sort  (cost=xxx rows=100 width=xxx)
2712                      Sort Key: c1.c1
2713                      ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
2714 (34 rows)
2715
2716 \o results/ut-R.tmpout
2717 /*+
2718 Leading(c1 bmt2 bmt1)
2719 Leading(b1t2 b1t1)
2720 Leading(b2t2 b2t1)
2721 Leading(b3t2 b3t1)
2722 MergeJoin(c1 bmt2)
2723 HashJoin(c1 bmt1 bmt2)
2724 MergeJoin(b1t1 b1t2)
2725 MergeJoin(b2t1 b2t2)
2726 MergeJoin(b3t1 b3t2)
2727 Rows(c1 bmt2 #1)
2728 Rows(c1 bmt1 bmt2 #1)
2729 Rows(b1t1 b1t2 #1)
2730 Rows(b2t1 b2t2 #1)
2731 Rows(b3t1 b3t2 #1)
2732 */
2733 EXPLAIN
2734 WITH c1 (c1) AS (
2735 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.c1 = b1t2.c1
2736 )
2737 SELECT bmt1.c1, (
2738 SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.c1 = b2t2.c1
2739 )
2740                     FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.c1 = bmt2.c1
2741 AND bmt1.c1 = c1.c1
2742 AND bmt1.c1 <> (
2743 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
2744 )
2745 ;
2746 LOG:  pg_hint_plan:
2747 used hint:
2748 MergeJoin(b1t1 b1t2)
2749 MergeJoin(b2t1 b2t2)
2750 MergeJoin(b3t1 b3t2)
2751 MergeJoin(bmt2 c1)
2752 HashJoin(bmt1 bmt2 c1)
2753 Leading(c1 bmt2 bmt1)
2754 Leading(b1t2 b1t1)
2755 Leading(b2t2 b2t1)
2756 Leading(b3t2 b3t1)
2757 Rows(b1t1 b1t2 #1)
2758 Rows(b2t1 b2t2 #1)
2759 Rows(b3t1 b3t2 #1)
2760 Rows(bmt2 c1 #1)
2761 Rows(bmt1 bmt2 c1 #1)
2762 not used hint:
2763 duplication hint:
2764 error hint:
2765
2766 \o
2767 \! sql/maskout.sh results/ut-R.tmpout
2768                                          QUERY PLAN                                         
2769 --------------------------------------------------------------------------------------------
2770  Hash Join  (cost=xxx rows=1 width=xxx)
2771    Hash Cond: (bmt1.c1 = bmt2.c1)
2772    CTE c1
2773      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2774            Merge Cond: (b1t1.c1 = b1t2.c1)
2775            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
2776            ->  Sort  (cost=xxx rows=100 width=xxx)
2777                  Sort Key: b1t2.c1
2778                  ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2779    InitPlan 2 (returns $1)
2780      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2781            Merge Cond: (b2t1.c1 = b2t2.c1)
2782            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2783            ->  Sort  (cost=xxx rows=100 width=xxx)
2784                  Sort Key: b2t2.c1
2785                  ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=xxx)
2786    InitPlan 3 (returns $2)
2787      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2788            Merge Cond: (b3t1.c1 = b3t2.c1)
2789            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2790            ->  Sort  (cost=xxx rows=100 width=xxx)
2791                  Sort Key: b3t2.c1
2792                  ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2793    ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=xxx)
2794          Filter: (c1 <> $2)
2795    ->  Hash  (cost=xxx rows=1 width=xxx)
2796          ->  Merge Join  (cost=xxx rows=1 width=xxx)
2797                Merge Cond: (bmt2.c1 = c1.c1)
2798                ->  Sort  (cost=xxx rows=100 width=xxx)
2799                      Sort Key: bmt2.c1
2800                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2801                ->  Sort  (cost=xxx rows=1 width=xxx)
2802                      Sort Key: c1.c1
2803                      ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2804 (34 rows)
2805
2806 -- No. R-2-2-3
2807 \o results/ut-R.tmpout
2808 /*+
2809 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2810 Leading(b1t4 b1t3 b1t2 b1t1) 
2811 Leading(b2t4 b2t3 b2t2 b2t1)
2812 Leading(b3t4 b3t3 b3t2 b3t1)
2813 MergeJoin(c1 bmt4)
2814 HashJoin(c1 bmt4 bmt3)
2815 NestLoop(c1 bmt4 bmt3 bmt2)
2816 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
2817 HashJoin(b1t4 b1t3)
2818 NestLoop(b1t4 b1t3 b1t2)
2819 MergeJoin(b1t4 b1t3 b1t2 b1t1)
2820 HashJoin(b2t4 b2t3)
2821 NestLoop(b2t4 b2t3 b2t2)
2822 MergeJoin(b2t4 b2t3 b2t2 b2t1)
2823 HashJoin(b3t4 b3t3)
2824 NestLoop(b3t4 b3t3 b3t2)
2825 MergeJoin(b3t4 b3t3 b3t2 b3t1)
2826 */
2827 EXPLAIN
2828 WITH c1 (c1) AS (
2829 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
2830 )
2831 SELECT bmt1.c1, (
2832 SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
2833 )
2834                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
2835 AND bmt1.c1 <> (
2836 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
2837 );
2838 LOG:  pg_hint_plan:
2839 used hint:
2840 HashJoin(b1t3 b1t4)
2841 HashJoin(b2t3 b2t4)
2842 HashJoin(b3t3 b3t4)
2843 MergeJoin(bmt4 c1)
2844 NestLoop(b1t2 b1t3 b1t4)
2845 NestLoop(b2t2 b2t3 b2t4)
2846 NestLoop(b3t2 b3t3 b3t4)
2847 HashJoin(bmt3 bmt4 c1)
2848 MergeJoin(b1t1 b1t2 b1t3 b1t4)
2849 MergeJoin(b2t1 b2t2 b2t3 b2t4)
2850 MergeJoin(b3t1 b3t2 b3t3 b3t4)
2851 NestLoop(bmt2 bmt3 bmt4 c1)
2852 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
2853 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2854 Leading(b1t4 b1t3 b1t2 b1t1)
2855 Leading(b2t4 b2t3 b2t2 b2t1)
2856 Leading(b3t4 b3t3 b3t2 b3t1)
2857 not used hint:
2858 duplication hint:
2859 error hint:
2860
2861 \o
2862 \! sql/maskout.sh results/ut-R.tmpout
2863                                                     QUERY PLAN                                                    
2864 ------------------------------------------------------------------------------------------------------------------
2865  Merge Join  (cost=xxx rows=10 width=xxx)
2866    Merge Cond: (bmt1.c1 = bmt2.c1)
2867    CTE c1
2868      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2869            Merge Cond: (b1t1.c1 = b1t2.c1)
2870            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
2871            ->  Sort  (cost=xxx rows=100 width=xxx)
2872                  Sort Key: b1t2.c1
2873                  ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2874                        ->  Hash Join  (cost=xxx rows=1130 width=xxx)
2875                              Hash Cond: (b1t3.c1 = b1t4.c1)
2876                              ->  Seq Scan on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2877                              ->  Hash  (cost=xxx rows=1130 width=xxx)
2878                                    ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2879                        ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=xxx)
2880                              Index Cond: (c1 = b1t3.c1)
2881    InitPlan 2 (returns $3)
2882      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2883            Merge Cond: (b2t1.c1 = b2t2.c1)
2884            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2885            ->  Sort  (cost=xxx rows=100 width=xxx)
2886                  Sort Key: b2t2.c1
2887                  ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2888                        ->  Hash Join  (cost=xxx rows=1130 width=xxx)
2889                              Hash Cond: (b2t3.c1 = b2t4.c1)
2890                              ->  Seq Scan on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2891                              ->  Hash  (cost=xxx rows=1130 width=xxx)
2892                                    ->  Seq Scan on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2893                        ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2894                              Index Cond: (c1 = b2t3.c1)
2895    InitPlan 3 (returns $5)
2896      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2897            Merge Cond: (b3t1.c1 = b3t2.c1)
2898            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2899            ->  Sort  (cost=xxx rows=100 width=xxx)
2900                  Sort Key: b3t2.c1
2901                  ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2902                        ->  Hash Join  (cost=xxx rows=1130 width=xxx)
2903                              Hash Cond: (b3t3.c1 = b3t4.c1)
2904                              ->  Seq Scan on t3 b3t3  (cost=xxx rows=1130 width=xxx)
2905                              ->  Hash  (cost=xxx rows=1130 width=xxx)
2906                                    ->  Seq Scan on t4 b3t4  (cost=xxx rows=1130 width=xxx)
2907                        ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=xxx)
2908                              Index Cond: (c1 = b3t3.c1)
2909    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
2910          Filter: (c1 <> $5)
2911    ->  Sort  (cost=xxx rows=100 width=xxx)
2912          Sort Key: bmt2.c1
2913          ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2914                ->  Hash Join  (cost=xxx rows=100 width=xxx)
2915                      Hash Cond: (bmt3.c1 = bmt4.c1)
2916                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2917                      ->  Hash  (cost=xxx rows=100 width=xxx)
2918                            ->  Merge Join  (cost=xxx rows=100 width=xxx)
2919                                  Merge Cond: (bmt4.c1 = c1.c1)
2920                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
2921                                  ->  Sort  (cost=xxx rows=100 width=xxx)
2922                                        Sort Key: c1.c1
2923                                        ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
2924                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
2925                      Index Cond: (c1 = bmt3.c1)
2926 (61 rows)
2927
2928 \o results/ut-R.tmpout
2929 /*+
2930 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2931 Leading(b1t4 b1t3 b1t2 b1t1) 
2932 Leading(b2t4 b2t3 b2t2 b2t1)
2933 Leading(b3t4 b3t3 b3t2 b3t1)
2934 MergeJoin(c1 bmt4)
2935 HashJoin(c1 bmt4 bmt3)
2936 NestLoop(c1 bmt4 bmt3 bmt2)
2937 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
2938 HashJoin(b1t4 b1t3)
2939 NestLoop(b1t4 b1t3 b1t2)
2940 MergeJoin(b1t4 b1t3 b1t2 b1t1)
2941 HashJoin(b2t4 b2t3)
2942 NestLoop(b2t4 b2t3 b2t2)
2943 MergeJoin(b2t4 b2t3 b2t2 b2t1)
2944 HashJoin(b3t4 b3t3)
2945 NestLoop(b3t4 b3t3 b3t2)
2946 MergeJoin(b3t4 b3t3 b3t2 b3t1)
2947 Rows(c1 bmt4 #1)
2948 Rows(c1 bmt4 bmt3 #1)
2949 Rows(c1 bmt4 bmt3 bmt2 #1)
2950 Rows(c1 bmt4 bmt3 bmt2 bmt1 #1)
2951 Rows(b1t4 b1t3 #1)
2952 Rows(b1t4 b1t3 b1t2 #1)
2953 Rows(b1t4 b1t3 b1t2 b1t1 #1)
2954 Rows(b2t4 b2t3 #1)
2955 Rows(b2t4 b2t3 b2t2 #1)
2956 Rows(b2t4 b2t3 b2t2 b2t1 #1)
2957 Rows(b3t4 b3t3 #1)
2958 Rows(b3t4 b3t3 b3t2 #1)
2959 Rows(b3t4 b3t3 b3t2 b3t1 #1)
2960 */
2961 EXPLAIN
2962 WITH c1 (c1) AS (
2963 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
2964 )
2965 SELECT bmt1.c1, (
2966 SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
2967 )
2968                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
2969 AND bmt1.c1 <> (
2970 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
2971 );
2972 LOG:  pg_hint_plan:
2973 used hint:
2974 HashJoin(b1t3 b1t4)
2975 HashJoin(b2t3 b2t4)
2976 HashJoin(b3t3 b3t4)
2977 MergeJoin(bmt4 c1)
2978 NestLoop(b1t2 b1t3 b1t4)
2979 NestLoop(b2t2 b2t3 b2t4)
2980 NestLoop(b3t2 b3t3 b3t4)
2981 HashJoin(bmt3 bmt4 c1)
2982 MergeJoin(b1t1 b1t2 b1t3 b1t4)
2983 MergeJoin(b2t1 b2t2 b2t3 b2t4)
2984 MergeJoin(b3t1 b3t2 b3t3 b3t4)
2985 NestLoop(bmt2 bmt3 bmt4 c1)
2986 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
2987 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2988 Leading(b1t4 b1t3 b1t2 b1t1)
2989 Leading(b2t4 b2t3 b2t2 b2t1)
2990 Leading(b3t4 b3t3 b3t2 b3t1)
2991 Rows(b1t3 b1t4 #1)
2992 Rows(b2t3 b2t4 #1)
2993 Rows(b3t3 b3t4 #1)
2994 Rows(bmt4 c1 #1)
2995 Rows(b1t2 b1t3 b1t4 #1)
2996 Rows(b2t2 b2t3 b2t4 #1)
2997 Rows(b3t2 b3t3 b3t4 #1)
2998 Rows(bmt3 bmt4 c1 #1)
2999 Rows(b1t1 b1t2 b1t3 b1t4 #1)
3000 Rows(b2t1 b2t2 b2t3 b2t4 #1)
3001 Rows(b3t1 b3t2 b3t3 b3t4 #1)
3002 Rows(bmt2 bmt3 bmt4 c1 #1)
3003 Rows(bmt1 bmt2 bmt3 bmt4 c1 #1)
3004 not used hint:
3005 duplication hint:
3006 error hint:
3007
3008 \o
3009 \! sql/maskout.sh results/ut-R.tmpout
3010                                                     QUERY PLAN                                                    
3011 ------------------------------------------------------------------------------------------------------------------
3012  Merge Join  (cost=xxx rows=1 width=xxx)
3013    Merge Cond: (bmt1.c1 = bmt2.c1)
3014    CTE c1
3015      ->  Merge Join  (cost=xxx rows=1 width=xxx)
3016            Merge Cond: (b1t1.c1 = b1t2.c1)
3017            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
3018            ->  Sort  (cost=xxx rows=1 width=xxx)
3019                  Sort Key: b1t2.c1
3020                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3021                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
3022                              Hash Cond: (b1t3.c1 = b1t4.c1)
3023                              ->  Seq Scan on t3 b1t3  (cost=xxx rows=1130 width=xxx)
3024                              ->  Hash  (cost=xxx rows=1130 width=xxx)
3025                                    ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
3026                        ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=xxx)
3027                              Index Cond: (c1 = b1t3.c1)
3028    InitPlan 2 (returns $3)
3029      ->  Merge Join  (cost=xxx rows=1 width=xxx)
3030            Merge Cond: (b2t1.c1 = b2t2.c1)
3031            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
3032            ->  Sort  (cost=xxx rows=1 width=xxx)
3033                  Sort Key: b2t2.c1
3034                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3035                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
3036                              Hash Cond: (b2t3.c1 = b2t4.c1)
3037                              ->  Seq Scan on t3 b2t3  (cost=xxx rows=1130 width=xxx)
3038                              ->  Hash  (cost=xxx rows=1130 width=xxx)
3039                                    ->  Seq Scan on t4 b2t4  (cost=xxx rows=1130 width=xxx)
3040                        ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
3041                              Index Cond: (c1 = b2t3.c1)
3042    InitPlan 3 (returns $5)
3043      ->  Merge Join  (cost=xxx rows=1 width=xxx)
3044            Merge Cond: (b3t1.c1 = b3t2.c1)
3045            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
3046            ->  Sort  (cost=xxx rows=1 width=xxx)
3047                  Sort Key: b3t2.c1
3048                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3049                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
3050                              Hash Cond: (b3t3.c1 = b3t4.c1)
3051                              ->  Seq Scan on t3 b3t3  (cost=xxx rows=1130 width=xxx)
3052                              ->  Hash  (cost=xxx rows=1130 width=xxx)
3053                                    ->  Seq Scan on t4 b3t4  (cost=xxx rows=1130 width=xxx)
3054                        ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=xxx)
3055                              Index Cond: (c1 = b3t3.c1)
3056    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
3057          Filter: (c1 <> $5)
3058    ->  Sort  (cost=xxx rows=1 width=xxx)
3059          Sort Key: bmt2.c1
3060          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3061                ->  Hash Join  (cost=xxx rows=1 width=xxx)
3062                      Hash Cond: (bmt3.c1 = bmt4.c1)
3063                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
3064                      ->  Hash  (cost=xxx rows=1 width=xxx)
3065                            ->  Merge Join  (cost=xxx rows=1 width=xxx)
3066                                  Merge Cond: (bmt4.c1 = c1.c1)
3067                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
3068                                  ->  Sort  (cost=xxx rows=1 width=xxx)
3069                                        Sort Key: c1.c1
3070                                        ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
3071                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
3072                      Index Cond: (c1 = bmt3.c1)
3073 (61 rows)
3074
3075 -- No. R-2-2-4
3076 \o results/ut-R.tmpout
3077 /*+
3078 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3079 Leading(b1t4 b1t3 b1t2 b1t1)
3080 MergeJoin(c1 bmt4)
3081 HashJoin(c1 bmt4 bmt3)
3082 NestLoop(c1 bmt4 bmt3 bmt2)
3083 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
3084 MergeJoin(b1t4 b1t3)
3085 HashJoin(b1t4 b1t3 b1t2)
3086 NestLoop(b1t4 b1t3 b1t2 b1t1)
3087 */
3088 EXPLAIN
3089 WITH c1 (c1) AS (
3090 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
3091 )
3092 SELECT bmt1.c1, (
3093 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
3094 )
3095                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
3096 AND bmt1.c1 <> (
3097 SELECT b3t1.c1 FROM s1.t1 b3t1
3098 );
3099 LOG:  pg_hint_plan:
3100 used hint:
3101 MergeJoin(b1t3 b1t4)
3102 MergeJoin(bmt4 c1)
3103 HashJoin(b1t2 b1t3 b1t4)
3104 HashJoin(bmt3 bmt4 c1)
3105 NestLoop(b1t1 b1t2 b1t3 b1t4)
3106 NestLoop(bmt2 bmt3 bmt4 c1)
3107 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
3108 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3109 Leading(b1t4 b1t3 b1t2 b1t1)
3110 not used hint:
3111 duplication hint:
3112 error hint:
3113
3114 \o
3115 \! sql/maskout.sh results/ut-R.tmpout
3116                                                     QUERY PLAN                                                    
3117 ------------------------------------------------------------------------------------------------------------------
3118  Merge Join  (cost=xxx rows=10 width=xxx)
3119    Merge Cond: (bmt1.c1 = bmt2.c1)
3120    CTE c1
3121      ->  Nested Loop  (cost=xxx rows=100 width=xxx)
3122            Join Filter: (b1t2.c1 = b1t1.c1)
3123            ->  Hash Join  (cost=xxx rows=100 width=xxx)
3124                  Hash Cond: (b1t3.c1 = b1t2.c1)
3125                  ->  Merge Join  (cost=xxx rows=1130 width=xxx)
3126                        Merge Cond: (b1t3.c1 = b1t4.c1)
3127                        ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
3128                        ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1130 width=xxx)
3129                  ->  Hash  (cost=xxx rows=100 width=xxx)
3130                        ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
3131            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3132                  Index Cond: (c1 = b1t3.c1)
3133    InitPlan 2 (returns $2)
3134      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3135            Index Cond: (c1 = 1)
3136    InitPlan 3 (returns $3)
3137      ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=xxx)
3138    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
3139          Filter: (c1 <> $3)
3140    ->  Sort  (cost=xxx rows=100 width=xxx)
3141          Sort Key: bmt2.c1
3142          ->  Nested Loop  (cost=xxx rows=100 width=xxx)
3143                ->  Hash Join  (cost=xxx rows=100 width=xxx)
3144                      Hash Cond: (bmt3.c1 = bmt4.c1)
3145                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
3146                      ->  Hash  (cost=xxx rows=100 width=xxx)
3147                            ->  Merge Join  (cost=xxx rows=100 width=xxx)
3148                                  Merge Cond: (bmt4.c1 = c1.c1)
3149                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
3150                                  ->  Sort  (cost=xxx rows=100 width=xxx)
3151                                        Sort Key: c1.c1
3152                                        ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
3153                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
3154                      Index Cond: (c1 = bmt3.c1)
3155 (37 rows)
3156
3157 \o results/ut-R.tmpout
3158 /*+
3159 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3160 Leading(b1t4 b1t3 b1t2 b1t1)
3161 MergeJoin(c1 bmt4)
3162 HashJoin(c1 bmt4 bmt3)
3163 NestLoop(c1 bmt4 bmt3 bmt2)
3164 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
3165 MergeJoin(b1t4 b1t3)
3166 HashJoin(b1t4 b1t3 b1t2)
3167 NestLoop(b1t4 b1t3 b1t2 b1t1)
3168 Rows(c1 bmt4 #1)
3169 Rows(c1 bmt4 bmt3 #1)
3170 Rows(c1 bmt4 bmt3 bmt2 #1)
3171 Rows(c1 bmt4 bmt3 bmt2 bmt1 #1)
3172 Rows(b1t4 b1t3 #1)
3173 Rows(b1t4 b1t3 b1t2 #1)
3174 Rows(b1t4 b1t3 b1t2 b1t1 #1)
3175 */
3176 EXPLAIN
3177 WITH c1 (c1) AS (
3178 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
3179 )
3180 SELECT bmt1.c1, (
3181 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
3182 )
3183                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
3184 AND bmt1.c1 <> (
3185 SELECT b3t1.c1 FROM s1.t1 b3t1
3186 );
3187 LOG:  pg_hint_plan:
3188 used hint:
3189 MergeJoin(b1t3 b1t4)
3190 MergeJoin(bmt4 c1)
3191 HashJoin(b1t2 b1t3 b1t4)
3192 HashJoin(bmt3 bmt4 c1)
3193 NestLoop(b1t1 b1t2 b1t3 b1t4)
3194 NestLoop(bmt2 bmt3 bmt4 c1)
3195 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
3196 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3197 Leading(b1t4 b1t3 b1t2 b1t1)
3198 Rows(b1t3 b1t4 #1)
3199 Rows(bmt4 c1 #1)
3200 Rows(b1t2 b1t3 b1t4 #1)
3201 Rows(bmt3 bmt4 c1 #1)
3202 Rows(b1t1 b1t2 b1t3 b1t4 #1)
3203 Rows(bmt2 bmt3 bmt4 c1 #1)
3204 Rows(bmt1 bmt2 bmt3 bmt4 c1 #1)
3205 not used hint:
3206 duplication hint:
3207 error hint:
3208
3209 \o
3210 \! sql/maskout.sh results/ut-R.tmpout
3211                                                     QUERY PLAN                                                    
3212 ------------------------------------------------------------------------------------------------------------------
3213  Merge Join  (cost=xxx rows=1 width=xxx)
3214    Merge Cond: (bmt1.c1 = bmt2.c1)
3215    CTE c1
3216      ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3217            Join Filter: (b1t2.c1 = b1t1.c1)
3218            ->  Hash Join  (cost=xxx rows=1 width=xxx)
3219                  Hash Cond: (b1t3.c1 = b1t2.c1)
3220                  ->  Merge Join  (cost=xxx rows=1 width=xxx)
3221                        Merge Cond: (b1t3.c1 = b1t4.c1)
3222                        ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
3223                        ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1130 width=xxx)
3224                  ->  Hash  (cost=xxx rows=100 width=xxx)
3225                        ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
3226            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3227                  Index Cond: (c1 = b1t3.c1)
3228    InitPlan 2 (returns $2)
3229      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3230            Index Cond: (c1 = 1)
3231    InitPlan 3 (returns $3)
3232      ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=xxx)
3233    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
3234          Filter: (c1 <> $3)
3235    ->  Sort  (cost=xxx rows=1 width=xxx)
3236          Sort Key: bmt2.c1
3237          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3238                ->  Hash Join  (cost=xxx rows=1 width=xxx)
3239                      Hash Cond: (bmt3.c1 = bmt4.c1)
3240                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
3241                      ->  Hash  (cost=xxx rows=1 width=xxx)
3242                            ->  Merge Join  (cost=xxx rows=1 width=xxx)
3243                                  Merge Cond: (bmt4.c1 = c1.c1)
3244                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
3245                                  ->  Sort  (cost=xxx rows=1 width=xxx)
3246                                        Sort Key: c1.c1
3247                                        ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
3248                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
3249                      Index Cond: (c1 = bmt3.c1)
3250 (37 rows)
3251
3252 ----
3253 ---- No. R-2-3 RULE or VIEW
3254 ----
3255 -- No. R-2-3-1
3256 \o results/ut-R.tmpout
3257 /*+
3258 Leading(r1 t1 t2 t3 t4)
3259 */
3260 EXPLAIN UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1;
3261 LOG:  pg_hint_plan:
3262 used hint:
3263 Leading(r1 t1 t2 t3 t4)
3264 not used hint:
3265 duplication hint:
3266 error hint:
3267
3268 \o
3269 \! sql/maskout.sh results/ut-R.tmpout
3270                                           QUERY PLAN                                           
3271 -----------------------------------------------------------------------------------------------
3272  Aggregate  (cost=xxx rows=1 width=xxx)
3273    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3274          Join Filter: (t1.c1 = t4.c1)
3275          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3276                TID Cond: (ctid = '(1,1)'::tid)
3277          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3278                Join Filter: (t1.c1 = t3.c1)
3279                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3280                      Merge Cond: (t1.c1 = t2.c1)
3281                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3282                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3283                                  Filter: (ctid = '(1,1)'::tid)
3284                            ->  Seq Scan on r1  (cost=xxx rows=6 width=xxx)
3285                                  Filter: (c1 = 1)
3286                      ->  Sort  (cost=xxx rows=1 width=xxx)
3287                            Sort Key: t2.c1
3288                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3289                                  Filter: (ctid = '(1,1)'::tid)
3290                ->  Materialize  (cost=xxx rows=1 width=xxx)
3291                      ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3292                            TID Cond: (ctid = '(1,1)'::tid)
3293 (21 rows)
3294
3295 \o results/ut-R.tmpout
3296 /*+
3297 Leading(r1 t1 t2 t3 t4)
3298 Rows(r1 t1 t2 t3 t4 #2)
3299 Rows(r1 t1 t2 t3 #2)
3300 Rows(r1 t1 t2 #2)
3301 Rows(r1 t1 #2)
3302 */
3303 EXPLAIN UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1;
3304 LOG:  pg_hint_plan:
3305 used hint:
3306 Leading(r1 t1 t2 t3 t4)
3307 Rows(r1 t1 #2)
3308 Rows(r1 t1 t2 #2)
3309 Rows(r1 t1 t2 t3 #2)
3310 Rows(r1 t1 t2 t3 t4 #2)
3311 not used hint:
3312 duplication hint:
3313 error hint:
3314
3315 \o
3316 \! sql/maskout.sh results/ut-R.tmpout
3317                                    QUERY PLAN                                    
3318 ---------------------------------------------------------------------------------
3319  Aggregate  (cost=xxx rows=1 width=xxx)
3320    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3321          Join Filter: (t1.c1 = t4.c1)
3322          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3323                TID Cond: (ctid = '(1,1)'::tid)
3324          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3325                Join Filter: (t1.c1 = t3.c1)
3326                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3327                      TID Cond: (ctid = '(1,1)'::tid)
3328                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3329                      Join Filter: (t1.c1 = t2.c1)
3330                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3331                            Filter: (ctid = '(1,1)'::tid)
3332                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3333                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3334                                  TID Cond: (ctid = '(1,1)'::tid)
3335                            ->  Seq Scan on r1  (cost=xxx rows=6 width=xxx)
3336                                  Filter: (c1 = 1)
3337 (18 rows)
3338
3339 \o results/ut-R.tmpout
3340 /*+
3341 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
3342 */
3343 EXPLAIN UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1;
3344 LOG:  pg_hint_plan:
3345 used hint:
3346 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
3347 not used hint:
3348 duplication hint:
3349 error hint:
3350
3351 \o
3352 \! sql/maskout.sh results/ut-R.tmpout
3353                                              QUERY PLAN                                             
3354 ----------------------------------------------------------------------------------------------------
3355  Aggregate  (cost=xxx rows=1 width=xxx)
3356    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3357          Join Filter: (b1t1.c1 = b1t4.c1)
3358          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3359                TID Cond: (ctid = '(1,1)'::tid)
3360          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3361                Join Filter: (b1t1.c1 = b1t3.c1)
3362                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3363                      Merge Cond: (b1t1.c1 = b1t2.c1)
3364                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3365                            ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3366                                  Filter: (ctid = '(1,1)'::tid)
3367                            ->  Seq Scan on r1_  (cost=xxx rows=6 width=xxx)
3368                                  Filter: (c1 = 1)
3369                      ->  Sort  (cost=xxx rows=1 width=xxx)
3370                            Sort Key: b1t2.c1
3371                            ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3372                                  Filter: (ctid = '(1,1)'::tid)
3373                ->  Materialize  (cost=xxx rows=1 width=xxx)
3374                      ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3375                            TID Cond: (ctid = '(1,1)'::tid)
3376 (21 rows)
3377
3378 \o results/ut-R.tmpout
3379 /*+
3380 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
3381 Rows(r1_ b1t1 b1t2 b1t3 b1t4 #2)
3382 Rows(r1_ b1t1 b1t2 b1t3 #2)
3383 Rows(r1_ b1t1 b1t2 #2)
3384 Rows(r1_ b1t1 #2)
3385 */
3386 EXPLAIN UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1;
3387 LOG:  pg_hint_plan:
3388 used hint:
3389 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
3390 Rows(b1t1 r1_ #2)
3391 Rows(b1t1 b1t2 r1_ #2)
3392 Rows(b1t1 b1t2 b1t3 r1_ #2)
3393 Rows(b1t1 b1t2 b1t3 b1t4 r1_ #2)
3394 not used hint:
3395 duplication hint:
3396 error hint:
3397
3398 \o
3399 \! sql/maskout.sh results/ut-R.tmpout
3400                                      QUERY PLAN                                      
3401 -------------------------------------------------------------------------------------
3402  Aggregate  (cost=xxx rows=1 width=xxx)
3403    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3404          Join Filter: (b1t1.c1 = b1t4.c1)
3405          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3406                TID Cond: (ctid = '(1,1)'::tid)
3407          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3408                Join Filter: (b1t1.c1 = b1t3.c1)
3409                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3410                      TID Cond: (ctid = '(1,1)'::tid)
3411                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3412                      Join Filter: (b1t1.c1 = b1t2.c1)
3413                      ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3414                            Filter: (ctid = '(1,1)'::tid)
3415                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3416                            ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
3417                                  TID Cond: (ctid = '(1,1)'::tid)
3418                            ->  Seq Scan on r1_  (cost=xxx rows=6 width=xxx)
3419                                  Filter: (c1 = 1)
3420 (18 rows)
3421
3422 -- No. R-2-3-2
3423 \o results/ut-R.tmpout
3424 /*+
3425 Leading(r2 t1 t2 t3 t4)
3426 */
3427 EXPLAIN UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1;
3428 LOG:  pg_hint_plan:
3429 used hint:
3430 Leading(r2 t1 t2 t3 t4)
3431 not used hint:
3432 duplication hint:
3433 error hint:
3434
3435 LOG:  pg_hint_plan:
3436 used hint:
3437 Leading(r2 t1 t2 t3 t4)
3438 not used hint:
3439 duplication hint:
3440 error hint:
3441
3442 \o
3443 \! sql/maskout.sh results/ut-R.tmpout
3444                                           QUERY PLAN                                           
3445 -----------------------------------------------------------------------------------------------
3446  Aggregate  (cost=xxx rows=1 width=xxx)
3447    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3448          Join Filter: (t1.c1 = t4.c1)
3449          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3450                TID Cond: (ctid = '(1,1)'::tid)
3451          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3452                Join Filter: (t1.c1 = t3.c1)
3453                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3454                      Merge Cond: (t1.c1 = t2.c1)
3455                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3456                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3457                                  Filter: (ctid = '(1,1)'::tid)
3458                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3459                                  Filter: (c1 = 1)
3460                      ->  Sort  (cost=xxx rows=1 width=xxx)
3461                            Sort Key: t2.c1
3462                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3463                                  Filter: (ctid = '(1,1)'::tid)
3464                ->  Materialize  (cost=xxx rows=1 width=xxx)
3465                      ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3466                            TID Cond: (ctid = '(1,1)'::tid)
3467  
3468  Aggregate  (cost=xxx rows=1 width=xxx)
3469    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3470          Join Filter: (t1.c1 = t4.c1)
3471          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3472                TID Cond: (ctid = '(1,1)'::tid)
3473          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3474                Join Filter: (t1.c1 = t3.c1)
3475                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3476                      Merge Cond: (t1.c1 = t2.c1)
3477                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3478                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3479                                  Filter: (ctid = '(1,1)'::tid)
3480                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3481                                  Filter: (c1 = 1)
3482                      ->  Sort  (cost=xxx rows=1 width=xxx)
3483                            Sort Key: t2.c1
3484                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3485                                  Filter: (ctid = '(1,1)'::tid)
3486                ->  Materialize  (cost=xxx rows=1 width=xxx)
3487                      ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3488                            TID Cond: (ctid = '(1,1)'::tid)
3489 (43 rows)
3490
3491 \o results/ut-R.tmpout
3492 /*+
3493 Leading(r2 t1 t2 t3 t4)
3494 Rows(r2 t1 t2 t3 t4 #2)
3495 Rows(r2 t1 t2 t3 #2)
3496 Rows(r2 t1 t2 #2)
3497 Rows(r2 t1 #2)
3498 */
3499 EXPLAIN UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1;
3500 LOG:  pg_hint_plan:
3501 used hint:
3502 Leading(r2 t1 t2 t3 t4)
3503 Rows(r2 t1 #2)
3504 Rows(r2 t1 t2 #2)
3505 Rows(r2 t1 t2 t3 #2)
3506 Rows(r2 t1 t2 t3 t4 #2)
3507 not used hint:
3508 duplication hint:
3509 error hint:
3510
3511 LOG:  pg_hint_plan:
3512 used hint:
3513 Leading(r2 t1 t2 t3 t4)
3514 Rows(r2 t1 #2)
3515 Rows(r2 t1 t2 #2)
3516 Rows(r2 t1 t2 t3 #2)
3517 Rows(r2 t1 t2 t3 t4 #2)
3518 not used hint:
3519 duplication hint:
3520 error hint:
3521
3522 \o
3523 \! sql/maskout.sh results/ut-R.tmpout
3524                                    QUERY PLAN                                    
3525 ---------------------------------------------------------------------------------
3526  Aggregate  (cost=xxx rows=1 width=xxx)
3527    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3528          Join Filter: (t1.c1 = t4.c1)
3529          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3530                TID Cond: (ctid = '(1,1)'::tid)
3531          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3532                Join Filter: (t1.c1 = t3.c1)
3533                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3534                      TID Cond: (ctid = '(1,1)'::tid)
3535                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3536                      Join Filter: (t1.c1 = t2.c1)
3537                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3538                            Filter: (ctid = '(1,1)'::tid)
3539                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3540                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3541                                  TID Cond: (ctid = '(1,1)'::tid)
3542                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3543                                  Filter: (c1 = 1)
3544  
3545  Aggregate  (cost=xxx rows=1 width=xxx)
3546    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3547          Join Filter: (t1.c1 = t4.c1)
3548          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3549                TID Cond: (ctid = '(1,1)'::tid)
3550          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3551                Join Filter: (t1.c1 = t3.c1)
3552                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3553                      TID Cond: (ctid = '(1,1)'::tid)
3554                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3555                      Join Filter: (t1.c1 = t2.c1)
3556                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3557                            Filter: (ctid = '(1,1)'::tid)
3558                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3559                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3560                                  TID Cond: (ctid = '(1,1)'::tid)
3561                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3562                                  Filter: (c1 = 1)
3563 (37 rows)
3564
3565 \o results/ut-R.tmpout
3566 /*+
3567 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3568 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3569 */
3570 EXPLAIN UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1;
3571 LOG:  pg_hint_plan:
3572 used hint:
3573 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3574 not used hint:
3575 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3576 duplication hint:
3577 error hint:
3578
3579 LOG:  pg_hint_plan:
3580 used hint:
3581 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3582 not used hint:
3583 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3584 duplication hint:
3585 error hint:
3586
3587 \o
3588 \! sql/maskout.sh results/ut-R.tmpout
3589                                              QUERY PLAN                                             
3590 ----------------------------------------------------------------------------------------------------
3591  Aggregate  (cost=xxx rows=1 width=xxx)
3592    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3593          Join Filter: (b1t1.c1 = b1t4.c1)
3594          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3595                TID Cond: (ctid = '(1,1)'::tid)
3596          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3597                Join Filter: (b1t1.c1 = b1t3.c1)
3598                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3599                      Merge Cond: (b1t1.c1 = b1t2.c1)
3600                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3601                            ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3602                                  Filter: (ctid = '(1,1)'::tid)
3603                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3604                                  Filter: (c1 = 1)
3605                      ->  Sort  (cost=xxx rows=1 width=xxx)
3606                            Sort Key: b1t2.c1
3607                            ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3608                                  Filter: (ctid = '(1,1)'::tid)
3609                ->  Materialize  (cost=xxx rows=1 width=xxx)
3610                      ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3611                            TID Cond: (ctid = '(1,1)'::tid)
3612  
3613  Aggregate  (cost=xxx rows=1 width=xxx)
3614    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3615          Join Filter: (b2t1.c1 = b2t4.c1)
3616          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
3617                TID Cond: (ctid = '(1,1)'::tid)
3618          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3619                Join Filter: (b2t1.c1 = b2t3.c1)
3620                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3621                      Merge Cond: (b2t1.c1 = b2t2.c1)
3622                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3623                            ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3624                                  Filter: (ctid = '(1,1)'::tid)
3625                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3626                                  Filter: (c1 = 1)
3627                      ->  Sort  (cost=xxx rows=1 width=xxx)
3628                            Sort Key: b2t2.c1
3629                            ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
3630                                  Filter: (ctid = '(1,1)'::tid)
3631                ->  Materialize  (cost=xxx rows=1 width=xxx)
3632                      ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
3633                            TID Cond: (ctid = '(1,1)'::tid)
3634 (43 rows)
3635
3636 \o results/ut-R.tmpout
3637 /*+
3638 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3639 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3640 Rows(r2_ b1t1 #2)
3641 Rows(r2_ b1t1 b1t2 #2)
3642 Rows(r2_ b1t1 b1t2 b1t3 #2)
3643 Rows(r2_ b1t1 b1t2 b1t3 b1t4 #2)
3644 Rows(r2_ b2t1 #2)
3645 Rows(r2_ b2t1 b2t2 #2)
3646 Rows(r2_ b2t1 b2t2 b2t3  #2)
3647 Rows(r2_ b2t1 b2t2 b2t3 b2t4 #2)
3648 */
3649 EXPLAIN UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1;
3650 LOG:  pg_hint_plan:
3651 used hint:
3652 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3653 Rows(b1t1 r2_ #2)
3654 Rows(b1t1 b1t2 r2_ #2)
3655 Rows(b1t1 b1t2 b1t3 r2_ #2)
3656 Rows(b1t1 b1t2 b1t3 b1t4 r2_ #2)
3657 not used hint:
3658 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3659 Rows(b2t1 r2_ #2)
3660 Rows(b2t1 b2t2 r2_ #2)
3661 Rows(b2t1 b2t2 b2t3 r2_ #2)
3662 Rows(b2t1 b2t2 b2t3 b2t4 r2_ #2)
3663 duplication hint:
3664 error hint:
3665
3666 LOG:  pg_hint_plan:
3667 used hint:
3668 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3669 Rows(b2t1 r2_ #2)
3670 Rows(b2t1 b2t2 r2_ #2)
3671 Rows(b2t1 b2t2 b2t3 r2_ #2)
3672 Rows(b2t1 b2t2 b2t3 b2t4 r2_ #2)
3673 not used hint:
3674 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3675 Rows(b1t1 r2_ #2)
3676 Rows(b1t1 b1t2 r2_ #2)
3677 Rows(b1t1 b1t2 b1t3 r2_ #2)
3678 Rows(b1t1 b1t2 b1t3 b1t4 r2_ #2)
3679 duplication hint:
3680 error hint:
3681
3682 \o
3683 \! sql/maskout.sh results/ut-R.tmpout
3684                                      QUERY PLAN                                      
3685 -------------------------------------------------------------------------------------
3686  Aggregate  (cost=xxx rows=1 width=xxx)
3687    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3688          Join Filter: (b1t1.c1 = b1t4.c1)
3689          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3690                TID Cond: (ctid = '(1,1)'::tid)
3691          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3692                Join Filter: (b1t1.c1 = b1t3.c1)
3693                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3694                      TID Cond: (ctid = '(1,1)'::tid)
3695                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3696                      Join Filter: (b1t1.c1 = b1t2.c1)
3697                      ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3698                            Filter: (ctid = '(1,1)'::tid)
3699                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3700                            ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
3701                                  TID Cond: (ctid = '(1,1)'::tid)
3702                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3703                                  Filter: (c1 = 1)
3704  
3705  Aggregate  (cost=xxx rows=1 width=xxx)
3706    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3707          Join Filter: (b2t1.c1 = b2t4.c1)
3708          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
3709                TID Cond: (ctid = '(1,1)'::tid)
3710          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3711                Join Filter: (b2t1.c1 = b2t3.c1)
3712                ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
3713                      TID Cond: (ctid = '(1,1)'::tid)
3714                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3715                      Join Filter: (b2t1.c1 = b2t2.c1)
3716                      ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
3717                            Filter: (ctid = '(1,1)'::tid)
3718                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3719                            ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=xxx)
3720                                  TID Cond: (ctid = '(1,1)'::tid)
3721                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3722                                  Filter: (c1 = 1)
3723 (37 rows)
3724
3725 -- No. R-2-3-3
3726 \o results/ut-R.tmpout
3727 /*+
3728 Leading(r3 t1 t2 t3 t4)
3729 */
3730 EXPLAIN UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1;
3731 LOG:  pg_hint_plan:
3732 used hint:
3733 Leading(r3 t1 t2 t3 t4)
3734 not used hint:
3735 duplication hint:
3736 error hint:
3737
3738 LOG:  pg_hint_plan:
3739 used hint:
3740 Leading(r3 t1 t2 t3 t4)
3741 not used hint:
3742 duplication hint:
3743 error hint:
3744
3745 LOG:  pg_hint_plan:
3746 used hint:
3747 Leading(r3 t1 t2 t3 t4)
3748 not used hint:
3749 duplication hint:
3750 error hint:
3751
3752 \o
3753 \! sql/maskout.sh results/ut-R.tmpout
3754                                           QUERY PLAN                                           
3755 -----------------------------------------------------------------------------------------------
3756  Aggregate  (cost=xxx rows=1 width=xxx)
3757    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3758          Join Filter: (t1.c1 = t4.c1)
3759          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3760                TID Cond: (ctid = '(1,1)'::tid)
3761          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3762                Join Filter: (t1.c1 = t3.c1)
3763                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3764                      Merge Cond: (t1.c1 = t2.c1)
3765                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3766                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3767                                  Filter: (ctid = '(1,1)'::tid)
3768                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3769                                  Filter: (c1 = 1)
3770                      ->  Sort  (cost=xxx rows=1 width=xxx)
3771                            Sort Key: t2.c1
3772                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3773                                  Filter: (ctid = '(1,1)'::tid)
3774                ->  Materialize  (cost=xxx rows=1 width=xxx)
3775                      ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3776                            TID Cond: (ctid = '(1,1)'::tid)
3777  
3778  Aggregate  (cost=xxx rows=1 width=xxx)
3779    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3780          Join Filter: (t1.c1 = t4.c1)
3781          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3782                TID Cond: (ctid = '(1,1)'::tid)
3783          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3784                Join Filter: (t1.c1 = t3.c1)
3785                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3786                      Merge Cond: (t1.c1 = t2.c1)
3787                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3788                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3789                                  Filter: (ctid = '(1,1)'::tid)
3790                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3791                                  Filter: (c1 = 1)
3792                      ->  Sort  (cost=xxx rows=1 width=xxx)
3793                            Sort Key: t2.c1
3794                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3795                                  Filter: (ctid = '(1,1)'::tid)
3796                ->  Materialize  (cost=xxx rows=1 width=xxx)
3797                      ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3798                            TID Cond: (ctid = '(1,1)'::tid)
3799  
3800  Aggregate  (cost=xxx rows=1 width=xxx)
3801    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3802          Join Filter: (t1.c1 = t4.c1)
3803          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3804                TID Cond: (ctid = '(1,1)'::tid)
3805          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3806                Join Filter: (t1.c1 = t3.c1)
3807                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3808                      Merge Cond: (t1.c1 = t2.c1)
3809                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3810                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3811                                  Filter: (ctid = '(1,1)'::tid)
3812                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3813                                  Filter: (c1 = 1)
3814                      ->  Sort  (cost=xxx rows=1 width=xxx)
3815                            Sort Key: t2.c1
3816                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3817                                  Filter: (ctid = '(1,1)'::tid)
3818                ->  Materialize  (cost=xxx rows=1 width=xxx)
3819                      ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3820                            TID Cond: (ctid = '(1,1)'::tid)
3821 (65 rows)
3822
3823 \o results/ut-R.tmpout
3824 /*+
3825 Leading(r3 t1 t2 t3 t4)
3826 Rows(r3 t1 t2 t3 t4 #2)
3827 Rows(r3 t1 t2 t3 #2)
3828 Rows(r3 t1 t2 #2)
3829 Rows(r3 t1 #2)
3830 */
3831 EXPLAIN UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1;
3832 LOG:  pg_hint_plan:
3833 used hint:
3834 Leading(r3 t1 t2 t3 t4)
3835 Rows(r3 t1 #2)
3836 Rows(r3 t1 t2 #2)
3837 Rows(r3 t1 t2 t3 #2)
3838 Rows(r3 t1 t2 t3 t4 #2)
3839 not used hint:
3840 duplication hint:
3841 error hint:
3842
3843 LOG:  pg_hint_plan:
3844 used hint:
3845 Leading(r3 t1 t2 t3 t4)
3846 Rows(r3 t1 #2)
3847 Rows(r3 t1 t2 #2)
3848 Rows(r3 t1 t2 t3 #2)
3849 Rows(r3 t1 t2 t3 t4 #2)
3850 not used hint:
3851 duplication hint:
3852 error hint:
3853
3854 LOG:  pg_hint_plan:
3855 used hint:
3856 Leading(r3 t1 t2 t3 t4)
3857 Rows(r3 t1 #2)
3858 Rows(r3 t1 t2 #2)
3859 Rows(r3 t1 t2 t3 #2)
3860 Rows(r3 t1 t2 t3 t4 #2)
3861 not used hint:
3862 duplication hint:
3863 error hint:
3864
3865 \o
3866 \! sql/maskout.sh results/ut-R.tmpout
3867                                    QUERY PLAN                                    
3868 ---------------------------------------------------------------------------------
3869  Aggregate  (cost=xxx rows=1 width=xxx)
3870    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3871          Join Filter: (t1.c1 = t4.c1)
3872          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3873                TID Cond: (ctid = '(1,1)'::tid)
3874          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3875                Join Filter: (t1.c1 = t3.c1)
3876                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3877                      TID Cond: (ctid = '(1,1)'::tid)
3878                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3879                      Join Filter: (t1.c1 = t2.c1)
3880                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3881                            Filter: (ctid = '(1,1)'::tid)
3882                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3883                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3884                                  TID Cond: (ctid = '(1,1)'::tid)
3885                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3886                                  Filter: (c1 = 1)
3887  
3888  Aggregate  (cost=xxx rows=1 width=xxx)
3889    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3890          Join Filter: (t1.c1 = t4.c1)
3891          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3892                TID Cond: (ctid = '(1,1)'::tid)
3893          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3894                Join Filter: (t1.c1 = t3.c1)
3895                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3896                      TID Cond: (ctid = '(1,1)'::tid)
3897                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3898                      Join Filter: (t1.c1 = t2.c1)
3899                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3900                            Filter: (ctid = '(1,1)'::tid)
3901                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3902                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3903                                  TID Cond: (ctid = '(1,1)'::tid)
3904                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3905                                  Filter: (c1 = 1)
3906  
3907  Aggregate  (cost=xxx rows=1 width=xxx)
3908    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3909          Join Filter: (t1.c1 = t4.c1)
3910          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3911                TID Cond: (ctid = '(1,1)'::tid)
3912          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3913                Join Filter: (t1.c1 = t3.c1)
3914                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3915                      TID Cond: (ctid = '(1,1)'::tid)
3916                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3917                      Join Filter: (t1.c1 = t2.c1)
3918                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3919                            Filter: (ctid = '(1,1)'::tid)
3920                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3921                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3922                                  TID Cond: (ctid = '(1,1)'::tid)
3923                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3924                                  Filter: (c1 = 1)
3925 (56 rows)
3926
3927 \o results/ut-R.tmpout
3928 /*+
3929 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3930 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3931 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3932 */
3933 EXPLAIN UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1;
3934 LOG:  pg_hint_plan:
3935 used hint:
3936 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3937 not used hint:
3938 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3939 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3940 duplication hint:
3941 error hint:
3942
3943 LOG:  pg_hint_plan:
3944 used hint:
3945 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3946 not used hint:
3947 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3948 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3949 duplication hint:
3950 error hint:
3951
3952 LOG:  pg_hint_plan:
3953 used hint:
3954 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3955 not used hint:
3956 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3957 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3958 duplication hint:
3959 error hint:
3960
3961 \o
3962 \! sql/maskout.sh results/ut-R.tmpout
3963                                              QUERY PLAN                                             
3964 ----------------------------------------------------------------------------------------------------
3965  Aggregate  (cost=xxx rows=1 width=xxx)
3966    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3967          Join Filter: (b1t1.c1 = b1t4.c1)
3968          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3969                TID Cond: (ctid = '(1,1)'::tid)
3970          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3971                Join Filter: (b1t1.c1 = b1t3.c1)
3972                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3973                      Merge Cond: (b1t1.c1 = b1t2.c1)
3974                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3975                            ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3976                                  Filter: (ctid = '(1,1)'::tid)
3977                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
3978                                  Filter: (c1 = 1)
3979                      ->  Sort  (cost=xxx rows=1 width=xxx)
3980                            Sort Key: b1t2.c1
3981                            ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3982                                  Filter: (ctid = '(1,1)'::tid)
3983                ->  Materialize  (cost=xxx rows=1 width=xxx)
3984                      ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3985                            TID Cond: (ctid = '(1,1)'::tid)
3986  
3987  Aggregate  (cost=xxx rows=1 width=xxx)
3988    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3989          Join Filter: (b2t1.c1 = b2t4.c1)
3990          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
3991                TID Cond: (ctid = '(1,1)'::tid)
3992          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3993                Join Filter: (b2t1.c1 = b2t3.c1)
3994                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3995                      Merge Cond: (b2t1.c1 = b2t2.c1)
3996                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3997                            ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3998                                  Filter: (ctid = '(1,1)'::tid)
3999                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4000                                  Filter: (c1 = 1)
4001                      ->  Sort  (cost=xxx rows=1 width=xxx)
4002                            Sort Key: b2t2.c1
4003                            ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
4004                                  Filter: (ctid = '(1,1)'::tid)
4005                ->  Materialize  (cost=xxx rows=1 width=xxx)
4006                      ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
4007                            TID Cond: (ctid = '(1,1)'::tid)
4008  
4009  Aggregate  (cost=xxx rows=1 width=xxx)
4010    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4011          Join Filter: (b3t1.c1 = b3t4.c1)
4012          ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=xxx)
4013                TID Cond: (ctid = '(1,1)'::tid)
4014          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4015                Join Filter: (b3t1.c1 = b3t3.c1)
4016                ->  Merge Join  (cost=xxx rows=1 width=xxx)
4017                      Merge Cond: (b3t1.c1 = b3t2.c1)
4018                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
4019                            ->  Index Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
4020                                  Filter: (ctid = '(1,1)'::tid)
4021                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4022                                  Filter: (c1 = 1)
4023                      ->  Sort  (cost=xxx rows=1 width=xxx)
4024                            Sort Key: b3t2.c1
4025                            ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=xxx)
4026                                  Filter: (ctid = '(1,1)'::tid)
4027                ->  Materialize  (cost=xxx rows=1 width=xxx)
4028                      ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=xxx)
4029                            TID Cond: (ctid = '(1,1)'::tid)
4030 (65 rows)
4031
4032 \o results/ut-R.tmpout
4033 /*+
4034 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4035 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4036 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4037 Rows(r3_ b1t1 #2)
4038 Rows(r3_ b1t1 b1t2 #2)
4039 Rows(r3_ b1t1 b1t2 b1t3 #2)
4040 Rows(r3_ b1t1 b1t2 b1t3 b1t4 #2)
4041 Rows(r3_ b2t1 #2)
4042 Rows(r3_ b2t1 b2t2 #2)
4043 Rows(r3_ b2t1 b2t2 b2t3 #2)
4044 Rows(r3_ b2t1 b2t2 b2t3 b2t4 #2)
4045 Rows(r3_ b3t1 #2)
4046 Rows(r3_ b3t1 b3t2 #2)
4047 Rows(r3_ b3t1 b3t2 b3t3 #2)
4048 Rows(r3_ b3t1 b3t2 b3t3 b3t4 #2)
4049 */
4050 EXPLAIN UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1;
4051 LOG:  pg_hint_plan:
4052 used hint:
4053 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4054 Rows(b1t1 r3_ #2)
4055 Rows(b1t1 b1t2 r3_ #2)
4056 Rows(b1t1 b1t2 b1t3 r3_ #2)
4057 Rows(b1t1 b1t2 b1t3 b1t4 r3_ #2)
4058 not used hint:
4059 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4060 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4061 Rows(b2t1 r3_ #2)
4062 Rows(b3t1 r3_ #2)
4063 Rows(b2t1 b2t2 r3_ #2)
4064 Rows(b3t1 b3t2 r3_ #2)
4065 Rows(b2t1 b2t2 b2t3 r3_ #2)
4066 Rows(b3t1 b3t2 b3t3 r3_ #2)
4067 Rows(b2t1 b2t2 b2t3 b2t4 r3_ #2)
4068 Rows(b3t1 b3t2 b3t3 b3t4 r3_ #2)
4069 duplication hint:
4070 error hint:
4071
4072 LOG:  pg_hint_plan:
4073 used hint:
4074 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4075 Rows(b2t1 r3_ #2)
4076 Rows(b2t1 b2t2 r3_ #2)
4077 Rows(b2t1 b2t2 b2t3 r3_ #2)
4078 Rows(b2t1 b2t2 b2t3 b2t4 r3_ #2)
4079 not used hint:
4080 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4081 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4082 Rows(b1t1 r3_ #2)
4083 Rows(b3t1 r3_ #2)
4084 Rows(b1t1 b1t2 r3_ #2)
4085 Rows(b3t1 b3t2 r3_ #2)
4086 Rows(b1t1 b1t2 b1t3 r3_ #2)
4087 Rows(b3t1 b3t2 b3t3 r3_ #2)
4088 Rows(b1t1 b1t2 b1t3 b1t4 r3_ #2)
4089 Rows(b3t1 b3t2 b3t3 b3t4 r3_ #2)
4090 duplication hint:
4091 error hint:
4092
4093 LOG:  pg_hint_plan:
4094 used hint:
4095 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4096 Rows(b3t1 r3_ #2)
4097 Rows(b3t1 b3t2 r3_ #2)
4098 Rows(b3t1 b3t2 b3t3 r3_ #2)
4099 Rows(b3t1 b3t2 b3t3 b3t4 r3_ #2)
4100 not used hint:
4101 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4102 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4103 Rows(b1t1 r3_ #2)
4104 Rows(b2t1 r3_ #2)
4105 Rows(b1t1 b1t2 r3_ #2)
4106 Rows(b2t1 b2t2 r3_ #2)
4107 Rows(b1t1 b1t2 b1t3 r3_ #2)
4108 Rows(b2t1 b2t2 b2t3 r3_ #2)
4109 Rows(b1t1 b1t2 b1t3 b1t4 r3_ #2)
4110 Rows(b2t1 b2t2 b2t3 b2t4 r3_ #2)
4111 duplication hint:
4112 error hint:
4113
4114 \o
4115 \! sql/maskout.sh results/ut-R.tmpout
4116                                      QUERY PLAN                                      
4117 -------------------------------------------------------------------------------------
4118  Aggregate  (cost=xxx rows=1 width=xxx)
4119    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4120          Join Filter: (b1t1.c1 = b1t4.c1)
4121          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
4122                TID Cond: (ctid = '(1,1)'::tid)
4123          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4124                Join Filter: (b1t1.c1 = b1t3.c1)
4125                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
4126                      TID Cond: (ctid = '(1,1)'::tid)
4127                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4128                      Join Filter: (b1t1.c1 = b1t2.c1)
4129                      ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
4130                            Filter: (ctid = '(1,1)'::tid)
4131                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4132                            ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
4133                                  TID Cond: (ctid = '(1,1)'::tid)
4134                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4135                                  Filter: (c1 = 1)
4136  
4137  Aggregate  (cost=xxx rows=1 width=xxx)
4138    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4139          Join Filter: (b2t1.c1 = b2t4.c1)
4140          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
4141                TID Cond: (ctid = '(1,1)'::tid)
4142          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4143                Join Filter: (b2t1.c1 = b2t3.c1)
4144                ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
4145                      TID Cond: (ctid = '(1,1)'::tid)
4146                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4147                      Join Filter: (b2t1.c1 = b2t2.c1)
4148                      ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
4149                            Filter: (ctid = '(1,1)'::tid)
4150                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4151                            ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=xxx)
4152                                  TID Cond: (ctid = '(1,1)'::tid)
4153                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4154                                  Filter: (c1 = 1)
4155  
4156  Aggregate  (cost=xxx rows=1 width=xxx)
4157    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4158          Join Filter: (b3t1.c1 = b3t4.c1)
4159          ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=xxx)
4160                TID Cond: (ctid = '(1,1)'::tid)
4161          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4162                Join Filter: (b3t1.c1 = b3t3.c1)
4163                ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=xxx)
4164                      TID Cond: (ctid = '(1,1)'::tid)
4165                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4166                      Join Filter: (b3t1.c1 = b3t2.c1)
4167                      ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=xxx)
4168                            Filter: (ctid = '(1,1)'::tid)
4169                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4170                            ->  Tid Scan on t1 b3t1  (cost=xxx rows=1 width=xxx)
4171                                  TID Cond: (ctid = '(1,1)'::tid)
4172                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4173                                  Filter: (c1 = 1)
4174 (56 rows)
4175
4176 -- No. R-2-3-4
4177 \o results/ut-R.tmpout
4178 /*+HashJoin(v1t1 v1t1)*/
4179 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
4180 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(v1t1 v1t1)"
4181 DETAIL:  Relation name "v1t1" is ambiguous.
4182 LOG:  pg_hint_plan:
4183 used hint:
4184 not used hint:
4185 duplication hint:
4186 error hint:
4187 HashJoin(v1t1 v1t1)
4188
4189 \o
4190 \! sql/maskout.sh results/ut-R.tmpout
4191                                 QUERY PLAN                                
4192 --------------------------------------------------------------------------
4193  Hash Join  (cost=xxx rows=1000 width=xxx)
4194    Hash Cond: (v1t1.c1 = v1t1_1.c1)
4195    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4196    ->  Hash  (cost=xxx rows=1000 width=xxx)
4197          ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
4198 (5 rows)
4199
4200 \o results/ut-R.tmpout
4201 /*+HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)*/
4202 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
4203 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)"
4204 DETAIL:  Relation name "v1t1" is ambiguous.
4205 INFO:  pg_hint_plan: hint syntax error at or near "Rows(v1t1 v1t1 #1)"
4206 DETAIL:  Relation name "v1t1" is ambiguous.
4207 LOG:  pg_hint_plan:
4208 used hint:
4209 not used hint:
4210 duplication hint:
4211 error hint:
4212 HashJoin(v1t1 v1t1)
4213 Rows(v1t1 v1t1 #1)
4214
4215 \o
4216 \! sql/maskout.sh results/ut-R.tmpout
4217                                 QUERY PLAN                                
4218 --------------------------------------------------------------------------
4219  Hash Join  (cost=xxx rows=1000 width=xxx)
4220    Hash Cond: (v1t1.c1 = v1t1_1.c1)
4221    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4222    ->  Hash  (cost=xxx rows=1000 width=xxx)
4223          ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
4224 (5 rows)
4225
4226 -- No. R-2-3-5
4227 \o results/ut-R.tmpout
4228 /*+NestLoop(v1t1 v1t1_)*/
4229 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
4230 LOG:  pg_hint_plan:
4231 used hint:
4232 NestLoop(v1t1 v1t1_)
4233 not used hint:
4234 duplication hint:
4235 error hint:
4236
4237 \o
4238 \! sql/maskout.sh results/ut-R.tmpout
4239                                  QUERY PLAN                                  
4240 -----------------------------------------------------------------------------
4241  Nested Loop  (cost=xxx rows=1000 width=xxx)
4242    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4243    ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=xxx)
4244          Index Cond: (c1 = v1t1.c1)
4245 (4 rows)
4246
4247 \o results/ut-R.tmpout
4248 /*+NestLoop(v1t1 v1t1_)Rows(v1t1 v1t1_ #1)*/
4249 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
4250 LOG:  pg_hint_plan:
4251 used hint:
4252 NestLoop(v1t1 v1t1_)
4253 Rows(v1t1 v1t1_ #1)
4254 not used hint:
4255 duplication hint:
4256 error hint:
4257
4258 \o
4259 \! sql/maskout.sh results/ut-R.tmpout
4260                                  QUERY PLAN                                  
4261 -----------------------------------------------------------------------------
4262  Nested Loop  (cost=xxx rows=1 width=xxx)
4263    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4264    ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=xxx)
4265          Index Cond: (c1 = v1t1.c1)
4266 (4 rows)
4267
4268 -- No. R-2-3-6
4269 \o results/ut-R.tmpout
4270 /*+RowsHashJoin(r4t1 r4t1)*/
4271 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
4272 INFO:  pg_hint_plan: hint syntax error at or near "RowsHashJoin(r4t1 r4t1)"
4273 DETAIL:  Unrecognized hint keyword "RowsHashJoin".
4274 \o
4275 \! sql/maskout.sh results/ut-R.tmpout
4276                                 QUERY PLAN                                
4277 --------------------------------------------------------------------------
4278  Hash Join  (cost=xxx rows=1000 width=xxx)
4279    Hash Cond: (r4t1.c1 = r4t1_1.c1)
4280    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4281    ->  Hash  (cost=xxx rows=1000 width=xxx)
4282          ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=xxx)
4283 (5 rows)
4284
4285 \o results/ut-R.tmpout
4286 /*+RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)*/
4287 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
4288 INFO:  pg_hint_plan: hint syntax error at or near "RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)"
4289 DETAIL:  Unrecognized hint keyword "RowsHashJoin".
4290 \o
4291 \! sql/maskout.sh results/ut-R.tmpout
4292                                 QUERY PLAN                                
4293 --------------------------------------------------------------------------
4294  Hash Join  (cost=xxx rows=1000 width=xxx)
4295    Hash Cond: (r4t1.c1 = r4t1_1.c1)
4296    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4297    ->  Hash  (cost=xxx rows=1000 width=xxx)
4298          ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=xxx)
4299 (5 rows)
4300
4301 -- No. R-2-3-7
4302 \o results/ut-R.tmpout
4303 /*+NestLoop(r4t1 r5t1)*/
4304 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
4305 LOG:  pg_hint_plan:
4306 used hint:
4307 NestLoop(r4t1 r5t1)
4308 not used hint:
4309 duplication hint:
4310 error hint:
4311
4312 \o
4313 \! sql/maskout.sh results/ut-R.tmpout
4314                                  QUERY PLAN                                 
4315 ----------------------------------------------------------------------------
4316  Nested Loop  (cost=xxx rows=1000 width=xxx)
4317    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4318    ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=xxx)
4319          Index Cond: (c1 = r4t1.c1)
4320 (4 rows)
4321
4322 \o results/ut-R.tmpout
4323 /*+NestLoop(r4t1 r5t1)Rows(r4t1 r5t1 #1)*/
4324 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
4325 LOG:  pg_hint_plan:
4326 used hint:
4327 NestLoop(r4t1 r5t1)
4328 Rows(r4t1 r5t1 #1)
4329 not used hint:
4330 duplication hint:
4331 error hint:
4332
4333 \o
4334 \! sql/maskout.sh results/ut-R.tmpout
4335                                  QUERY PLAN                                 
4336 ----------------------------------------------------------------------------
4337  Nested Loop  (cost=xxx rows=1 width=xxx)
4338    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4339    ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=xxx)
4340          Index Cond: (c1 = r4t1.c1)
4341 (4 rows)
4342
4343 ----
4344 ---- No. R-2-4 VALUES clause
4345 ----
4346 -- No. R-2-4-1
4347 \o results/ut-R.tmpout
4348 EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
4349 \o
4350 \! sql/maskout.sh results/ut-R.tmpout
4351                                    QUERY PLAN                                   
4352 --------------------------------------------------------------------------------
4353  Nested Loop  (cost=xxx rows=1 width=xxx)
4354    ->  Hash Join  (cost=xxx rows=2 width=xxx)
4355          Hash Cond: (t2.c1 = "*VALUES*".column1)
4356          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4357          ->  Hash  (cost=xxx rows=2 width=xxx)
4358                ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4359    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4360          Index Cond: (c1 = t2.c1)
4361 (8 rows)
4362
4363 \o results/ut-R.tmpout
4364 /*+ Leading(t3 t1 t2) Rows(t3 t1 #2)Rows(t3 t1 t2 #2)*/
4365 EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
4366 LOG:  pg_hint_plan:
4367 used hint:
4368 not used hint:
4369 Leading(t3 t1 t2)
4370 Rows(t1 t3 #2)
4371 Rows(t1 t2 t3 #2)
4372 duplication hint:
4373 error hint:
4374
4375 \o
4376 \! sql/maskout.sh results/ut-R.tmpout
4377                                    QUERY PLAN                                   
4378 --------------------------------------------------------------------------------
4379  Nested Loop  (cost=xxx rows=1 width=xxx)
4380    ->  Hash Join  (cost=xxx rows=2 width=xxx)
4381          Hash Cond: (t2.c1 = "*VALUES*".column1)
4382          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4383          ->  Hash  (cost=xxx rows=2 width=xxx)
4384                ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4385    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4386          Index Cond: (c1 = t2.c1)
4387 (8 rows)
4388
4389 \o results/ut-R.tmpout
4390 /*+ Leading(*VALUES* t1 t2) Rows(*VALUES* t1 #2)Rows(*VALUES* t1 t2 #20)*/
4391 EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
4392 LOG:  pg_hint_plan:
4393 used hint:
4394 Leading(*VALUES* t1 t2)
4395 Rows(*VALUES* t1 #2)
4396 Rows(*VALUES* t1 t2 #20)
4397 not used hint:
4398 duplication hint:
4399 error hint:
4400
4401 \o
4402 \! sql/maskout.sh results/ut-R.tmpout
4403                                  QUERY PLAN                                  
4404 -----------------------------------------------------------------------------
4405  Nested Loop  (cost=xxx rows=20 width=xxx)
4406    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4407          ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4408          ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4409                Index Cond: (c1 = "*VALUES*".column1)
4410    ->  Index Scan using t2_i1 on t2  (cost=xxx rows=1 width=xxx)
4411          Index Cond: (c1 = t1.c1)
4412 (7 rows)
4413
4414 -- No. R-2-4-2
4415 \o results/ut-R.tmpout
4416 EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) 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;
4417 \o
4418 \! sql/maskout.sh results/ut-R.tmpout
4419                                       QUERY PLAN                                      
4420 --------------------------------------------------------------------------------------
4421  Nested Loop  (cost=xxx rows=1 width=xxx)
4422    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4423          Join Filter: (t2.c1 = "*VALUES*_1".column1)
4424          ->  Hash Join  (cost=xxx rows=2 width=xxx)
4425                Hash Cond: (t2.c1 = "*VALUES*".column1)
4426                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4427                ->  Hash  (cost=xxx rows=2 width=xxx)
4428                      ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4429          ->  Materialize  (cost=xxx rows=2 width=xxx)
4430                ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
4431    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4432          Index Cond: (c1 = t2.c1)
4433 (12 rows)
4434
4435 \o results/ut-R.tmpout
4436 /*+ Leading(t4 t3 t2 t1) Rows(t4 t3 #2) Rows(t4 t3 t2 #2)Rows(t4 t3 t2 t1 #2)*/
4437 EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) 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;
4438 LOG:  pg_hint_plan:
4439 used hint:
4440 not used hint:
4441 Leading(t4 t3 t2 t1)
4442 Rows(t3 t4 #2)
4443 Rows(t2 t3 t4 #2)
4444 Rows(t1 t2 t3 t4 #2)
4445 duplication hint:
4446 error hint:
4447
4448 \o
4449 \! sql/maskout.sh results/ut-R.tmpout
4450                                       QUERY PLAN                                      
4451 --------------------------------------------------------------------------------------
4452  Nested Loop  (cost=xxx rows=1 width=xxx)
4453    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4454          Join Filter: (t2.c1 = "*VALUES*_1".column1)
4455          ->  Hash Join  (cost=xxx rows=2 width=xxx)
4456                Hash Cond: (t2.c1 = "*VALUES*".column1)
4457                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4458                ->  Hash  (cost=xxx rows=2 width=xxx)
4459                      ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4460          ->  Materialize  (cost=xxx rows=2 width=xxx)
4461                ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
4462    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4463          Index Cond: (c1 = t2.c1)
4464 (12 rows)
4465
4466 \o results/ut-R.tmpout
4467 /*+ Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)*/
4468 EXPLAIN SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) 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;
4469 INFO:  pg_hint_plan: hint syntax error at or near "Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)"
4470 DETAIL:  Relation name "*VALUES*" is ambiguous.
4471 INFO:  pg_hint_plan: hint syntax error at or near "Rows(*VALUES* t3 t2 t1 #2)"
4472 DETAIL:  Relation name "*VALUES*" is ambiguous.
4473 INFO:  pg_hint_plan: 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)"
4474 DETAIL:  Relation name "*VALUES*" is ambiguous.
4475 LOG:  pg_hint_plan:
4476 used hint:
4477 not used hint:
4478 Rows(t3 t4 #2)
4479 duplication hint:
4480 error hint:
4481 Leading(*VALUES* t3 t2 t1)
4482 Rows(*VALUES* t2 t3 #2)
4483 Rows(*VALUES* t1 t2 t3 #2)
4484
4485 \o
4486 \! sql/maskout.sh results/ut-R.tmpout
4487                                       QUERY PLAN                                      
4488 --------------------------------------------------------------------------------------
4489  Nested Loop  (cost=xxx rows=1 width=xxx)
4490    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4491          Join Filter: (t2.c1 = "*VALUES*_1".column1)
4492          ->  Hash Join  (cost=xxx rows=2 width=xxx)
4493                Hash Cond: (t2.c1 = "*VALUES*".column1)
4494                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4495                ->  Hash  (cost=xxx rows=2 width=xxx)
4496                      ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4497          ->  Materialize  (cost=xxx rows=2 width=xxx)
4498                ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
4499    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4500          Index Cond: (c1 = t2.c1)
4501 (12 rows)
4502
4503 ----
4504 ---- No. R-2-5
4505 ----
4506 -- No. R-2-5-1
4507 \o results/ut-R.tmpout
4508 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;
4509 \o
4510 \! sql/maskout.sh results/ut-R.tmpout
4511                                               QUERY PLAN                                              
4512 ------------------------------------------------------------------------------------------------------
4513  Aggregate  (cost=xxx rows=1 width=xxx)
4514    ->  Nested Loop  (cost=xxx rows=100 width=xxx)
4515          ->  Merge Join  (cost=xxx rows=100 width=xxx)
4516                Merge Cond: (bmt1.c1 = bmt2.c1)
4517                ->  Merge Join  (cost=xxx rows=1000 width=xxx)
4518                      Merge Cond: (bmt1.c1 = bmt3.c1)
4519                      ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4520                      ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4521                ->  Sort  (cost=xxx rows=100 width=xxx)
4522                      Sort Key: bmt2.c1
4523                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4524          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
4525                Index Cond: (c1 = bmt1.c1)
4526 (13 rows)
4527
4528 \o results/ut-R.tmpout
4529 /*+
4530 Leading(bmt4 bmt3 bmt2 bmt1)
4531 Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
4532 */
4533 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;
4534 LOG:  pg_hint_plan:
4535 used hint:
4536 Leading(bmt4 bmt3 bmt2 bmt1)
4537 Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
4538 not used hint:
4539 duplication hint:
4540 error hint:
4541
4542 \o
4543 \! sql/maskout.sh results/ut-R.tmpout
4544                                        QUERY PLAN                                        
4545 -----------------------------------------------------------------------------------------
4546  Merge Join  (cost=xxx rows=70 width=xxx)
4547    Merge Cond: (bmt1.c1 = bmt2.c1)
4548    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4549    ->  Sort  (cost=xxx rows=100 width=xxx)
4550          Sort Key: bmt2.c1
4551          ->  Hash Join  (cost=xxx rows=100 width=xxx)
4552                Hash Cond: (bmt3.c1 = bmt2.c1)
4553                ->  Hash Join  (cost=xxx rows=1130 width=xxx)
4554                      Hash Cond: (bmt3.c1 = bmt4.c1)
4555                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4556                      ->  Hash  (cost=xxx rows=1130 width=xxx)
4557                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
4558                ->  Hash  (cost=xxx rows=100 width=xxx)
4559                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4560 (14 rows)
4561
4562 -- No. R-2-5-2
4563 \o results/ut-R.tmpout
4564 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;
4565 \o
4566 \! sql/maskout.sh results/ut-R.tmpout
4567                                            QUERY PLAN                                           
4568 ------------------------------------------------------------------------------------------------
4569  Nested Loop  (cost=xxx rows=100 width=xxx)
4570    ->  Merge Join  (cost=xxx rows=100 width=xxx)
4571          Merge Cond: (bmt1.c1 = bmt2.c1)
4572          ->  Merge Join  (cost=xxx rows=1000 width=xxx)
4573                Merge Cond: (bmt1.c1 = bmt3.c1)
4574                ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4575                ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4576          ->  Sort  (cost=xxx rows=100 width=xxx)
4577                Sort Key: bmt2.c1
4578                ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4579    ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
4580          Index Cond: (c1 = bmt1.c1)
4581 (12 rows)
4582
4583 \o results/ut-R.tmpout
4584 /*+
4585 Leading(bmt4 bmt3 bmt2 bmt1)
4586 Rows(bmt4 bmt3 *0.6)
4587 */
4588 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;
4589 LOG:  pg_hint_plan:
4590 used hint:
4591 Leading(bmt4 bmt3 bmt2 bmt1)
4592 Rows(bmt3 bmt4 *0.6)
4593 not used hint:
4594 duplication hint:
4595 error hint:
4596
4597 \o
4598 \! sql/maskout.sh results/ut-R.tmpout
4599                                        QUERY PLAN                                        
4600 -----------------------------------------------------------------------------------------
4601  Merge Join  (cost=xxx rows=60 width=xxx)
4602    Merge Cond: (bmt1.c1 = bmt2.c1)
4603    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4604    ->  Sort  (cost=xxx rows=60 width=xxx)
4605          Sort Key: bmt2.c1
4606          ->  Hash Join  (cost=xxx rows=60 width=xxx)
4607                Hash Cond: (bmt3.c1 = bmt2.c1)
4608                ->  Hash Join  (cost=xxx rows=678 width=xxx)
4609                      Hash Cond: (bmt3.c1 = bmt4.c1)
4610                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4611                      ->  Hash  (cost=xxx rows=1130 width=xxx)
4612                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
4613                ->  Hash  (cost=xxx rows=100 width=xxx)
4614                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4615 (14 rows)
4616
4617 -- No. R-2-5-3
4618 \o results/ut-R.tmpout
4619 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;
4620 \o
4621 \! sql/maskout.sh results/ut-R.tmpout
4622                                            QUERY PLAN                                           
4623 ------------------------------------------------------------------------------------------------
4624  Nested Loop  (cost=xxx rows=100 width=xxx)
4625    ->  Merge Join  (cost=xxx rows=100 width=xxx)
4626          Merge Cond: (bmt1.c1 = bmt2.c1)
4627          ->  Merge Join  (cost=xxx rows=1000 width=xxx)
4628                Merge Cond: (bmt1.c1 = bmt3.c1)
4629                ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4630                ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4631          ->  Sort  (cost=xxx rows=100 width=xxx)
4632                Sort Key: bmt2.c1
4633                ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4634    ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
4635          Index Cond: (c1 = bmt1.c1)
4636 (12 rows)
4637
4638 \o results/ut-R.tmpout
4639 /*+
4640 Leading(bmt4 bmt3 bmt2 bmt1)
4641 Rows(bmt4 bmt1 *0.5)
4642 */
4643 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;
4644 LOG:  pg_hint_plan:
4645 used hint:
4646 Leading(bmt4 bmt3 bmt2 bmt1)
4647 Rows(bmt1 bmt4 *0.5)
4648 not used hint:
4649 duplication hint:
4650 error hint:
4651
4652 \o
4653 \! sql/maskout.sh results/ut-R.tmpout
4654                                        QUERY PLAN                                        
4655 -----------------------------------------------------------------------------------------
4656  Merge Join  (cost=xxx rows=50 width=xxx)
4657    Merge Cond: (bmt1.c1 = bmt2.c1)
4658    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4659    ->  Sort  (cost=xxx rows=100 width=xxx)
4660          Sort Key: bmt2.c1
4661          ->  Hash Join  (cost=xxx rows=100 width=xxx)
4662                Hash Cond: (bmt3.c1 = bmt2.c1)
4663                ->  Hash Join  (cost=xxx rows=1130 width=xxx)
4664                      Hash Cond: (bmt3.c1 = bmt4.c1)
4665                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4666                      ->  Hash  (cost=xxx rows=1130 width=xxx)
4667                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
4668                ->  Hash  (cost=xxx rows=100 width=xxx)
4669                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4670 (14 rows)
4671
4672 ----
4673 ---- No. R-3-1 abusolute value
4674 ----
4675 -- No. R-3-1-1
4676 \o results/ut-R.tmpout
4677 /*+Rows(t1 t2 #0)*/
4678 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4679 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 #0)
4680 LOG:  pg_hint_plan:
4681 used hint:
4682 Rows(t1 t2 #0)
4683 not used hint:
4684 duplication hint:
4685 error hint:
4686
4687 \o
4688 \! sql/maskout.sh results/ut-R.tmpout
4689                                 QUERY PLAN                                 
4690 ---------------------------------------------------------------------------
4691  Merge Join  (cost=xxx rows=1 width=xxx)
4692    Merge Cond: (t1.c1 = t2.c1)
4693    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4694    ->  Sort  (cost=xxx rows=100 width=xxx)
4695          Sort Key: t2.c1
4696          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4697 (6 rows)
4698
4699 -- No. R-3-1-2
4700 \o results/ut-R.tmpout
4701 /*+Rows(t1 t2 #5)*/
4702 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4703 LOG:  pg_hint_plan:
4704 used hint:
4705 Rows(t1 t2 #5)
4706 not used hint:
4707 duplication hint:
4708 error hint:
4709
4710 \o
4711 \! sql/maskout.sh results/ut-R.tmpout
4712                                 QUERY PLAN                                 
4713 ---------------------------------------------------------------------------
4714  Merge Join  (cost=xxx rows=5 width=xxx)
4715    Merge Cond: (t1.c1 = t2.c1)
4716    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4717    ->  Sort  (cost=xxx rows=100 width=xxx)
4718          Sort Key: t2.c1
4719          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4720 (6 rows)
4721
4722 ----
4723 ---- No. R-3-2 increase or decrease value
4724 ----
4725 -- No. R-3-2-1
4726 \o results/ut-R.tmpout
4727 /*+Rows(t1 t2 +1)*/
4728 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4729 LOG:  pg_hint_plan:
4730 used hint:
4731 Rows(t1 t2 +1)
4732 not used hint:
4733 duplication hint:
4734 error hint:
4735
4736 \o
4737 \! sql/maskout.sh results/ut-R.tmpout
4738                                 QUERY PLAN                                 
4739 ---------------------------------------------------------------------------
4740  Merge Join  (cost=xxx rows=101 width=xxx)
4741    Merge Cond: (t1.c1 = t2.c1)
4742    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4743    ->  Sort  (cost=xxx rows=100 width=xxx)
4744          Sort Key: t2.c1
4745          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4746 (6 rows)
4747
4748 -- No. R-3-2-2
4749 \o results/ut-R.tmpout
4750 /*+Rows(t1 t2 -1)*/
4751 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4752 LOG:  pg_hint_plan:
4753 used hint:
4754 Rows(t1 t2 -1)
4755 not used hint:
4756 duplication hint:
4757 error hint:
4758
4759 \o
4760 \! sql/maskout.sh results/ut-R.tmpout
4761                                 QUERY PLAN                                 
4762 ---------------------------------------------------------------------------
4763  Merge Join  (cost=xxx rows=99 width=xxx)
4764    Merge Cond: (t1.c1 = t2.c1)
4765    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4766    ->  Sort  (cost=xxx rows=100 width=xxx)
4767          Sort Key: t2.c1
4768          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4769 (6 rows)
4770
4771 -- No. R-3-2-3
4772 \o results/ut-R.tmpout
4773 /*+Rows(t1 t2 -1000)*/
4774 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4775 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 -1000)
4776 LOG:  pg_hint_plan:
4777 used hint:
4778 Rows(t1 t2 -1000)
4779 not used hint:
4780 duplication hint:
4781 error hint:
4782
4783 \o
4784 \! sql/maskout.sh results/ut-R.tmpout
4785                                 QUERY PLAN                                 
4786 ---------------------------------------------------------------------------
4787  Merge Join  (cost=xxx rows=1 width=xxx)
4788    Merge Cond: (t1.c1 = t2.c1)
4789    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4790    ->  Sort  (cost=xxx rows=100 width=xxx)
4791          Sort Key: t2.c1
4792          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4793 (6 rows)
4794
4795 ----
4796 ---- No. R-3-3 multiple 
4797 ----
4798 -- No. R-3-3-1
4799 \o results/ut-R.tmpout
4800 /*+Rows(t1 t2 *0)*/
4801 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4802 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 *0)
4803 LOG:  pg_hint_plan:
4804 used hint:
4805 Rows(t1 t2 *0)
4806 not used hint:
4807 duplication hint:
4808 error hint:
4809
4810 \o
4811 \! sql/maskout.sh results/ut-R.tmpout
4812                                 QUERY PLAN                                 
4813 ---------------------------------------------------------------------------
4814  Merge Join  (cost=xxx rows=1 width=xxx)
4815    Merge Cond: (t1.c1 = t2.c1)
4816    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4817    ->  Sort  (cost=xxx rows=100 width=xxx)
4818          Sort Key: t2.c1
4819          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4820 (6 rows)
4821
4822 -- No. R-3-3-2
4823 \o results/ut-R.tmpout
4824 /*+Rows(t1 t2 *2)*/
4825 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4826 LOG:  pg_hint_plan:
4827 used hint:
4828 Rows(t1 t2 *2)
4829 not used hint:
4830 duplication hint:
4831 error hint:
4832
4833 \o
4834 \! sql/maskout.sh results/ut-R.tmpout
4835                                 QUERY PLAN                                 
4836 ---------------------------------------------------------------------------
4837  Merge Join  (cost=xxx rows=200 width=xxx)
4838    Merge Cond: (t1.c1 = t2.c1)
4839    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4840    ->  Sort  (cost=xxx rows=100 width=xxx)
4841          Sort Key: t2.c1
4842          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4843 (6 rows)
4844
4845 -- No. R-3-3-3
4846 \o results/ut-R.tmpout
4847 /*+Rows(t1 t2 *0.1)*/
4848 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4849 LOG:  pg_hint_plan:
4850 used hint:
4851 Rows(t1 t2 *0.1)
4852 not used hint:
4853 duplication hint:
4854 error hint:
4855
4856 \o
4857 \! sql/maskout.sh results/ut-R.tmpout
4858                                 QUERY PLAN                                 
4859 ---------------------------------------------------------------------------
4860  Merge Join  (cost=xxx rows=10 width=xxx)
4861    Merge Cond: (t1.c1 = t2.c1)
4862    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4863    ->  Sort  (cost=xxx rows=100 width=xxx)
4864          Sort Key: t2.c1
4865          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4866 (6 rows)
4867
4868 ----
4869 ---- No. R-3-4 join inherit tables
4870 ----
4871 -- No. R-3-4-1
4872 \o results/ut-R.tmpout
4873 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4874 \o
4875 \! sql/maskout.sh results/ut-R.tmpout
4876                                QUERY PLAN                                
4877 -------------------------------------------------------------------------
4878  Hash Join  (cost=xxx rows=301 width=xxx)
4879    Hash Cond: (p2.c1 = p1.c1)
4880    ->  Append  (cost=xxx rows=304 width=xxx)
4881          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4882          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4883          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4884          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4885          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4886          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4887          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4888          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4889          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4890          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4891    ->  Hash  (cost=xxx rows=301 width=xxx)
4892          ->  Append  (cost=xxx rows=301 width=xxx)
4893                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4894                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4895                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4896                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4897 (19 rows)
4898
4899 \o results/ut-R.tmpout
4900 /*+Rows(p1 p2 #1)*/
4901 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4902 LOG:  pg_hint_plan:
4903 used hint:
4904 Rows(p1 p2 #1)
4905 not used hint:
4906 duplication hint:
4907 error hint:
4908
4909 \o
4910 \! sql/maskout.sh results/ut-R.tmpout
4911                                QUERY PLAN                                
4912 -------------------------------------------------------------------------
4913  Hash Join  (cost=xxx rows=1 width=xxx)
4914    Hash Cond: (p2.c1 = p1.c1)
4915    ->  Append  (cost=xxx rows=304 width=xxx)
4916          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4917          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4918          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4919          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4920          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4921          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4922          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4923          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4924          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4925          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4926    ->  Hash  (cost=xxx rows=301 width=xxx)
4927          ->  Append  (cost=xxx rows=301 width=xxx)
4928                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4929                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4930                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4931                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4932 (19 rows)
4933
4934 -- No. R-3-4-2
4935 \o results/ut-R.tmpout
4936 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4937 \o
4938 \! sql/maskout.sh results/ut-R.tmpout
4939                                QUERY PLAN                                
4940 -------------------------------------------------------------------------
4941  Hash Join  (cost=xxx rows=301 width=xxx)
4942    Hash Cond: (p2.c1 = p1.c1)
4943    ->  Append  (cost=xxx rows=304 width=xxx)
4944          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4945          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4946          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4947          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4948          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4949          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4950          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4951          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4952          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4953          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4954    ->  Hash  (cost=xxx rows=301 width=xxx)
4955          ->  Append  (cost=xxx rows=301 width=xxx)
4956                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4957                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4958                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4959                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4960 (19 rows)
4961
4962 \o results/ut-R.tmpout
4963 /*+Rows(p1c1 p2c1 #1)*/
4964 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4965 LOG:  pg_hint_plan:
4966 used hint:
4967 not used hint:
4968 Rows(p1c1 p2c1 #1)
4969 duplication hint:
4970 error hint:
4971
4972 \o
4973 \! sql/maskout.sh results/ut-R.tmpout
4974                                QUERY PLAN                                
4975 -------------------------------------------------------------------------
4976  Hash Join  (cost=xxx rows=301 width=xxx)
4977    Hash Cond: (p2.c1 = p1.c1)
4978    ->  Append  (cost=xxx rows=304 width=xxx)
4979          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4980          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4981          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4982          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4983          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4984          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4985          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4986          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4987          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4988          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4989    ->  Hash  (cost=xxx rows=301 width=xxx)
4990          ->  Append  (cost=xxx rows=301 width=xxx)
4991                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4992                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4993                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4994                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4995 (19 rows)
4996
4997 ----
4998 ---- No. R-3-5 conflict join method hint
4999 ----
5000 -- No. R-3-5-1
5001 \o results/ut-R.tmpout
5002 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5003 \o
5004 \! sql/maskout.sh results/ut-R.tmpout
5005                                 QUERY PLAN                                 
5006 ---------------------------------------------------------------------------
5007  Merge Join  (cost=xxx rows=100 width=xxx)
5008    Merge Cond: (t1.c1 = t2.c1)
5009    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5010    ->  Sort  (cost=xxx rows=100 width=xxx)
5011          Sort Key: t2.c1
5012          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5013 (6 rows)
5014
5015 \o results/ut-R.tmpout
5016 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)*/
5017 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5018 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)"
5019 DETAIL:  Conflict rows hint.
5020 LOG:  pg_hint_plan:
5021 used hint:
5022 Rows(t1 t2 #1)
5023 not used hint:
5024 duplication hint:
5025 Rows(t1 t2 #1)
5026 error hint:
5027
5028 \o
5029 \! sql/maskout.sh results/ut-R.tmpout
5030                                 QUERY PLAN                                 
5031 ---------------------------------------------------------------------------
5032  Merge Join  (cost=xxx rows=1 width=xxx)
5033    Merge Cond: (t1.c1 = t2.c1)
5034    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5035    ->  Sort  (cost=xxx rows=100 width=xxx)
5036          Sort Key: t2.c1
5037          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5038 (6 rows)
5039
5040 -- No. R-3-5-2
5041 \o results/ut-R.tmpout
5042 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5043 \o
5044 \! sql/maskout.sh results/ut-R.tmpout
5045                                 QUERY PLAN                                 
5046 ---------------------------------------------------------------------------
5047  Merge Join  (cost=xxx rows=100 width=xxx)
5048    Merge Cond: (t1.c1 = t2.c1)
5049    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5050    ->  Sort  (cost=xxx rows=100 width=xxx)
5051          Sort Key: t2.c1
5052          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5053 (6 rows)
5054
5055 \o results/ut-R.tmpout
5056 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)*/
5057 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5058 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)"
5059 DETAIL:  Conflict rows hint.
5060 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)"
5061 DETAIL:  Conflict rows hint.
5062 LOG:  pg_hint_plan:
5063 used hint:
5064 Rows(t1 t2 #1)
5065 not used hint:
5066 duplication hint:
5067 Rows(t1 t2 #1)
5068 Rows(t1 t2 #1)
5069 error hint:
5070
5071 \o
5072 \! sql/maskout.sh results/ut-R.tmpout
5073                                 QUERY PLAN                                 
5074 ---------------------------------------------------------------------------
5075  Merge Join  (cost=xxx rows=1 width=xxx)
5076    Merge Cond: (t1.c1 = t2.c1)
5077    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5078    ->  Sort  (cost=xxx rows=100 width=xxx)
5079          Sort Key: t2.c1
5080          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5081 (6 rows)
5082
5083 -- No. R-3-5-3
5084 \o results/ut-R.tmpout
5085 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5086 \o
5087 \! sql/maskout.sh results/ut-R.tmpout
5088                                 QUERY PLAN                                 
5089 ---------------------------------------------------------------------------
5090  Merge Join  (cost=xxx rows=100 width=xxx)
5091    Merge Cond: (t1.c1 = t2.c1)
5092    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5093    ->  Sort  (cost=xxx rows=100 width=xxx)
5094          Sort Key: t2.c1
5095          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5096 (6 rows)
5097
5098 \o results/ut-R.tmpout
5099 /*+Rows(t1 t2 #1)Rows(t2 t1 #1)*/
5100 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5101 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t2 t1 #1)"
5102 DETAIL:  Conflict rows hint.
5103 LOG:  pg_hint_plan:
5104 used hint:
5105 Rows(t1 t2 #1)
5106 not used hint:
5107 duplication hint:
5108 Rows(t1 t2 #1)
5109 error hint:
5110
5111 \o
5112 \! sql/maskout.sh results/ut-R.tmpout
5113                                 QUERY PLAN                                 
5114 ---------------------------------------------------------------------------
5115  Merge Join  (cost=xxx rows=1 width=xxx)
5116    Merge Cond: (t1.c1 = t2.c1)
5117    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5118    ->  Sort  (cost=xxx rows=100 width=xxx)
5119          Sort Key: t2.c1
5120          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5121 (6 rows)
5122
5123 -- No. R-3-5-4
5124 \o results/ut-R.tmpout
5125 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5126 \o
5127 \! sql/maskout.sh results/ut-R.tmpout
5128                                 QUERY PLAN                                 
5129 ---------------------------------------------------------------------------
5130  Merge Join  (cost=xxx rows=100 width=xxx)
5131    Merge Cond: (t1.c1 = t2.c1)
5132    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5133    ->  Sort  (cost=xxx rows=100 width=xxx)
5134          Sort Key: t2.c1
5135          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5136 (6 rows)
5137
5138 \o results/ut-R.tmpout
5139 /*+Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)*/
5140 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5141 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)"
5142 DETAIL:  Conflict rows hint.
5143 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t2 t1 #1)"
5144 DETAIL:  Conflict rows hint.
5145 LOG:  pg_hint_plan:
5146 used hint:
5147 Rows(t1 t2 #1)
5148 not used hint:
5149 duplication hint:
5150 Rows(t1 t2 #1)
5151 Rows(t1 t2 #1)
5152 error hint:
5153
5154 \o
5155 \! sql/maskout.sh results/ut-R.tmpout
5156                                 QUERY PLAN                                 
5157 ---------------------------------------------------------------------------
5158  Merge Join  (cost=xxx rows=1 width=xxx)
5159    Merge Cond: (t1.c1 = t2.c1)
5160    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5161    ->  Sort  (cost=xxx rows=100 width=xxx)
5162          Sort Key: t2.c1
5163          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5164 (6 rows)
5165
5166 ----
5167 ---- No. R-3-6 hint state output
5168 ----
5169 -- No. R-3-6-1
5170 SET client_min_messages TO DEBUG1;
5171 \o results/ut-R.tmpout
5172 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5173 \o
5174 \! sql/maskout.sh results/ut-R.tmpout
5175                                 QUERY PLAN                                 
5176 ---------------------------------------------------------------------------
5177  Merge Join  (cost=xxx rows=100 width=xxx)
5178    Merge Cond: (t1.c1 = t2.c1)
5179    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5180    ->  Sort  (cost=xxx rows=100 width=xxx)
5181          Sort Key: t2.c1
5182          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5183 (6 rows)
5184
5185 \o results/ut-R.tmpout
5186 /*+Rows(t1 t2 +1)*/
5187 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5188 DEBUG:  adjusted rows 100 to 101
5189 LOG:  pg_hint_plan:
5190 used hint:
5191 Rows(t1 t2 +1)
5192 not used hint:
5193 duplication hint:
5194 error hint:
5195
5196 \o
5197 \! sql/maskout.sh results/ut-R.tmpout
5198                                 QUERY PLAN                                 
5199 ---------------------------------------------------------------------------
5200  Merge Join  (cost=xxx rows=101 width=xxx)
5201    Merge Cond: (t1.c1 = t2.c1)
5202    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5203    ->  Sort  (cost=xxx rows=100 width=xxx)
5204          Sort Key: t2.c1
5205          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5206 (6 rows)
5207
5208 \! rm results/ut-R.tmpout