OSDN Git Service

Change version to 1.3.0
[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                                        Join Filter: (c1.c1 = bmt1.c1)
2367                                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
2368                                              Hash Cond: (c2.c1 = c1.c1)
2369                                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2370                                                    Merge Cond: (c2.c1 = c3.c1)
2371                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2372                                                          Sort Key: c2.c1
2373                                                          ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
2374                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2375                                                          Sort Key: c3.c1
2376                                                          ->  CTE Scan on c3  (cost=xxx rows=1 width=xxx)
2377                                              ->  Hash  (cost=xxx rows=1 width=xxx)
2378                                                    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2379                                        ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2380                                              Index Cond: (c1 = c2.c1)
2381                            ->  Sort  (cost=xxx rows=100 width=xxx)
2382                                  Sort Key: bmt2.c1
2383                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2384          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
2385                Index Cond: (c1 = bmt1.c1)
2386 (73 rows)
2387
2388 \o results/ut-R.tmpout
2389 /*+
2390 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2391 Leading(b1t2 b1t3 b1t4 b1t1)
2392 Leading(b2t3 b2t4 b2t1 b2t2)
2393 Leading(b3t4 b3t1 b3t2 b3t3)
2394 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)
2395 MergeJoin(b1t2 b1t3)HashJoin(b1t2 b1t3 b1t4)NestLoop(b1t2 b1t3 b1t4 b1t1)
2396 MergeJoin(b2t3 b2t4)HashJoin(b2t3 b2t4 b2t1)NestLoop(b2t3 b2t4 b2t1 b2t2)
2397 MergeJoin(b3t4 b3t1)HashJoin(b3t4 b3t1 b3t2)NestLoop(b3t1 b3t2 b3t3 b3t4)
2398 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)
2399 Rows(b1t2 b1t3 #1)Rows(b1t2 b1t3 b1t4 #1)Rows(b1t2 b1t3 b1t4 b1t1 #1)
2400 Rows(b2t3 b2t4 #1)Rows(b2t3 b2t4 b2t1 #1)Rows(b2t3 b2t4 b2t1 b2t2 #1)
2401 Rows(b3t4 b3t1 #1)Rows(b3t4 b3t1 b3t2 #1)Rows(b3t1 b3t2 b3t3 b3t4 #1)
2402 */
2403 EXPLAIN
2404 WITH c1 (c1) AS (
2405 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
2406 )
2407 , c2 (c1) AS (
2408 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
2409 )
2410 , c3 (c1) AS (
2411 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
2412 )
2413 SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
2414 , c1, c2, c3
2415                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
2416 AND bmt1.c1 = c1.c1
2417 AND bmt1.c1 = c2.c1
2418 AND bmt1.c1 = c3.c1;
2419 LOG:  pg_hint_plan:
2420 used hint:
2421 MergeJoin(b1t2 b1t3)
2422 MergeJoin(b2t3 b2t4)
2423 MergeJoin(b3t1 b3t4)
2424 MergeJoin(c2 c3)
2425 HashJoin(b1t2 b1t3 b1t4)
2426 HashJoin(b2t1 b2t3 b2t4)
2427 HashJoin(b3t1 b3t2 b3t4)
2428 HashJoin(c1 c2 c3)
2429 NestLoop(b1t1 b1t2 b1t3 b1t4)
2430 NestLoop(b2t1 b2t2 b2t3 b2t4)
2431 NestLoop(b3t1 b3t2 b3t3 b3t4)
2432 NestLoop(bmt1 c1 c2 c3)
2433 MergeJoin(bmt1 bmt2 c1 c2 c3)
2434 HashJoin(bmt1 bmt2 bmt3 c1 c2 c3)
2435 NestLoop(bmt1 bmt2 bmt3 bmt4 c1 c2 c3)
2436 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
2437 Leading(b1t2 b1t3 b1t4 b1t1)
2438 Leading(b2t3 b2t4 b2t1 b2t2)
2439 Leading(b3t4 b3t1 b3t2 b3t3)
2440 Rows(b1t2 b1t3 #1)
2441 Rows(b2t3 b2t4 #1)
2442 Rows(b3t1 b3t4 #1)
2443 Rows(c2 c3 #1)
2444 Rows(b1t2 b1t3 b1t4 #1)
2445 Rows(b2t1 b2t3 b2t4 #1)
2446 Rows(b3t1 b3t2 b3t4 #1)
2447 Rows(c1 c2 c3 #1)
2448 Rows(b1t1 b1t2 b1t3 b1t4 #1)
2449 Rows(b2t1 b2t2 b2t3 b2t4 #1)
2450 Rows(b3t1 b3t2 b3t3 b3t4 #1)
2451 Rows(bmt1 c1 c2 c3 #1)
2452 Rows(bmt1 bmt2 c1 c2 c3 #1)
2453 Rows(bmt1 bmt2 bmt3 c1 c2 c3 #1)
2454 Rows(bmt1 bmt2 bmt3 bmt4 c1 c2 c3 #1)
2455 not used hint:
2456 duplication hint:
2457 error hint:
2458
2459 \o
2460 \! sql/maskout.sh results/ut-R.tmpout
2461                                                      QUERY PLAN                                                     
2462 --------------------------------------------------------------------------------------------------------------------
2463  Aggregate  (cost=xxx rows=1 width=xxx)
2464    CTE c1
2465      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2466            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2467                  Join Filter: (b1t2.c1 = b1t1.c1)
2468                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2469                        Hash Cond: (b1t4.c1 = b1t2.c1)
2470                        ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2471                        ->  Hash  (cost=xxx rows=1 width=xxx)
2472                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2473                                    Merge Cond: (b1t3.c1 = b1t2.c1)
2474                                    ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2475                                    ->  Sort  (cost=xxx rows=100 width=xxx)
2476                                          Sort Key: b1t2.c1
2477                                          ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2478                  ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2479                        Index Cond: (c1 = b1t3.c1)
2480    CTE c2
2481      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2482            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2483                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2484                        Hash Cond: (b2t1.c1 = b2t3.c1)
2485                        ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2486                        ->  Hash  (cost=xxx rows=1 width=xxx)
2487                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2488                                    Merge Cond: (b2t3.c1 = b2t4.c1)
2489                                    ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2490                                    ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2491                  ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2492                        Index Cond: (c1 = b2t1.c1)
2493    CTE c3
2494      ->  Aggregate  (cost=xxx rows=1 width=xxx)
2495            ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2496                  ->  Hash Join  (cost=xxx rows=1 width=xxx)
2497                        Hash Cond: (b3t1.c1 = b3t2.c1)
2498                        ->  Merge Join  (cost=xxx rows=1 width=xxx)
2499                              Merge Cond: (b3t1.c1 = b3t4.c1)
2500                              ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2501                              ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1130 width=xxx)
2502                        ->  Hash  (cost=xxx rows=100 width=xxx)
2503                              ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2504                  ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
2505                        Index Cond: (c1 = b3t1.c1)
2506    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2507          ->  Hash Join  (cost=xxx rows=1 width=xxx)
2508                Hash Cond: (bmt3.c1 = bmt1.c1)
2509                ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2510                ->  Hash  (cost=xxx rows=1 width=xxx)
2511                      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2512                            Merge Cond: (bmt1.c1 = bmt2.c1)
2513                            ->  Sort  (cost=xxx rows=1 width=xxx)
2514                                  Sort Key: bmt1.c1
2515                                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
2516                                        Join Filter: (c1.c1 = bmt1.c1)
2517                                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
2518                                              Hash Cond: (c2.c1 = c1.c1)
2519                                              ->  Merge Join  (cost=xxx rows=1 width=xxx)
2520                                                    Merge Cond: (c2.c1 = c3.c1)
2521                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2522                                                          Sort Key: c2.c1
2523                                                          ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
2524                                                    ->  Sort  (cost=xxx rows=1 width=xxx)
2525                                                          Sort Key: c3.c1
2526                                                          ->  CTE Scan on c3  (cost=xxx rows=1 width=xxx)
2527                                              ->  Hash  (cost=xxx rows=1 width=xxx)
2528                                                    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2529                                        ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2530                                              Index Cond: (c1 = c2.c1)
2531                            ->  Sort  (cost=xxx rows=100 width=xxx)
2532                                  Sort Key: bmt2.c1
2533                                  ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2534          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
2535                Index Cond: (c1 = bmt1.c1)
2536 (73 rows)
2537
2538 ----
2539 ---- No. R-2-2 the number of the tables per quiry block
2540 ----
2541 -- No. R-2-2-1
2542 \o results/ut-R.tmpout
2543 /*+
2544 Leading(c1 bmt1)
2545 */
2546 EXPLAIN
2547 WITH c1 (c1) AS (
2548 SELECT b1t1.c1 FROM s1.t1 b1t1 WHERE b1t1.c1 = 1
2549 )
2550 SELECT bmt1.c1, (
2551 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
2552 )
2553                     FROM s1.t1 bmt1, c1 WHERE bmt1.c1 = 1
2554 AND bmt1.c1 = c1.c1
2555 AND bmt1.c1 <> (
2556 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
2557 );
2558 LOG:  pg_hint_plan:
2559 used hint:
2560 Leading(c1 bmt1)
2561 not used hint:
2562 duplication hint:
2563 error hint:
2564
2565 \o
2566 \! sql/maskout.sh results/ut-R.tmpout
2567                                     QUERY PLAN                                    
2568 ----------------------------------------------------------------------------------
2569  Nested Loop  (cost=xxx rows=1 width=xxx)
2570    CTE c1
2571      ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2572            Index Cond: (c1 = 1)
2573    InitPlan 2 (returns $1)
2574      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
2575            Index Cond: (c1 = 1)
2576    InitPlan 3 (returns $2)
2577      ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
2578            Index Cond: (c1 = 1)
2579    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2580          Index Cond: (c1 = 1)
2581          Filter: (c1 <> $2)
2582    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2583          Filter: (c1 = 1)
2584 (15 rows)
2585
2586 \o results/ut-R.tmpout
2587 /*+
2588 Leading(c1 bmt1)
2589 Rows(bmt1 c1 #1)
2590 Rows(b1t1 c1 #1)
2591 Rows(b2t1 c1 #1)
2592 Rows(b3t1 c1 #1)
2593 */
2594 EXPLAIN
2595 WITH c1 (c1) AS (
2596 SELECT b1t1.c1 FROM s1.t1 b1t1 WHERE b1t1.c1 = 1
2597 )
2598 SELECT bmt1.c1, (
2599 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
2600 )
2601                     FROM s1.t1 bmt1, c1 WHERE bmt1.c1 = 1
2602 AND bmt1.c1 = c1.c1
2603 AND bmt1.c1 <> (
2604 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
2605 );
2606 LOG:  pg_hint_plan:
2607 used hint:
2608 Leading(c1 bmt1)
2609 Rows(bmt1 c1 #1)
2610 not used hint:
2611 Rows(b1t1 c1 #1)
2612 Rows(b2t1 c1 #1)
2613 Rows(b3t1 c1 #1)
2614 duplication hint:
2615 error hint:
2616
2617 \o
2618 \! sql/maskout.sh results/ut-R.tmpout
2619                                     QUERY PLAN                                    
2620 ----------------------------------------------------------------------------------
2621  Nested Loop  (cost=xxx rows=1 width=xxx)
2622    CTE c1
2623      ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
2624            Index Cond: (c1 = 1)
2625    InitPlan 2 (returns $1)
2626      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
2627            Index Cond: (c1 = 1)
2628    InitPlan 3 (returns $2)
2629      ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
2630            Index Cond: (c1 = 1)
2631    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
2632          Index Cond: (c1 = 1)
2633          Filter: (c1 <> $2)
2634    ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2635          Filter: (c1 = 1)
2636 (15 rows)
2637
2638 -- No. R-2-2-2
2639 \o results/ut-R.tmpout
2640 /*+
2641 Leading(c1 bmt2 bmt1)
2642 Leading(b1t2 b1t1)
2643 Leading(b2t2 b2t1)
2644 Leading(b3t2 b3t1)
2645 MergeJoin(c1 bmt2)
2646 HashJoin(c1 bmt1 bmt2)
2647 MergeJoin(b1t1 b1t2)
2648 MergeJoin(b2t1 b2t2)
2649 MergeJoin(b3t1 b3t2)
2650 */
2651 EXPLAIN
2652 WITH c1 (c1) AS (
2653 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.c1 = b1t2.c1
2654 )
2655 SELECT bmt1.c1, (
2656 SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.c1 = b2t2.c1
2657 )
2658                     FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.c1 = bmt2.c1
2659 AND bmt1.c1 = c1.c1
2660 AND bmt1.c1 <> (
2661 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
2662 );
2663 LOG:  pg_hint_plan:
2664 used hint:
2665 MergeJoin(b1t1 b1t2)
2666 MergeJoin(b2t1 b2t2)
2667 MergeJoin(b3t1 b3t2)
2668 MergeJoin(bmt2 c1)
2669 HashJoin(bmt1 bmt2 c1)
2670 Leading(c1 bmt2 bmt1)
2671 Leading(b1t2 b1t1)
2672 Leading(b2t2 b2t1)
2673 Leading(b3t2 b3t1)
2674 not used hint:
2675 duplication hint:
2676 error hint:
2677
2678 \o
2679 \! sql/maskout.sh results/ut-R.tmpout
2680                                          QUERY PLAN                                         
2681 --------------------------------------------------------------------------------------------
2682  Hash Join  (cost=xxx rows=10 width=xxx)
2683    Hash Cond: (bmt1.c1 = bmt2.c1)
2684    CTE c1
2685      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2686            Merge Cond: (b1t1.c1 = b1t2.c1)
2687            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
2688            ->  Sort  (cost=xxx rows=100 width=xxx)
2689                  Sort Key: b1t2.c1
2690                  ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2691    InitPlan 2 (returns $1)
2692      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2693            Merge Cond: (b2t1.c1 = b2t2.c1)
2694            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2695            ->  Sort  (cost=xxx rows=100 width=xxx)
2696                  Sort Key: b2t2.c1
2697                  ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=xxx)
2698    InitPlan 3 (returns $2)
2699      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2700            Merge Cond: (b3t1.c1 = b3t2.c1)
2701            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2702            ->  Sort  (cost=xxx rows=100 width=xxx)
2703                  Sort Key: b3t2.c1
2704                  ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2705    ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=xxx)
2706          Filter: (c1 <> $2)
2707    ->  Hash  (cost=xxx rows=100 width=xxx)
2708          ->  Merge Join  (cost=xxx rows=100 width=xxx)
2709                Merge Cond: (bmt2.c1 = c1.c1)
2710                ->  Sort  (cost=xxx rows=100 width=xxx)
2711                      Sort Key: bmt2.c1
2712                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2713                ->  Sort  (cost=xxx rows=100 width=xxx)
2714                      Sort Key: c1.c1
2715                      ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
2716 (34 rows)
2717
2718 \o results/ut-R.tmpout
2719 /*+
2720 Leading(c1 bmt2 bmt1)
2721 Leading(b1t2 b1t1)
2722 Leading(b2t2 b2t1)
2723 Leading(b3t2 b3t1)
2724 MergeJoin(c1 bmt2)
2725 HashJoin(c1 bmt1 bmt2)
2726 MergeJoin(b1t1 b1t2)
2727 MergeJoin(b2t1 b2t2)
2728 MergeJoin(b3t1 b3t2)
2729 Rows(c1 bmt2 #1)
2730 Rows(c1 bmt1 bmt2 #1)
2731 Rows(b1t1 b1t2 #1)
2732 Rows(b2t1 b2t2 #1)
2733 Rows(b3t1 b3t2 #1)
2734 */
2735 EXPLAIN
2736 WITH c1 (c1) AS (
2737 SELECT b1t1.c1 FROM s1.t1 b1t1, s1.t2 b1t2 WHERE b1t1.c1 = b1t2.c1
2738 )
2739 SELECT bmt1.c1, (
2740 SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.c1 = b2t2.c1
2741 )
2742                     FROM s1.t1 bmt1, s1.t2 bmt2, c1 WHERE bmt1.c1 = bmt2.c1
2743 AND bmt1.c1 = c1.c1
2744 AND bmt1.c1 <> (
2745 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
2746 )
2747 ;
2748 LOG:  pg_hint_plan:
2749 used hint:
2750 MergeJoin(b1t1 b1t2)
2751 MergeJoin(b2t1 b2t2)
2752 MergeJoin(b3t1 b3t2)
2753 MergeJoin(bmt2 c1)
2754 HashJoin(bmt1 bmt2 c1)
2755 Leading(c1 bmt2 bmt1)
2756 Leading(b1t2 b1t1)
2757 Leading(b2t2 b2t1)
2758 Leading(b3t2 b3t1)
2759 Rows(b1t1 b1t2 #1)
2760 Rows(b2t1 b2t2 #1)
2761 Rows(b3t1 b3t2 #1)
2762 Rows(bmt2 c1 #1)
2763 Rows(bmt1 bmt2 c1 #1)
2764 not used hint:
2765 duplication hint:
2766 error hint:
2767
2768 \o
2769 \! sql/maskout.sh results/ut-R.tmpout
2770                                          QUERY PLAN                                         
2771 --------------------------------------------------------------------------------------------
2772  Hash Join  (cost=xxx rows=1 width=xxx)
2773    Hash Cond: (bmt1.c1 = bmt2.c1)
2774    CTE c1
2775      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2776            Merge Cond: (b1t1.c1 = b1t2.c1)
2777            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
2778            ->  Sort  (cost=xxx rows=100 width=xxx)
2779                  Sort Key: b1t2.c1
2780                  ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
2781    InitPlan 2 (returns $1)
2782      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2783            Merge Cond: (b2t1.c1 = b2t2.c1)
2784            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2785            ->  Sort  (cost=xxx rows=100 width=xxx)
2786                  Sort Key: b2t2.c1
2787                  ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=xxx)
2788    InitPlan 3 (returns $2)
2789      ->  Merge Join  (cost=xxx rows=1 width=xxx)
2790            Merge Cond: (b3t1.c1 = b3t2.c1)
2791            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2792            ->  Sort  (cost=xxx rows=100 width=xxx)
2793                  Sort Key: b3t2.c1
2794                  ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
2795    ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=xxx)
2796          Filter: (c1 <> $2)
2797    ->  Hash  (cost=xxx rows=1 width=xxx)
2798          ->  Merge Join  (cost=xxx rows=1 width=xxx)
2799                Merge Cond: (bmt2.c1 = c1.c1)
2800                ->  Sort  (cost=xxx rows=100 width=xxx)
2801                      Sort Key: bmt2.c1
2802                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
2803                ->  Sort  (cost=xxx rows=1 width=xxx)
2804                      Sort Key: c1.c1
2805                      ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
2806 (34 rows)
2807
2808 -- No. R-2-2-3
2809 \o results/ut-R.tmpout
2810 /*+
2811 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2812 Leading(b1t4 b1t3 b1t2 b1t1) 
2813 Leading(b2t4 b2t3 b2t2 b2t1)
2814 Leading(b3t4 b3t3 b3t2 b3t1)
2815 MergeJoin(c1 bmt4)
2816 HashJoin(c1 bmt4 bmt3)
2817 NestLoop(c1 bmt4 bmt3 bmt2)
2818 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
2819 HashJoin(b1t4 b1t3)
2820 NestLoop(b1t4 b1t3 b1t2)
2821 MergeJoin(b1t4 b1t3 b1t2 b1t1)
2822 HashJoin(b2t4 b2t3)
2823 NestLoop(b2t4 b2t3 b2t2)
2824 MergeJoin(b2t4 b2t3 b2t2 b2t1)
2825 HashJoin(b3t4 b3t3)
2826 NestLoop(b3t4 b3t3 b3t2)
2827 MergeJoin(b3t4 b3t3 b3t2 b3t1)
2828 */
2829 EXPLAIN
2830 WITH c1 (c1) AS (
2831 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
2832 )
2833 SELECT bmt1.c1, (
2834 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
2835 )
2836                     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
2837 AND bmt1.c1 <> (
2838 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
2839 );
2840 LOG:  pg_hint_plan:
2841 used hint:
2842 HashJoin(b1t3 b1t4)
2843 HashJoin(b2t3 b2t4)
2844 HashJoin(b3t3 b3t4)
2845 MergeJoin(bmt4 c1)
2846 NestLoop(b1t2 b1t3 b1t4)
2847 NestLoop(b2t2 b2t3 b2t4)
2848 NestLoop(b3t2 b3t3 b3t4)
2849 HashJoin(bmt3 bmt4 c1)
2850 MergeJoin(b1t1 b1t2 b1t3 b1t4)
2851 MergeJoin(b2t1 b2t2 b2t3 b2t4)
2852 MergeJoin(b3t1 b3t2 b3t3 b3t4)
2853 NestLoop(bmt2 bmt3 bmt4 c1)
2854 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
2855 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2856 Leading(b1t4 b1t3 b1t2 b1t1)
2857 Leading(b2t4 b2t3 b2t2 b2t1)
2858 Leading(b3t4 b3t3 b3t2 b3t1)
2859 not used hint:
2860 duplication hint:
2861 error hint:
2862
2863 \o
2864 \! sql/maskout.sh results/ut-R.tmpout
2865                                                     QUERY PLAN                                                    
2866 ------------------------------------------------------------------------------------------------------------------
2867  Merge Join  (cost=xxx rows=10 width=xxx)
2868    Merge Cond: (bmt1.c1 = bmt2.c1)
2869    CTE c1
2870      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2871            Merge Cond: (b1t1.c1 = b1t2.c1)
2872            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
2873            ->  Sort  (cost=xxx rows=100 width=xxx)
2874                  Sort Key: b1t2.c1
2875                  ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2876                        ->  Hash Join  (cost=xxx rows=1130 width=xxx)
2877                              Hash Cond: (b1t3.c1 = b1t4.c1)
2878                              ->  Seq Scan on t3 b1t3  (cost=xxx rows=1130 width=xxx)
2879                              ->  Hash  (cost=xxx rows=1130 width=xxx)
2880                                    ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
2881                        ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=xxx)
2882                              Index Cond: (c1 = b1t3.c1)
2883    InitPlan 2 (returns $3)
2884      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2885            Merge Cond: (b2t1.c1 = b2t2.c1)
2886            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
2887            ->  Sort  (cost=xxx rows=100 width=xxx)
2888                  Sort Key: b2t2.c1
2889                  ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2890                        ->  Hash Join  (cost=xxx rows=1130 width=xxx)
2891                              Hash Cond: (b2t3.c1 = b2t4.c1)
2892                              ->  Seq Scan on t3 b2t3  (cost=xxx rows=1130 width=xxx)
2893                              ->  Hash  (cost=xxx rows=1130 width=xxx)
2894                                    ->  Seq Scan on t4 b2t4  (cost=xxx rows=1130 width=xxx)
2895                        ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
2896                              Index Cond: (c1 = b2t3.c1)
2897    InitPlan 3 (returns $5)
2898      ->  Merge Join  (cost=xxx rows=100 width=xxx)
2899            Merge Cond: (b3t1.c1 = b3t2.c1)
2900            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
2901            ->  Sort  (cost=xxx rows=100 width=xxx)
2902                  Sort Key: b3t2.c1
2903                  ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2904                        ->  Hash Join  (cost=xxx rows=1130 width=xxx)
2905                              Hash Cond: (b3t3.c1 = b3t4.c1)
2906                              ->  Seq Scan on t3 b3t3  (cost=xxx rows=1130 width=xxx)
2907                              ->  Hash  (cost=xxx rows=1130 width=xxx)
2908                                    ->  Seq Scan on t4 b3t4  (cost=xxx rows=1130 width=xxx)
2909                        ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=xxx)
2910                              Index Cond: (c1 = b3t3.c1)
2911    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
2912          Filter: (c1 <> $5)
2913    ->  Sort  (cost=xxx rows=100 width=xxx)
2914          Sort Key: bmt2.c1
2915          ->  Nested Loop  (cost=xxx rows=100 width=xxx)
2916                ->  Hash Join  (cost=xxx rows=100 width=xxx)
2917                      Hash Cond: (bmt3.c1 = bmt4.c1)
2918                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
2919                      ->  Hash  (cost=xxx rows=100 width=xxx)
2920                            ->  Merge Join  (cost=xxx rows=100 width=xxx)
2921                                  Merge Cond: (bmt4.c1 = c1.c1)
2922                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
2923                                  ->  Sort  (cost=xxx rows=100 width=xxx)
2924                                        Sort Key: c1.c1
2925                                        ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
2926                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
2927                      Index Cond: (c1 = bmt3.c1)
2928 (61 rows)
2929
2930 \o results/ut-R.tmpout
2931 /*+
2932 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2933 Leading(b1t4 b1t3 b1t2 b1t1) 
2934 Leading(b2t4 b2t3 b2t2 b2t1)
2935 Leading(b3t4 b3t3 b3t2 b3t1)
2936 MergeJoin(c1 bmt4)
2937 HashJoin(c1 bmt4 bmt3)
2938 NestLoop(c1 bmt4 bmt3 bmt2)
2939 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
2940 HashJoin(b1t4 b1t3)
2941 NestLoop(b1t4 b1t3 b1t2)
2942 MergeJoin(b1t4 b1t3 b1t2 b1t1)
2943 HashJoin(b2t4 b2t3)
2944 NestLoop(b2t4 b2t3 b2t2)
2945 MergeJoin(b2t4 b2t3 b2t2 b2t1)
2946 HashJoin(b3t4 b3t3)
2947 NestLoop(b3t4 b3t3 b3t2)
2948 MergeJoin(b3t4 b3t3 b3t2 b3t1)
2949 Rows(c1 bmt4 #1)
2950 Rows(c1 bmt4 bmt3 #1)
2951 Rows(c1 bmt4 bmt3 bmt2 #1)
2952 Rows(c1 bmt4 bmt3 bmt2 bmt1 #1)
2953 Rows(b1t4 b1t3 #1)
2954 Rows(b1t4 b1t3 b1t2 #1)
2955 Rows(b1t4 b1t3 b1t2 b1t1 #1)
2956 Rows(b2t4 b2t3 #1)
2957 Rows(b2t4 b2t3 b2t2 #1)
2958 Rows(b2t4 b2t3 b2t2 b2t1 #1)
2959 Rows(b3t4 b3t3 #1)
2960 Rows(b3t4 b3t3 b3t2 #1)
2961 Rows(b3t4 b3t3 b3t2 b3t1 #1)
2962 */
2963 EXPLAIN
2964 WITH c1 (c1) AS (
2965 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
2966 )
2967 SELECT bmt1.c1, (
2968 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
2969 )
2970                     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
2971 AND bmt1.c1 <> (
2972 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
2973 );
2974 LOG:  pg_hint_plan:
2975 used hint:
2976 HashJoin(b1t3 b1t4)
2977 HashJoin(b2t3 b2t4)
2978 HashJoin(b3t3 b3t4)
2979 MergeJoin(bmt4 c1)
2980 NestLoop(b1t2 b1t3 b1t4)
2981 NestLoop(b2t2 b2t3 b2t4)
2982 NestLoop(b3t2 b3t3 b3t4)
2983 HashJoin(bmt3 bmt4 c1)
2984 MergeJoin(b1t1 b1t2 b1t3 b1t4)
2985 MergeJoin(b2t1 b2t2 b2t3 b2t4)
2986 MergeJoin(b3t1 b3t2 b3t3 b3t4)
2987 NestLoop(bmt2 bmt3 bmt4 c1)
2988 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
2989 Leading(c1 bmt4 bmt3 bmt2 bmt1)
2990 Leading(b1t4 b1t3 b1t2 b1t1)
2991 Leading(b2t4 b2t3 b2t2 b2t1)
2992 Leading(b3t4 b3t3 b3t2 b3t1)
2993 Rows(b1t3 b1t4 #1)
2994 Rows(b2t3 b2t4 #1)
2995 Rows(b3t3 b3t4 #1)
2996 Rows(bmt4 c1 #1)
2997 Rows(b1t2 b1t3 b1t4 #1)
2998 Rows(b2t2 b2t3 b2t4 #1)
2999 Rows(b3t2 b3t3 b3t4 #1)
3000 Rows(bmt3 bmt4 c1 #1)
3001 Rows(b1t1 b1t2 b1t3 b1t4 #1)
3002 Rows(b2t1 b2t2 b2t3 b2t4 #1)
3003 Rows(b3t1 b3t2 b3t3 b3t4 #1)
3004 Rows(bmt2 bmt3 bmt4 c1 #1)
3005 Rows(bmt1 bmt2 bmt3 bmt4 c1 #1)
3006 not used hint:
3007 duplication hint:
3008 error hint:
3009
3010 \o
3011 \! sql/maskout.sh results/ut-R.tmpout
3012                                                     QUERY PLAN                                                    
3013 ------------------------------------------------------------------------------------------------------------------
3014  Merge Join  (cost=xxx rows=1 width=xxx)
3015    Merge Cond: (bmt1.c1 = bmt2.c1)
3016    CTE c1
3017      ->  Merge Join  (cost=xxx rows=1 width=xxx)
3018            Merge Cond: (b1t1.c1 = b1t2.c1)
3019            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
3020            ->  Sort  (cost=xxx rows=1 width=xxx)
3021                  Sort Key: b1t2.c1
3022                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3023                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
3024                              Hash Cond: (b1t3.c1 = b1t4.c1)
3025                              ->  Seq Scan on t3 b1t3  (cost=xxx rows=1130 width=xxx)
3026                              ->  Hash  (cost=xxx rows=1130 width=xxx)
3027                                    ->  Seq Scan on t4 b1t4  (cost=xxx rows=1130 width=xxx)
3028                        ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=xxx)
3029                              Index Cond: (c1 = b1t3.c1)
3030    InitPlan 2 (returns $3)
3031      ->  Merge Join  (cost=xxx rows=1 width=xxx)
3032            Merge Cond: (b2t1.c1 = b2t2.c1)
3033            ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
3034            ->  Sort  (cost=xxx rows=1 width=xxx)
3035                  Sort Key: b2t2.c1
3036                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3037                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
3038                              Hash Cond: (b2t3.c1 = b2t4.c1)
3039                              ->  Seq Scan on t3 b2t3  (cost=xxx rows=1130 width=xxx)
3040                              ->  Hash  (cost=xxx rows=1130 width=xxx)
3041                                    ->  Seq Scan on t4 b2t4  (cost=xxx rows=1130 width=xxx)
3042                        ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
3043                              Index Cond: (c1 = b2t3.c1)
3044    InitPlan 3 (returns $5)
3045      ->  Merge Join  (cost=xxx rows=1 width=xxx)
3046            Merge Cond: (b3t1.c1 = b3t2.c1)
3047            ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
3048            ->  Sort  (cost=xxx rows=1 width=xxx)
3049                  Sort Key: b3t2.c1
3050                  ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3051                        ->  Hash Join  (cost=xxx rows=1 width=xxx)
3052                              Hash Cond: (b3t3.c1 = b3t4.c1)
3053                              ->  Seq Scan on t3 b3t3  (cost=xxx rows=1130 width=xxx)
3054                              ->  Hash  (cost=xxx rows=1130 width=xxx)
3055                                    ->  Seq Scan on t4 b3t4  (cost=xxx rows=1130 width=xxx)
3056                        ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=xxx)
3057                              Index Cond: (c1 = b3t3.c1)
3058    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
3059          Filter: (c1 <> $5)
3060    ->  Sort  (cost=xxx rows=1 width=xxx)
3061          Sort Key: bmt2.c1
3062          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3063                ->  Hash Join  (cost=xxx rows=1 width=xxx)
3064                      Hash Cond: (bmt3.c1 = bmt4.c1)
3065                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
3066                      ->  Hash  (cost=xxx rows=1 width=xxx)
3067                            ->  Merge Join  (cost=xxx rows=1 width=xxx)
3068                                  Merge Cond: (bmt4.c1 = c1.c1)
3069                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
3070                                  ->  Sort  (cost=xxx rows=1 width=xxx)
3071                                        Sort Key: c1.c1
3072                                        ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
3073                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
3074                      Index Cond: (c1 = bmt3.c1)
3075 (61 rows)
3076
3077 -- No. R-2-2-4
3078 \o results/ut-R.tmpout
3079 /*+
3080 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3081 Leading(b1t4 b1t3 b1t2 b1t1)
3082 MergeJoin(c1 bmt4)
3083 HashJoin(c1 bmt4 bmt3)
3084 NestLoop(c1 bmt4 bmt3 bmt2)
3085 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
3086 MergeJoin(b1t4 b1t3)
3087 HashJoin(b1t4 b1t3 b1t2)
3088 NestLoop(b1t4 b1t3 b1t2 b1t1)
3089 */
3090 EXPLAIN
3091 WITH c1 (c1) AS (
3092 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
3093 )
3094 SELECT bmt1.c1, (
3095 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
3096 )
3097                     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
3098 AND bmt1.c1 <> (
3099 SELECT b3t1.c1 FROM s1.t1 b3t1
3100 );
3101 LOG:  pg_hint_plan:
3102 used hint:
3103 MergeJoin(b1t3 b1t4)
3104 MergeJoin(bmt4 c1)
3105 HashJoin(b1t2 b1t3 b1t4)
3106 HashJoin(bmt3 bmt4 c1)
3107 NestLoop(b1t1 b1t2 b1t3 b1t4)
3108 NestLoop(bmt2 bmt3 bmt4 c1)
3109 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
3110 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3111 Leading(b1t4 b1t3 b1t2 b1t1)
3112 not used hint:
3113 duplication hint:
3114 error hint:
3115
3116 \o
3117 \! sql/maskout.sh results/ut-R.tmpout
3118                                                     QUERY PLAN                                                    
3119 ------------------------------------------------------------------------------------------------------------------
3120  Merge Join  (cost=xxx rows=10 width=xxx)
3121    Merge Cond: (bmt1.c1 = bmt2.c1)
3122    CTE c1
3123      ->  Nested Loop  (cost=xxx rows=100 width=xxx)
3124            Join Filter: (b1t2.c1 = b1t1.c1)
3125            ->  Hash Join  (cost=xxx rows=100 width=xxx)
3126                  Hash Cond: (b1t3.c1 = b1t2.c1)
3127                  ->  Merge Join  (cost=xxx rows=1130 width=xxx)
3128                        Merge Cond: (b1t3.c1 = b1t4.c1)
3129                        ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
3130                        ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1130 width=xxx)
3131                  ->  Hash  (cost=xxx rows=100 width=xxx)
3132                        ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
3133            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3134                  Index Cond: (c1 = b1t3.c1)
3135    InitPlan 2 (returns $2)
3136      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3137            Index Cond: (c1 = 1)
3138    InitPlan 3 (returns $3)
3139      ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=xxx)
3140    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
3141          Filter: (c1 <> $3)
3142    ->  Sort  (cost=xxx rows=100 width=xxx)
3143          Sort Key: bmt2.c1
3144          ->  Nested Loop  (cost=xxx rows=100 width=xxx)
3145                ->  Hash Join  (cost=xxx rows=100 width=xxx)
3146                      Hash Cond: (bmt3.c1 = bmt4.c1)
3147                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
3148                      ->  Hash  (cost=xxx rows=100 width=xxx)
3149                            ->  Merge Join  (cost=xxx rows=100 width=xxx)
3150                                  Merge Cond: (bmt4.c1 = c1.c1)
3151                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
3152                                  ->  Sort  (cost=xxx rows=100 width=xxx)
3153                                        Sort Key: c1.c1
3154                                        ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
3155                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
3156                      Index Cond: (c1 = bmt3.c1)
3157 (37 rows)
3158
3159 \o results/ut-R.tmpout
3160 /*+
3161 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3162 Leading(b1t4 b1t3 b1t2 b1t1)
3163 MergeJoin(c1 bmt4)
3164 HashJoin(c1 bmt4 bmt3)
3165 NestLoop(c1 bmt4 bmt3 bmt2)
3166 MergeJoin(c1 bmt4 bmt3 bmt2 bmt1)
3167 MergeJoin(b1t4 b1t3)
3168 HashJoin(b1t4 b1t3 b1t2)
3169 NestLoop(b1t4 b1t3 b1t2 b1t1)
3170 Rows(c1 bmt4 #1)
3171 Rows(c1 bmt4 bmt3 #1)
3172 Rows(c1 bmt4 bmt3 bmt2 #1)
3173 Rows(c1 bmt4 bmt3 bmt2 bmt1 #1)
3174 Rows(b1t4 b1t3 #1)
3175 Rows(b1t4 b1t3 b1t2 #1)
3176 Rows(b1t4 b1t3 b1t2 b1t1 #1)
3177 */
3178 EXPLAIN
3179 WITH c1 (c1) AS (
3180 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
3181 )
3182 SELECT bmt1.c1, (
3183 SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
3184 )
3185                     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
3186 AND bmt1.c1 <> (
3187 SELECT b3t1.c1 FROM s1.t1 b3t1
3188 );
3189 LOG:  pg_hint_plan:
3190 used hint:
3191 MergeJoin(b1t3 b1t4)
3192 MergeJoin(bmt4 c1)
3193 HashJoin(b1t2 b1t3 b1t4)
3194 HashJoin(bmt3 bmt4 c1)
3195 NestLoop(b1t1 b1t2 b1t3 b1t4)
3196 NestLoop(bmt2 bmt3 bmt4 c1)
3197 MergeJoin(bmt1 bmt2 bmt3 bmt4 c1)
3198 Leading(c1 bmt4 bmt3 bmt2 bmt1)
3199 Leading(b1t4 b1t3 b1t2 b1t1)
3200 Rows(b1t3 b1t4 #1)
3201 Rows(bmt4 c1 #1)
3202 Rows(b1t2 b1t3 b1t4 #1)
3203 Rows(bmt3 bmt4 c1 #1)
3204 Rows(b1t1 b1t2 b1t3 b1t4 #1)
3205 Rows(bmt2 bmt3 bmt4 c1 #1)
3206 Rows(bmt1 bmt2 bmt3 bmt4 c1 #1)
3207 not used hint:
3208 duplication hint:
3209 error hint:
3210
3211 \o
3212 \! sql/maskout.sh results/ut-R.tmpout
3213                                                     QUERY PLAN                                                    
3214 ------------------------------------------------------------------------------------------------------------------
3215  Merge Join  (cost=xxx rows=1 width=xxx)
3216    Merge Cond: (bmt1.c1 = bmt2.c1)
3217    CTE c1
3218      ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3219            Join Filter: (b1t2.c1 = b1t1.c1)
3220            ->  Hash Join  (cost=xxx rows=1 width=xxx)
3221                  Hash Cond: (b1t3.c1 = b1t2.c1)
3222                  ->  Merge Join  (cost=xxx rows=1 width=xxx)
3223                        Merge Cond: (b1t3.c1 = b1t4.c1)
3224                        ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1130 width=xxx)
3225                        ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1130 width=xxx)
3226                  ->  Hash  (cost=xxx rows=100 width=xxx)
3227                        ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
3228            ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3229                  Index Cond: (c1 = b1t3.c1)
3230    InitPlan 2 (returns $2)
3231      ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3232            Index Cond: (c1 = 1)
3233    InitPlan 3 (returns $3)
3234      ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=xxx)
3235    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
3236          Filter: (c1 <> $3)
3237    ->  Sort  (cost=xxx rows=1 width=xxx)
3238          Sort Key: bmt2.c1
3239          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3240                ->  Hash Join  (cost=xxx rows=1 width=xxx)
3241                      Hash Cond: (bmt3.c1 = bmt4.c1)
3242                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
3243                      ->  Hash  (cost=xxx rows=1 width=xxx)
3244                            ->  Merge Join  (cost=xxx rows=1 width=xxx)
3245                                  Merge Cond: (bmt4.c1 = c1.c1)
3246                                  ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1130 width=xxx)
3247                                  ->  Sort  (cost=xxx rows=1 width=xxx)
3248                                        Sort Key: c1.c1
3249                                        ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
3250                ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
3251                      Index Cond: (c1 = bmt3.c1)
3252 (37 rows)
3253
3254 ----
3255 ---- No. R-2-3 RULE or VIEW
3256 ----
3257 -- No. R-2-3-1
3258 \o results/ut-R.tmpout
3259 /*+
3260 Leading(r1 t1 t2 t3 t4)
3261 */
3262 EXPLAIN UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1;
3263 LOG:  pg_hint_plan:
3264 used hint:
3265 Leading(r1 t1 t2 t3 t4)
3266 not used hint:
3267 duplication hint:
3268 error hint:
3269
3270 \o
3271 \! sql/maskout.sh results/ut-R.tmpout
3272                                           QUERY PLAN                                           
3273 -----------------------------------------------------------------------------------------------
3274  Aggregate  (cost=xxx rows=1 width=xxx)
3275    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3276          Join Filter: (t1.c1 = t4.c1)
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                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3291                      TID Cond: (ctid = '(1,1)'::tid)
3292          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3293                TID Cond: (ctid = '(1,1)'::tid)
3294 (20 rows)
3295
3296 \o results/ut-R.tmpout
3297 /*+
3298 Leading(r1 t1 t2 t3 t4)
3299 Rows(r1 t1 t2 t3 t4 #2)
3300 Rows(r1 t1 t2 t3 #2)
3301 Rows(r1 t1 t2 #2)
3302 Rows(r1 t1 #2)
3303 */
3304 EXPLAIN UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1;
3305 LOG:  pg_hint_plan:
3306 used hint:
3307 Leading(r1 t1 t2 t3 t4)
3308 Rows(r1 t1 #2)
3309 Rows(r1 t1 t2 #2)
3310 Rows(r1 t1 t2 t3 #2)
3311 Rows(r1 t1 t2 t3 t4 #2)
3312 not used hint:
3313 duplication hint:
3314 error hint:
3315
3316 \o
3317 \! sql/maskout.sh results/ut-R.tmpout
3318                                    QUERY PLAN                                    
3319 ---------------------------------------------------------------------------------
3320  Aggregate  (cost=xxx rows=1 width=xxx)
3321    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3322          Join Filter: (t1.c1 = t4.c1)
3323          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3324                TID Cond: (ctid = '(1,1)'::tid)
3325          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3326                Join Filter: (t1.c1 = t3.c1)
3327                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3328                      TID Cond: (ctid = '(1,1)'::tid)
3329                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3330                      Join Filter: (t1.c1 = t2.c1)
3331                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3332                            Filter: (ctid = '(1,1)'::tid)
3333                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3334                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3335                                  TID Cond: (ctid = '(1,1)'::tid)
3336                            ->  Seq Scan on r1  (cost=xxx rows=6 width=xxx)
3337                                  Filter: (c1 = 1)
3338 (18 rows)
3339
3340 \o results/ut-R.tmpout
3341 /*+
3342 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
3343 */
3344 EXPLAIN UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1;
3345 LOG:  pg_hint_plan:
3346 used hint:
3347 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
3348 not used hint:
3349 duplication hint:
3350 error hint:
3351
3352 \o
3353 \! sql/maskout.sh results/ut-R.tmpout
3354                                              QUERY PLAN                                             
3355 ----------------------------------------------------------------------------------------------------
3356  Aggregate  (cost=xxx rows=1 width=xxx)
3357    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3358          Join Filter: (b1t1.c1 = b1t4.c1)
3359          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3360                Join Filter: (b1t1.c1 = b1t3.c1)
3361                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3362                      Merge Cond: (b1t1.c1 = b1t2.c1)
3363                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3364                            ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3365                                  Filter: (ctid = '(1,1)'::tid)
3366                            ->  Seq Scan on r1_  (cost=xxx rows=6 width=xxx)
3367                                  Filter: (c1 = 1)
3368                      ->  Sort  (cost=xxx rows=1 width=xxx)
3369                            Sort Key: b1t2.c1
3370                            ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3371                                  Filter: (ctid = '(1,1)'::tid)
3372                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3373                      TID Cond: (ctid = '(1,1)'::tid)
3374          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3375                TID Cond: (ctid = '(1,1)'::tid)
3376 (20 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          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3450                Join Filter: (t1.c1 = t3.c1)
3451                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3452                      Merge Cond: (t1.c1 = t2.c1)
3453                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3454                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3455                                  Filter: (ctid = '(1,1)'::tid)
3456                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3457                                  Filter: (c1 = 1)
3458                      ->  Sort  (cost=xxx rows=1 width=xxx)
3459                            Sort Key: t2.c1
3460                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3461                                  Filter: (ctid = '(1,1)'::tid)
3462                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3463                      TID Cond: (ctid = '(1,1)'::tid)
3464          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3465                TID Cond: (ctid = '(1,1)'::tid)
3466  
3467  Aggregate  (cost=xxx rows=1 width=xxx)
3468    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3469          Join Filter: (t1.c1 = t4.c1)
3470          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3471                Join Filter: (t1.c1 = t3.c1)
3472                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3473                      Merge Cond: (t1.c1 = t2.c1)
3474                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3475                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3476                                  Filter: (ctid = '(1,1)'::tid)
3477                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3478                                  Filter: (c1 = 1)
3479                      ->  Sort  (cost=xxx rows=1 width=xxx)
3480                            Sort Key: t2.c1
3481                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3482                                  Filter: (ctid = '(1,1)'::tid)
3483                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3484                      TID Cond: (ctid = '(1,1)'::tid)
3485          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3486                TID Cond: (ctid = '(1,1)'::tid)
3487 (41 rows)
3488
3489 \o results/ut-R.tmpout
3490 /*+
3491 Leading(r2 t1 t2 t3 t4)
3492 Rows(r2 t1 t2 t3 t4 #2)
3493 Rows(r2 t1 t2 t3 #2)
3494 Rows(r2 t1 t2 #2)
3495 Rows(r2 t1 #2)
3496 */
3497 EXPLAIN UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1;
3498 LOG:  pg_hint_plan:
3499 used hint:
3500 Leading(r2 t1 t2 t3 t4)
3501 Rows(r2 t1 #2)
3502 Rows(r2 t1 t2 #2)
3503 Rows(r2 t1 t2 t3 #2)
3504 Rows(r2 t1 t2 t3 t4 #2)
3505 not used hint:
3506 duplication hint:
3507 error hint:
3508
3509 LOG:  pg_hint_plan:
3510 used hint:
3511 Leading(r2 t1 t2 t3 t4)
3512 Rows(r2 t1 #2)
3513 Rows(r2 t1 t2 #2)
3514 Rows(r2 t1 t2 t3 #2)
3515 Rows(r2 t1 t2 t3 t4 #2)
3516 not used hint:
3517 duplication hint:
3518 error hint:
3519
3520 \o
3521 \! sql/maskout.sh results/ut-R.tmpout
3522                                    QUERY PLAN                                    
3523 ---------------------------------------------------------------------------------
3524  Aggregate  (cost=xxx rows=1 width=xxx)
3525    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3526          Join Filter: (t1.c1 = t4.c1)
3527          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3528                TID Cond: (ctid = '(1,1)'::tid)
3529          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3530                Join Filter: (t1.c1 = t3.c1)
3531                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3532                      TID Cond: (ctid = '(1,1)'::tid)
3533                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3534                      Join Filter: (t1.c1 = t2.c1)
3535                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3536                            Filter: (ctid = '(1,1)'::tid)
3537                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3538                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3539                                  TID Cond: (ctid = '(1,1)'::tid)
3540                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3541                                  Filter: (c1 = 1)
3542  
3543  Aggregate  (cost=xxx rows=1 width=xxx)
3544    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3545          Join Filter: (t1.c1 = t4.c1)
3546          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3547                TID Cond: (ctid = '(1,1)'::tid)
3548          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3549                Join Filter: (t1.c1 = t3.c1)
3550                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3551                      TID Cond: (ctid = '(1,1)'::tid)
3552                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3553                      Join Filter: (t1.c1 = t2.c1)
3554                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3555                            Filter: (ctid = '(1,1)'::tid)
3556                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3557                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3558                                  TID Cond: (ctid = '(1,1)'::tid)
3559                            ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
3560                                  Filter: (c1 = 1)
3561 (37 rows)
3562
3563 \o results/ut-R.tmpout
3564 /*+
3565 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3566 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3567 */
3568 EXPLAIN UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1;
3569 LOG:  pg_hint_plan:
3570 used hint:
3571 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3572 not used hint:
3573 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3574 duplication hint:
3575 error hint:
3576
3577 LOG:  pg_hint_plan:
3578 used hint:
3579 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3580 not used hint:
3581 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3582 duplication hint:
3583 error hint:
3584
3585 \o
3586 \! sql/maskout.sh results/ut-R.tmpout
3587                                              QUERY PLAN                                             
3588 ----------------------------------------------------------------------------------------------------
3589  Aggregate  (cost=xxx rows=1 width=xxx)
3590    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3591          Join Filter: (b1t1.c1 = b1t4.c1)
3592          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3593                Join Filter: (b1t1.c1 = b1t3.c1)
3594                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3595                      Merge Cond: (b1t1.c1 = b1t2.c1)
3596                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3597                            ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3598                                  Filter: (ctid = '(1,1)'::tid)
3599                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3600                                  Filter: (c1 = 1)
3601                      ->  Sort  (cost=xxx rows=1 width=xxx)
3602                            Sort Key: b1t2.c1
3603                            ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3604                                  Filter: (ctid = '(1,1)'::tid)
3605                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3606                      TID Cond: (ctid = '(1,1)'::tid)
3607          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3608                TID Cond: (ctid = '(1,1)'::tid)
3609  
3610  Aggregate  (cost=xxx rows=1 width=xxx)
3611    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3612          Join Filter: (b2t1.c1 = b2t4.c1)
3613          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3614                Join Filter: (b2t1.c1 = b2t3.c1)
3615                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3616                      Merge Cond: (b2t1.c1 = b2t2.c1)
3617                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3618                            ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3619                                  Filter: (ctid = '(1,1)'::tid)
3620                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3621                                  Filter: (c1 = 1)
3622                      ->  Sort  (cost=xxx rows=1 width=xxx)
3623                            Sort Key: b2t2.c1
3624                            ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
3625                                  Filter: (ctid = '(1,1)'::tid)
3626                ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
3627                      TID Cond: (ctid = '(1,1)'::tid)
3628          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
3629                TID Cond: (ctid = '(1,1)'::tid)
3630 (41 rows)
3631
3632 \o results/ut-R.tmpout
3633 /*+
3634 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3635 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3636 Rows(r2_ b1t1 #2)
3637 Rows(r2_ b1t1 b1t2 #2)
3638 Rows(r2_ b1t1 b1t2 b1t3 #2)
3639 Rows(r2_ b1t1 b1t2 b1t3 b1t4 #2)
3640 Rows(r2_ b2t1 #2)
3641 Rows(r2_ b2t1 b2t2 #2)
3642 Rows(r2_ b2t1 b2t2 b2t3  #2)
3643 Rows(r2_ b2t1 b2t2 b2t3 b2t4 #2)
3644 */
3645 EXPLAIN UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1;
3646 LOG:  pg_hint_plan:
3647 used hint:
3648 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3649 Rows(b1t1 r2_ #2)
3650 Rows(b1t1 b1t2 r2_ #2)
3651 Rows(b1t1 b1t2 b1t3 r2_ #2)
3652 Rows(b1t1 b1t2 b1t3 b1t4 r2_ #2)
3653 not used hint:
3654 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3655 Rows(b2t1 r2_ #2)
3656 Rows(b2t1 b2t2 r2_ #2)
3657 Rows(b2t1 b2t2 b2t3 r2_ #2)
3658 Rows(b2t1 b2t2 b2t3 b2t4 r2_ #2)
3659 duplication hint:
3660 error hint:
3661
3662 LOG:  pg_hint_plan:
3663 used hint:
3664 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
3665 Rows(b2t1 r2_ #2)
3666 Rows(b2t1 b2t2 r2_ #2)
3667 Rows(b2t1 b2t2 b2t3 r2_ #2)
3668 Rows(b2t1 b2t2 b2t3 b2t4 r2_ #2)
3669 not used hint:
3670 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
3671 Rows(b1t1 r2_ #2)
3672 Rows(b1t1 b1t2 r2_ #2)
3673 Rows(b1t1 b1t2 b1t3 r2_ #2)
3674 Rows(b1t1 b1t2 b1t3 b1t4 r2_ #2)
3675 duplication hint:
3676 error hint:
3677
3678 \o
3679 \! sql/maskout.sh results/ut-R.tmpout
3680                                      QUERY PLAN                                      
3681 -------------------------------------------------------------------------------------
3682  Aggregate  (cost=xxx rows=1 width=xxx)
3683    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3684          Join Filter: (b1t1.c1 = b1t4.c1)
3685          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3686                TID Cond: (ctid = '(1,1)'::tid)
3687          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3688                Join Filter: (b1t1.c1 = b1t3.c1)
3689                ->  Tid Scan on t3 b1t3  (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 = b1t2.c1)
3693                      ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3694                            Filter: (ctid = '(1,1)'::tid)
3695                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3696                            ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
3697                                  TID Cond: (ctid = '(1,1)'::tid)
3698                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3699                                  Filter: (c1 = 1)
3700  
3701  Aggregate  (cost=xxx rows=1 width=xxx)
3702    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3703          Join Filter: (b2t1.c1 = b2t4.c1)
3704          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
3705                TID Cond: (ctid = '(1,1)'::tid)
3706          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3707                Join Filter: (b2t1.c1 = b2t3.c1)
3708                ->  Tid Scan on t3 b2t3  (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 = b2t2.c1)
3712                      ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
3713                            Filter: (ctid = '(1,1)'::tid)
3714                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3715                            ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=xxx)
3716                                  TID Cond: (ctid = '(1,1)'::tid)
3717                            ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
3718                                  Filter: (c1 = 1)
3719 (37 rows)
3720
3721 -- No. R-2-3-3
3722 \o results/ut-R.tmpout
3723 /*+
3724 Leading(r3 t1 t2 t3 t4)
3725 */
3726 EXPLAIN UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1;
3727 LOG:  pg_hint_plan:
3728 used hint:
3729 Leading(r3 t1 t2 t3 t4)
3730 not used hint:
3731 duplication hint:
3732 error hint:
3733
3734 LOG:  pg_hint_plan:
3735 used hint:
3736 Leading(r3 t1 t2 t3 t4)
3737 not used hint:
3738 duplication hint:
3739 error hint:
3740
3741 LOG:  pg_hint_plan:
3742 used hint:
3743 Leading(r3 t1 t2 t3 t4)
3744 not used hint:
3745 duplication hint:
3746 error hint:
3747
3748 \o
3749 \! sql/maskout.sh results/ut-R.tmpout
3750                                           QUERY PLAN                                           
3751 -----------------------------------------------------------------------------------------------
3752  Aggregate  (cost=xxx rows=1 width=xxx)
3753    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3754          Join Filter: (t1.c1 = t4.c1)
3755          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3756                Join Filter: (t1.c1 = t3.c1)
3757                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3758                      Merge Cond: (t1.c1 = t2.c1)
3759                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3760                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3761                                  Filter: (ctid = '(1,1)'::tid)
3762                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3763                                  Filter: (c1 = 1)
3764                      ->  Sort  (cost=xxx rows=1 width=xxx)
3765                            Sort Key: t2.c1
3766                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3767                                  Filter: (ctid = '(1,1)'::tid)
3768                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3769                      TID Cond: (ctid = '(1,1)'::tid)
3770          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3771                TID Cond: (ctid = '(1,1)'::tid)
3772  
3773  Aggregate  (cost=xxx rows=1 width=xxx)
3774    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3775          Join Filter: (t1.c1 = t4.c1)
3776          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3777                Join Filter: (t1.c1 = t3.c1)
3778                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3779                      Merge Cond: (t1.c1 = t2.c1)
3780                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3781                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3782                                  Filter: (ctid = '(1,1)'::tid)
3783                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3784                                  Filter: (c1 = 1)
3785                      ->  Sort  (cost=xxx rows=1 width=xxx)
3786                            Sort Key: t2.c1
3787                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3788                                  Filter: (ctid = '(1,1)'::tid)
3789                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3790                      TID Cond: (ctid = '(1,1)'::tid)
3791          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3792                TID Cond: (ctid = '(1,1)'::tid)
3793  
3794  Aggregate  (cost=xxx rows=1 width=xxx)
3795    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3796          Join Filter: (t1.c1 = t4.c1)
3797          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3798                Join Filter: (t1.c1 = t3.c1)
3799                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3800                      Merge Cond: (t1.c1 = t2.c1)
3801                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3802                            ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
3803                                  Filter: (ctid = '(1,1)'::tid)
3804                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3805                                  Filter: (c1 = 1)
3806                      ->  Sort  (cost=xxx rows=1 width=xxx)
3807                            Sort Key: t2.c1
3808                            ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3809                                  Filter: (ctid = '(1,1)'::tid)
3810                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3811                      TID Cond: (ctid = '(1,1)'::tid)
3812          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3813                TID Cond: (ctid = '(1,1)'::tid)
3814 (62 rows)
3815
3816 \o results/ut-R.tmpout
3817 /*+
3818 Leading(r3 t1 t2 t3 t4)
3819 Rows(r3 t1 t2 t3 t4 #2)
3820 Rows(r3 t1 t2 t3 #2)
3821 Rows(r3 t1 t2 #2)
3822 Rows(r3 t1 #2)
3823 */
3824 EXPLAIN UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1;
3825 LOG:  pg_hint_plan:
3826 used hint:
3827 Leading(r3 t1 t2 t3 t4)
3828 Rows(r3 t1 #2)
3829 Rows(r3 t1 t2 #2)
3830 Rows(r3 t1 t2 t3 #2)
3831 Rows(r3 t1 t2 t3 t4 #2)
3832 not used hint:
3833 duplication hint:
3834 error hint:
3835
3836 LOG:  pg_hint_plan:
3837 used hint:
3838 Leading(r3 t1 t2 t3 t4)
3839 Rows(r3 t1 #2)
3840 Rows(r3 t1 t2 #2)
3841 Rows(r3 t1 t2 t3 #2)
3842 Rows(r3 t1 t2 t3 t4 #2)
3843 not used hint:
3844 duplication hint:
3845 error hint:
3846
3847 LOG:  pg_hint_plan:
3848 used hint:
3849 Leading(r3 t1 t2 t3 t4)
3850 Rows(r3 t1 #2)
3851 Rows(r3 t1 t2 #2)
3852 Rows(r3 t1 t2 t3 #2)
3853 Rows(r3 t1 t2 t3 t4 #2)
3854 not used hint:
3855 duplication hint:
3856 error hint:
3857
3858 \o
3859 \! sql/maskout.sh results/ut-R.tmpout
3860                                    QUERY PLAN                                    
3861 ---------------------------------------------------------------------------------
3862  Aggregate  (cost=xxx rows=1 width=xxx)
3863    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3864          Join Filter: (t1.c1 = t4.c1)
3865          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3866                TID Cond: (ctid = '(1,1)'::tid)
3867          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3868                Join Filter: (t1.c1 = t3.c1)
3869                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3870                      TID Cond: (ctid = '(1,1)'::tid)
3871                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3872                      Join Filter: (t1.c1 = t2.c1)
3873                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3874                            Filter: (ctid = '(1,1)'::tid)
3875                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3876                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3877                                  TID Cond: (ctid = '(1,1)'::tid)
3878                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3879                                  Filter: (c1 = 1)
3880  
3881  Aggregate  (cost=xxx rows=1 width=xxx)
3882    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3883          Join Filter: (t1.c1 = t4.c1)
3884          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3885                TID Cond: (ctid = '(1,1)'::tid)
3886          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3887                Join Filter: (t1.c1 = t3.c1)
3888                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3889                      TID Cond: (ctid = '(1,1)'::tid)
3890                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3891                      Join Filter: (t1.c1 = t2.c1)
3892                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3893                            Filter: (ctid = '(1,1)'::tid)
3894                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3895                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3896                                  TID Cond: (ctid = '(1,1)'::tid)
3897                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3898                                  Filter: (c1 = 1)
3899  
3900  Aggregate  (cost=xxx rows=1 width=xxx)
3901    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3902          Join Filter: (t1.c1 = t4.c1)
3903          ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
3904                TID Cond: (ctid = '(1,1)'::tid)
3905          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3906                Join Filter: (t1.c1 = t3.c1)
3907                ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
3908                      TID Cond: (ctid = '(1,1)'::tid)
3909                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3910                      Join Filter: (t1.c1 = t2.c1)
3911                      ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
3912                            Filter: (ctid = '(1,1)'::tid)
3913                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
3914                            ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
3915                                  TID Cond: (ctid = '(1,1)'::tid)
3916                            ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
3917                                  Filter: (c1 = 1)
3918 (56 rows)
3919
3920 \o results/ut-R.tmpout
3921 /*+
3922 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3923 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3924 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3925 */
3926 EXPLAIN UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1;
3927 LOG:  pg_hint_plan:
3928 used hint:
3929 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3930 not used hint:
3931 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3932 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3933 duplication hint:
3934 error hint:
3935
3936 LOG:  pg_hint_plan:
3937 used hint:
3938 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3939 not used hint:
3940 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3941 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3942 duplication hint:
3943 error hint:
3944
3945 LOG:  pg_hint_plan:
3946 used hint:
3947 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
3948 not used hint:
3949 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
3950 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
3951 duplication hint:
3952 error hint:
3953
3954 \o
3955 \! sql/maskout.sh results/ut-R.tmpout
3956                                              QUERY PLAN                                             
3957 ----------------------------------------------------------------------------------------------------
3958  Aggregate  (cost=xxx rows=1 width=xxx)
3959    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3960          Join Filter: (b1t1.c1 = b1t4.c1)
3961          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3962                Join Filter: (b1t1.c1 = b1t3.c1)
3963                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3964                      Merge Cond: (b1t1.c1 = b1t2.c1)
3965                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3966                            ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
3967                                  Filter: (ctid = '(1,1)'::tid)
3968                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
3969                                  Filter: (c1 = 1)
3970                      ->  Sort  (cost=xxx rows=1 width=xxx)
3971                            Sort Key: b1t2.c1
3972                            ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
3973                                  Filter: (ctid = '(1,1)'::tid)
3974                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
3975                      TID Cond: (ctid = '(1,1)'::tid)
3976          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
3977                TID Cond: (ctid = '(1,1)'::tid)
3978  
3979  Aggregate  (cost=xxx rows=1 width=xxx)
3980    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3981          Join Filter: (b2t1.c1 = b2t4.c1)
3982          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
3983                Join Filter: (b2t1.c1 = b2t3.c1)
3984                ->  Merge Join  (cost=xxx rows=1 width=xxx)
3985                      Merge Cond: (b2t1.c1 = b2t2.c1)
3986                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
3987                            ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
3988                                  Filter: (ctid = '(1,1)'::tid)
3989                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
3990                                  Filter: (c1 = 1)
3991                      ->  Sort  (cost=xxx rows=1 width=xxx)
3992                            Sort Key: b2t2.c1
3993                            ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
3994                                  Filter: (ctid = '(1,1)'::tid)
3995                ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
3996                      TID Cond: (ctid = '(1,1)'::tid)
3997          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
3998                TID Cond: (ctid = '(1,1)'::tid)
3999  
4000  Aggregate  (cost=xxx rows=1 width=xxx)
4001    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4002          Join Filter: (b3t1.c1 = b3t4.c1)
4003          ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4004                Join Filter: (b3t1.c1 = b3t3.c1)
4005                ->  Merge Join  (cost=xxx rows=1 width=xxx)
4006                      Merge Cond: (b3t1.c1 = b3t2.c1)
4007                      ->  Nested Loop  (cost=xxx rows=6 width=xxx)
4008                            ->  Index Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
4009                                  Filter: (ctid = '(1,1)'::tid)
4010                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4011                                  Filter: (c1 = 1)
4012                      ->  Sort  (cost=xxx rows=1 width=xxx)
4013                            Sort Key: b3t2.c1
4014                            ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=xxx)
4015                                  Filter: (ctid = '(1,1)'::tid)
4016                ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=xxx)
4017                      TID Cond: (ctid = '(1,1)'::tid)
4018          ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=xxx)
4019                TID Cond: (ctid = '(1,1)'::tid)
4020 (62 rows)
4021
4022 \o results/ut-R.tmpout
4023 /*+
4024 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4025 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4026 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4027 Rows(r3_ b1t1 #2)
4028 Rows(r3_ b1t1 b1t2 #2)
4029 Rows(r3_ b1t1 b1t2 b1t3 #2)
4030 Rows(r3_ b1t1 b1t2 b1t3 b1t4 #2)
4031 Rows(r3_ b2t1 #2)
4032 Rows(r3_ b2t1 b2t2 #2)
4033 Rows(r3_ b2t1 b2t2 b2t3 #2)
4034 Rows(r3_ b2t1 b2t2 b2t3 b2t4 #2)
4035 Rows(r3_ b3t1 #2)
4036 Rows(r3_ b3t1 b3t2 #2)
4037 Rows(r3_ b3t1 b3t2 b3t3 #2)
4038 Rows(r3_ b3t1 b3t2 b3t3 b3t4 #2)
4039 */
4040 EXPLAIN UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1;
4041 LOG:  pg_hint_plan:
4042 used hint:
4043 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4044 Rows(b1t1 r3_ #2)
4045 Rows(b1t1 b1t2 r3_ #2)
4046 Rows(b1t1 b1t2 b1t3 r3_ #2)
4047 Rows(b1t1 b1t2 b1t3 b1t4 r3_ #2)
4048 not used hint:
4049 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4050 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4051 Rows(b2t1 r3_ #2)
4052 Rows(b3t1 r3_ #2)
4053 Rows(b2t1 b2t2 r3_ #2)
4054 Rows(b3t1 b3t2 r3_ #2)
4055 Rows(b2t1 b2t2 b2t3 r3_ #2)
4056 Rows(b3t1 b3t2 b3t3 r3_ #2)
4057 Rows(b2t1 b2t2 b2t3 b2t4 r3_ #2)
4058 Rows(b3t1 b3t2 b3t3 b3t4 r3_ #2)
4059 duplication hint:
4060 error hint:
4061
4062 LOG:  pg_hint_plan:
4063 used hint:
4064 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4065 Rows(b2t1 r3_ #2)
4066 Rows(b2t1 b2t2 r3_ #2)
4067 Rows(b2t1 b2t2 b2t3 r3_ #2)
4068 Rows(b2t1 b2t2 b2t3 b2t4 r3_ #2)
4069 not used hint:
4070 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4071 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4072 Rows(b1t1 r3_ #2)
4073 Rows(b3t1 r3_ #2)
4074 Rows(b1t1 b1t2 r3_ #2)
4075 Rows(b3t1 b3t2 r3_ #2)
4076 Rows(b1t1 b1t2 b1t3 r3_ #2)
4077 Rows(b3t1 b3t2 b3t3 r3_ #2)
4078 Rows(b1t1 b1t2 b1t3 b1t4 r3_ #2)
4079 Rows(b3t1 b3t2 b3t3 b3t4 r3_ #2)
4080 duplication hint:
4081 error hint:
4082
4083 LOG:  pg_hint_plan:
4084 used hint:
4085 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
4086 Rows(b3t1 r3_ #2)
4087 Rows(b3t1 b3t2 r3_ #2)
4088 Rows(b3t1 b3t2 b3t3 r3_ #2)
4089 Rows(b3t1 b3t2 b3t3 b3t4 r3_ #2)
4090 not used hint:
4091 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
4092 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
4093 Rows(b1t1 r3_ #2)
4094 Rows(b2t1 r3_ #2)
4095 Rows(b1t1 b1t2 r3_ #2)
4096 Rows(b2t1 b2t2 r3_ #2)
4097 Rows(b1t1 b1t2 b1t3 r3_ #2)
4098 Rows(b2t1 b2t2 b2t3 r3_ #2)
4099 Rows(b1t1 b1t2 b1t3 b1t4 r3_ #2)
4100 Rows(b2t1 b2t2 b2t3 b2t4 r3_ #2)
4101 duplication hint:
4102 error hint:
4103
4104 \o
4105 \! sql/maskout.sh results/ut-R.tmpout
4106                                      QUERY PLAN                                      
4107 -------------------------------------------------------------------------------------
4108  Aggregate  (cost=xxx rows=1 width=xxx)
4109    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4110          Join Filter: (b1t1.c1 = b1t4.c1)
4111          ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
4112                TID Cond: (ctid = '(1,1)'::tid)
4113          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4114                Join Filter: (b1t1.c1 = b1t3.c1)
4115                ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
4116                      TID Cond: (ctid = '(1,1)'::tid)
4117                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4118                      Join Filter: (b1t1.c1 = b1t2.c1)
4119                      ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
4120                            Filter: (ctid = '(1,1)'::tid)
4121                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4122                            ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
4123                                  TID Cond: (ctid = '(1,1)'::tid)
4124                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4125                                  Filter: (c1 = 1)
4126  
4127  Aggregate  (cost=xxx rows=1 width=xxx)
4128    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4129          Join Filter: (b2t1.c1 = b2t4.c1)
4130          ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
4131                TID Cond: (ctid = '(1,1)'::tid)
4132          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4133                Join Filter: (b2t1.c1 = b2t3.c1)
4134                ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
4135                      TID Cond: (ctid = '(1,1)'::tid)
4136                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4137                      Join Filter: (b2t1.c1 = b2t2.c1)
4138                      ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
4139                            Filter: (ctid = '(1,1)'::tid)
4140                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4141                            ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=xxx)
4142                                  TID Cond: (ctid = '(1,1)'::tid)
4143                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4144                                  Filter: (c1 = 1)
4145  
4146  Aggregate  (cost=xxx rows=1 width=xxx)
4147    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4148          Join Filter: (b3t1.c1 = b3t4.c1)
4149          ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=xxx)
4150                TID Cond: (ctid = '(1,1)'::tid)
4151          ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4152                Join Filter: (b3t1.c1 = b3t3.c1)
4153                ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=xxx)
4154                      TID Cond: (ctid = '(1,1)'::tid)
4155                ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4156                      Join Filter: (b3t1.c1 = b3t2.c1)
4157                      ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=xxx)
4158                            Filter: (ctid = '(1,1)'::tid)
4159                      ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4160                            ->  Tid Scan on t1 b3t1  (cost=xxx rows=1 width=xxx)
4161                                  TID Cond: (ctid = '(1,1)'::tid)
4162                            ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
4163                                  Filter: (c1 = 1)
4164 (56 rows)
4165
4166 -- No. R-2-3-4
4167 \o results/ut-R.tmpout
4168 /*+HashJoin(v1t1 v1t1)*/
4169 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
4170 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(v1t1 v1t1)"
4171 DETAIL:  Relation name "v1t1" is ambiguous.
4172 LOG:  pg_hint_plan:
4173 used hint:
4174 not used hint:
4175 duplication hint:
4176 error hint:
4177 HashJoin(v1t1 v1t1)
4178
4179 \o
4180 \! sql/maskout.sh results/ut-R.tmpout
4181                                 QUERY PLAN                                
4182 --------------------------------------------------------------------------
4183  Hash Join  (cost=xxx rows=1000 width=xxx)
4184    Hash Cond: (v1t1.c1 = v1t1_1.c1)
4185    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4186    ->  Hash  (cost=xxx rows=1000 width=xxx)
4187          ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
4188 (5 rows)
4189
4190 \o results/ut-R.tmpout
4191 /*+HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)*/
4192 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
4193 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)"
4194 DETAIL:  Relation name "v1t1" is ambiguous.
4195 INFO:  pg_hint_plan: hint syntax error at or near "Rows(v1t1 v1t1 #1)"
4196 DETAIL:  Relation name "v1t1" is ambiguous.
4197 LOG:  pg_hint_plan:
4198 used hint:
4199 not used hint:
4200 duplication hint:
4201 error hint:
4202 HashJoin(v1t1 v1t1)
4203 Rows(v1t1 v1t1 #1)
4204
4205 \o
4206 \! sql/maskout.sh results/ut-R.tmpout
4207                                 QUERY PLAN                                
4208 --------------------------------------------------------------------------
4209  Hash Join  (cost=xxx rows=1000 width=xxx)
4210    Hash Cond: (v1t1.c1 = v1t1_1.c1)
4211    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4212    ->  Hash  (cost=xxx rows=1000 width=xxx)
4213          ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
4214 (5 rows)
4215
4216 -- No. R-2-3-5
4217 \o results/ut-R.tmpout
4218 /*+NestLoop(v1t1 v1t1_)*/
4219 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
4220 LOG:  pg_hint_plan:
4221 used hint:
4222 NestLoop(v1t1 v1t1_)
4223 not used hint:
4224 duplication hint:
4225 error hint:
4226
4227 \o
4228 \! sql/maskout.sh results/ut-R.tmpout
4229                                  QUERY PLAN                                  
4230 -----------------------------------------------------------------------------
4231  Nested Loop  (cost=xxx rows=1000 width=xxx)
4232    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4233    ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=xxx)
4234          Index Cond: (c1 = v1t1.c1)
4235 (4 rows)
4236
4237 \o results/ut-R.tmpout
4238 /*+NestLoop(v1t1 v1t1_)Rows(v1t1 v1t1_ #1)*/
4239 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
4240 LOG:  pg_hint_plan:
4241 used hint:
4242 NestLoop(v1t1 v1t1_)
4243 Rows(v1t1 v1t1_ #1)
4244 not used hint:
4245 duplication hint:
4246 error hint:
4247
4248 \o
4249 \! sql/maskout.sh results/ut-R.tmpout
4250                                  QUERY PLAN                                  
4251 -----------------------------------------------------------------------------
4252  Nested Loop  (cost=xxx rows=1 width=xxx)
4253    ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
4254    ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=xxx)
4255          Index Cond: (c1 = v1t1.c1)
4256 (4 rows)
4257
4258 -- No. R-2-3-6
4259 \o results/ut-R.tmpout
4260 /*+RowsHashJoin(r4t1 r4t1)*/
4261 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
4262 INFO:  pg_hint_plan: hint syntax error at or near "RowsHashJoin(r4t1 r4t1)"
4263 DETAIL:  Unrecognized hint keyword "RowsHashJoin".
4264 \o
4265 \! sql/maskout.sh results/ut-R.tmpout
4266                                 QUERY PLAN                                
4267 --------------------------------------------------------------------------
4268  Hash Join  (cost=xxx rows=1000 width=xxx)
4269    Hash Cond: (r4t1.c1 = r4t1_1.c1)
4270    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4271    ->  Hash  (cost=xxx rows=1000 width=xxx)
4272          ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=xxx)
4273 (5 rows)
4274
4275 \o results/ut-R.tmpout
4276 /*+RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)*/
4277 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
4278 INFO:  pg_hint_plan: hint syntax error at or near "RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)"
4279 DETAIL:  Unrecognized hint keyword "RowsHashJoin".
4280 \o
4281 \! sql/maskout.sh results/ut-R.tmpout
4282                                 QUERY PLAN                                
4283 --------------------------------------------------------------------------
4284  Hash Join  (cost=xxx rows=1000 width=xxx)
4285    Hash Cond: (r4t1.c1 = r4t1_1.c1)
4286    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4287    ->  Hash  (cost=xxx rows=1000 width=xxx)
4288          ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=xxx)
4289 (5 rows)
4290
4291 -- No. R-2-3-7
4292 \o results/ut-R.tmpout
4293 /*+NestLoop(r4t1 r5t1)*/
4294 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
4295 LOG:  pg_hint_plan:
4296 used hint:
4297 NestLoop(r4t1 r5t1)
4298 not used hint:
4299 duplication hint:
4300 error hint:
4301
4302 \o
4303 \! sql/maskout.sh results/ut-R.tmpout
4304                                  QUERY PLAN                                 
4305 ----------------------------------------------------------------------------
4306  Nested Loop  (cost=xxx rows=1000 width=xxx)
4307    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4308    ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=xxx)
4309          Index Cond: (c1 = r4t1.c1)
4310 (4 rows)
4311
4312 \o results/ut-R.tmpout
4313 /*+NestLoop(r4t1 r5t1)Rows(r4t1 r5t1 #1)*/
4314 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
4315 LOG:  pg_hint_plan:
4316 used hint:
4317 NestLoop(r4t1 r5t1)
4318 Rows(r4t1 r5t1 #1)
4319 not used hint:
4320 duplication hint:
4321 error hint:
4322
4323 \o
4324 \! sql/maskout.sh results/ut-R.tmpout
4325                                  QUERY PLAN                                 
4326 ----------------------------------------------------------------------------
4327  Nested Loop  (cost=xxx rows=1 width=xxx)
4328    ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
4329    ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=xxx)
4330          Index Cond: (c1 = r4t1.c1)
4331 (4 rows)
4332
4333 ----
4334 ---- No. R-2-4 VALUES clause
4335 ----
4336 -- No. R-2-4-1
4337 \o results/ut-R.tmpout
4338 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;
4339 \o
4340 \! sql/maskout.sh results/ut-R.tmpout
4341                                    QUERY PLAN                                   
4342 --------------------------------------------------------------------------------
4343  Nested Loop  (cost=xxx rows=1 width=xxx)
4344    ->  Hash Join  (cost=xxx rows=2 width=xxx)
4345          Hash Cond: (t2.c1 = "*VALUES*".column1)
4346          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4347          ->  Hash  (cost=xxx rows=2 width=xxx)
4348                ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4349    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4350          Index Cond: (c1 = t2.c1)
4351 (8 rows)
4352
4353 \o results/ut-R.tmpout
4354 /*+ Leading(t3 t1 t2) Rows(t3 t1 #2)Rows(t3 t1 t2 #2)*/
4355 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;
4356 LOG:  pg_hint_plan:
4357 used hint:
4358 not used hint:
4359 Leading(t3 t1 t2)
4360 Rows(t1 t3 #2)
4361 Rows(t1 t2 t3 #2)
4362 duplication hint:
4363 error hint:
4364
4365 \o
4366 \! sql/maskout.sh results/ut-R.tmpout
4367                                    QUERY PLAN                                   
4368 --------------------------------------------------------------------------------
4369  Nested Loop  (cost=xxx rows=1 width=xxx)
4370    ->  Hash Join  (cost=xxx rows=2 width=xxx)
4371          Hash Cond: (t2.c1 = "*VALUES*".column1)
4372          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4373          ->  Hash  (cost=xxx rows=2 width=xxx)
4374                ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4375    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4376          Index Cond: (c1 = t2.c1)
4377 (8 rows)
4378
4379 \o results/ut-R.tmpout
4380 /*+ Leading(*VALUES* t1 t2) Rows(*VALUES* t1 #2)Rows(*VALUES* t1 t2 #20)*/
4381 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;
4382 LOG:  pg_hint_plan:
4383 used hint:
4384 Leading(*VALUES* t1 t2)
4385 Rows(*VALUES* t1 #2)
4386 Rows(*VALUES* t1 t2 #20)
4387 not used hint:
4388 duplication hint:
4389 error hint:
4390
4391 \o
4392 \! sql/maskout.sh results/ut-R.tmpout
4393                                  QUERY PLAN                                  
4394 -----------------------------------------------------------------------------
4395  Nested Loop  (cost=xxx rows=20 width=xxx)
4396    ->  Nested Loop  (cost=xxx rows=2 width=xxx)
4397          ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4398          ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4399                Index Cond: (c1 = "*VALUES*".column1)
4400    ->  Index Scan using t2_i1 on t2  (cost=xxx rows=1 width=xxx)
4401          Index Cond: (c1 = t1.c1)
4402 (7 rows)
4403
4404 -- No. R-2-4-2
4405 \o results/ut-R.tmpout
4406 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;
4407 \o
4408 \! sql/maskout.sh results/ut-R.tmpout
4409                                       QUERY PLAN                                      
4410 --------------------------------------------------------------------------------------
4411  Nested Loop  (cost=xxx rows=1 width=xxx)
4412    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4413          Join Filter: (t2.c1 = "*VALUES*_1".column1)
4414          ->  Hash Join  (cost=xxx rows=2 width=xxx)
4415                Hash Cond: (t2.c1 = "*VALUES*".column1)
4416                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4417                ->  Hash  (cost=xxx rows=2 width=xxx)
4418                      ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4419          ->  Materialize  (cost=xxx rows=2 width=xxx)
4420                ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
4421    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4422          Index Cond: (c1 = t2.c1)
4423 (12 rows)
4424
4425 \o results/ut-R.tmpout
4426 /*+ Leading(t4 t3 t2 t1) Rows(t4 t3 #2) Rows(t4 t3 t2 #2)Rows(t4 t3 t2 t1 #2)*/
4427 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;
4428 LOG:  pg_hint_plan:
4429 used hint:
4430 not used hint:
4431 Leading(t4 t3 t2 t1)
4432 Rows(t3 t4 #2)
4433 Rows(t2 t3 t4 #2)
4434 Rows(t1 t2 t3 t4 #2)
4435 duplication hint:
4436 error hint:
4437
4438 \o
4439 \! sql/maskout.sh results/ut-R.tmpout
4440                                       QUERY PLAN                                      
4441 --------------------------------------------------------------------------------------
4442  Nested Loop  (cost=xxx rows=1 width=xxx)
4443    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4444          Join Filter: (t2.c1 = "*VALUES*_1".column1)
4445          ->  Hash Join  (cost=xxx rows=2 width=xxx)
4446                Hash Cond: (t2.c1 = "*VALUES*".column1)
4447                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4448                ->  Hash  (cost=xxx rows=2 width=xxx)
4449                      ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4450          ->  Materialize  (cost=xxx rows=2 width=xxx)
4451                ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
4452    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4453          Index Cond: (c1 = t2.c1)
4454 (12 rows)
4455
4456 \o results/ut-R.tmpout
4457 /*+ Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)*/
4458 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;
4459 INFO:  pg_hint_plan: hint syntax error at or near "Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)"
4460 DETAIL:  Relation name "*VALUES*" is ambiguous.
4461 INFO:  pg_hint_plan: hint syntax error at or near "Rows(*VALUES* t3 t2 t1 #2)"
4462 DETAIL:  Relation name "*VALUES*" is ambiguous.
4463 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)"
4464 DETAIL:  Relation name "*VALUES*" is ambiguous.
4465 LOG:  pg_hint_plan:
4466 used hint:
4467 not used hint:
4468 Rows(t3 t4 #2)
4469 duplication hint:
4470 error hint:
4471 Leading(*VALUES* t3 t2 t1)
4472 Rows(*VALUES* t2 t3 #2)
4473 Rows(*VALUES* t1 t2 t3 #2)
4474
4475 \o
4476 \! sql/maskout.sh results/ut-R.tmpout
4477                                       QUERY PLAN                                      
4478 --------------------------------------------------------------------------------------
4479  Nested Loop  (cost=xxx rows=1 width=xxx)
4480    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
4481          Join Filter: (t2.c1 = "*VALUES*_1".column1)
4482          ->  Hash Join  (cost=xxx rows=2 width=xxx)
4483                Hash Cond: (t2.c1 = "*VALUES*".column1)
4484                ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4485                ->  Hash  (cost=xxx rows=2 width=xxx)
4486                      ->  Values Scan on "*VALUES*"  (cost=xxx rows=2 width=xxx)
4487          ->  Materialize  (cost=xxx rows=2 width=xxx)
4488                ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
4489    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
4490          Index Cond: (c1 = t2.c1)
4491 (12 rows)
4492
4493 ----
4494 ---- No. R-2-5
4495 ----
4496 -- No. R-2-5-1
4497 \o results/ut-R.tmpout
4498 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;
4499 \o
4500 \! sql/maskout.sh results/ut-R.tmpout
4501                                               QUERY PLAN                                              
4502 ------------------------------------------------------------------------------------------------------
4503  Aggregate  (cost=xxx rows=1 width=xxx)
4504    ->  Nested Loop  (cost=xxx rows=100 width=xxx)
4505          ->  Merge Join  (cost=xxx rows=100 width=xxx)
4506                Merge Cond: (bmt1.c1 = bmt2.c1)
4507                ->  Merge Join  (cost=xxx rows=1000 width=xxx)
4508                      Merge Cond: (bmt1.c1 = bmt3.c1)
4509                      ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4510                      ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4511                ->  Sort  (cost=xxx rows=100 width=xxx)
4512                      Sort Key: bmt2.c1
4513                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4514          ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
4515                Index Cond: (c1 = bmt1.c1)
4516 (13 rows)
4517
4518 \o results/ut-R.tmpout
4519 /*+
4520 Leading(bmt4 bmt3 bmt2 bmt1)
4521 Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
4522 */
4523 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;
4524 LOG:  pg_hint_plan:
4525 used hint:
4526 Leading(bmt4 bmt3 bmt2 bmt1)
4527 Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
4528 not used hint:
4529 duplication hint:
4530 error hint:
4531
4532 \o
4533 \! sql/maskout.sh results/ut-R.tmpout
4534                                        QUERY PLAN                                        
4535 -----------------------------------------------------------------------------------------
4536  Merge Join  (cost=xxx rows=70 width=xxx)
4537    Merge Cond: (bmt1.c1 = bmt2.c1)
4538    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4539    ->  Sort  (cost=xxx rows=100 width=xxx)
4540          Sort Key: bmt2.c1
4541          ->  Hash Join  (cost=xxx rows=100 width=xxx)
4542                Hash Cond: (bmt3.c1 = bmt2.c1)
4543                ->  Hash Join  (cost=xxx rows=1130 width=xxx)
4544                      Hash Cond: (bmt3.c1 = bmt4.c1)
4545                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4546                      ->  Hash  (cost=xxx rows=1130 width=xxx)
4547                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
4548                ->  Hash  (cost=xxx rows=100 width=xxx)
4549                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4550 (14 rows)
4551
4552 -- No. R-2-5-2
4553 \o results/ut-R.tmpout
4554 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;
4555 \o
4556 \! sql/maskout.sh results/ut-R.tmpout
4557                                            QUERY PLAN                                           
4558 ------------------------------------------------------------------------------------------------
4559  Nested Loop  (cost=xxx rows=100 width=xxx)
4560    ->  Merge Join  (cost=xxx rows=100 width=xxx)
4561          Merge Cond: (bmt1.c1 = bmt2.c1)
4562          ->  Merge Join  (cost=xxx rows=1000 width=xxx)
4563                Merge Cond: (bmt1.c1 = bmt3.c1)
4564                ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4565                ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4566          ->  Sort  (cost=xxx rows=100 width=xxx)
4567                Sort Key: bmt2.c1
4568                ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4569    ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
4570          Index Cond: (c1 = bmt1.c1)
4571 (12 rows)
4572
4573 \o results/ut-R.tmpout
4574 /*+
4575 Leading(bmt4 bmt3 bmt2 bmt1)
4576 Rows(bmt4 bmt3 *0.6)
4577 */
4578 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;
4579 LOG:  pg_hint_plan:
4580 used hint:
4581 Leading(bmt4 bmt3 bmt2 bmt1)
4582 Rows(bmt3 bmt4 *0.6)
4583 not used hint:
4584 duplication hint:
4585 error hint:
4586
4587 \o
4588 \! sql/maskout.sh results/ut-R.tmpout
4589                                        QUERY PLAN                                        
4590 -----------------------------------------------------------------------------------------
4591  Merge Join  (cost=xxx rows=60 width=xxx)
4592    Merge Cond: (bmt1.c1 = bmt2.c1)
4593    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4594    ->  Sort  (cost=xxx rows=60 width=xxx)
4595          Sort Key: bmt2.c1
4596          ->  Hash Join  (cost=xxx rows=60 width=xxx)
4597                Hash Cond: (bmt3.c1 = bmt2.c1)
4598                ->  Hash Join  (cost=xxx rows=678 width=xxx)
4599                      Hash Cond: (bmt3.c1 = bmt4.c1)
4600                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4601                      ->  Hash  (cost=xxx rows=1130 width=xxx)
4602                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
4603                ->  Hash  (cost=xxx rows=100 width=xxx)
4604                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4605 (14 rows)
4606
4607 -- No. R-2-5-3
4608 \o results/ut-R.tmpout
4609 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;
4610 \o
4611 \! sql/maskout.sh results/ut-R.tmpout
4612                                            QUERY PLAN                                           
4613 ------------------------------------------------------------------------------------------------
4614  Nested Loop  (cost=xxx rows=100 width=xxx)
4615    ->  Merge Join  (cost=xxx rows=100 width=xxx)
4616          Merge Cond: (bmt1.c1 = bmt2.c1)
4617          ->  Merge Join  (cost=xxx rows=1000 width=xxx)
4618                Merge Cond: (bmt1.c1 = bmt3.c1)
4619                ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4620                ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4621          ->  Sort  (cost=xxx rows=100 width=xxx)
4622                Sort Key: bmt2.c1
4623                ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4624    ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
4625          Index Cond: (c1 = bmt1.c1)
4626 (12 rows)
4627
4628 \o results/ut-R.tmpout
4629 /*+
4630 Leading(bmt4 bmt3 bmt2 bmt1)
4631 Rows(bmt4 bmt1 *0.5)
4632 */
4633 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;
4634 LOG:  pg_hint_plan:
4635 used hint:
4636 Leading(bmt4 bmt3 bmt2 bmt1)
4637 Rows(bmt1 bmt4 *0.5)
4638 not used hint:
4639 duplication hint:
4640 error hint:
4641
4642 \o
4643 \! sql/maskout.sh results/ut-R.tmpout
4644                                        QUERY PLAN                                        
4645 -----------------------------------------------------------------------------------------
4646  Merge Join  (cost=xxx rows=50 width=xxx)
4647    Merge Cond: (bmt1.c1 = bmt2.c1)
4648    ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
4649    ->  Sort  (cost=xxx rows=100 width=xxx)
4650          Sort Key: bmt2.c1
4651          ->  Hash Join  (cost=xxx rows=100 width=xxx)
4652                Hash Cond: (bmt3.c1 = bmt2.c1)
4653                ->  Hash Join  (cost=xxx rows=1130 width=xxx)
4654                      Hash Cond: (bmt3.c1 = bmt4.c1)
4655                      ->  Seq Scan on t3 bmt3  (cost=xxx rows=1130 width=xxx)
4656                      ->  Hash  (cost=xxx rows=1130 width=xxx)
4657                            ->  Seq Scan on t4 bmt4  (cost=xxx rows=1130 width=xxx)
4658                ->  Hash  (cost=xxx rows=100 width=xxx)
4659                      ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
4660 (14 rows)
4661
4662 ----
4663 ---- No. R-3-1 abusolute value
4664 ----
4665 -- No. R-3-1-1
4666 \o results/ut-R.tmpout
4667 /*+Rows(t1 t2 #0)*/
4668 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4669 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 #0)
4670 LOG:  pg_hint_plan:
4671 used hint:
4672 Rows(t1 t2 #0)
4673 not used hint:
4674 duplication hint:
4675 error hint:
4676
4677 \o
4678 \! sql/maskout.sh results/ut-R.tmpout
4679                                 QUERY PLAN                                 
4680 ---------------------------------------------------------------------------
4681  Merge Join  (cost=xxx rows=1 width=xxx)
4682    Merge Cond: (t1.c1 = t2.c1)
4683    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4684    ->  Sort  (cost=xxx rows=100 width=xxx)
4685          Sort Key: t2.c1
4686          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4687 (6 rows)
4688
4689 -- No. R-3-1-2
4690 \o results/ut-R.tmpout
4691 /*+Rows(t1 t2 #5)*/
4692 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4693 LOG:  pg_hint_plan:
4694 used hint:
4695 Rows(t1 t2 #5)
4696 not used hint:
4697 duplication hint:
4698 error hint:
4699
4700 \o
4701 \! sql/maskout.sh results/ut-R.tmpout
4702                                 QUERY PLAN                                 
4703 ---------------------------------------------------------------------------
4704  Merge Join  (cost=xxx rows=5 width=xxx)
4705    Merge Cond: (t1.c1 = t2.c1)
4706    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4707    ->  Sort  (cost=xxx rows=100 width=xxx)
4708          Sort Key: t2.c1
4709          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4710 (6 rows)
4711
4712 ----
4713 ---- No. R-3-2 increase or decrease value
4714 ----
4715 -- No. R-3-2-1
4716 \o results/ut-R.tmpout
4717 /*+Rows(t1 t2 +1)*/
4718 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4719 LOG:  pg_hint_plan:
4720 used hint:
4721 Rows(t1 t2 +1)
4722 not used hint:
4723 duplication hint:
4724 error hint:
4725
4726 \o
4727 \! sql/maskout.sh results/ut-R.tmpout
4728                                 QUERY PLAN                                 
4729 ---------------------------------------------------------------------------
4730  Merge Join  (cost=xxx rows=101 width=xxx)
4731    Merge Cond: (t1.c1 = t2.c1)
4732    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4733    ->  Sort  (cost=xxx rows=100 width=xxx)
4734          Sort Key: t2.c1
4735          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4736 (6 rows)
4737
4738 -- No. R-3-2-2
4739 \o results/ut-R.tmpout
4740 /*+Rows(t1 t2 -1)*/
4741 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4742 LOG:  pg_hint_plan:
4743 used hint:
4744 Rows(t1 t2 -1)
4745 not used hint:
4746 duplication hint:
4747 error hint:
4748
4749 \o
4750 \! sql/maskout.sh results/ut-R.tmpout
4751                                 QUERY PLAN                                 
4752 ---------------------------------------------------------------------------
4753  Merge Join  (cost=xxx rows=99 width=xxx)
4754    Merge Cond: (t1.c1 = t2.c1)
4755    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4756    ->  Sort  (cost=xxx rows=100 width=xxx)
4757          Sort Key: t2.c1
4758          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4759 (6 rows)
4760
4761 -- No. R-3-2-3
4762 \o results/ut-R.tmpout
4763 /*+Rows(t1 t2 -1000)*/
4764 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4765 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 -1000)
4766 LOG:  pg_hint_plan:
4767 used hint:
4768 Rows(t1 t2 -1000)
4769 not used hint:
4770 duplication hint:
4771 error hint:
4772
4773 \o
4774 \! sql/maskout.sh results/ut-R.tmpout
4775                                 QUERY PLAN                                 
4776 ---------------------------------------------------------------------------
4777  Merge Join  (cost=xxx rows=1 width=xxx)
4778    Merge Cond: (t1.c1 = t2.c1)
4779    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4780    ->  Sort  (cost=xxx rows=100 width=xxx)
4781          Sort Key: t2.c1
4782          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4783 (6 rows)
4784
4785 ----
4786 ---- No. R-3-3 multiple 
4787 ----
4788 -- No. R-3-3-1
4789 \o results/ut-R.tmpout
4790 /*+Rows(t1 t2 *0)*/
4791 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4792 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 *0)
4793 LOG:  pg_hint_plan:
4794 used hint:
4795 Rows(t1 t2 *0)
4796 not used hint:
4797 duplication hint:
4798 error hint:
4799
4800 \o
4801 \! sql/maskout.sh results/ut-R.tmpout
4802                                 QUERY PLAN                                 
4803 ---------------------------------------------------------------------------
4804  Merge Join  (cost=xxx rows=1 width=xxx)
4805    Merge Cond: (t1.c1 = t2.c1)
4806    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4807    ->  Sort  (cost=xxx rows=100 width=xxx)
4808          Sort Key: t2.c1
4809          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4810 (6 rows)
4811
4812 -- No. R-3-3-2
4813 \o results/ut-R.tmpout
4814 /*+Rows(t1 t2 *2)*/
4815 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4816 LOG:  pg_hint_plan:
4817 used hint:
4818 Rows(t1 t2 *2)
4819 not used hint:
4820 duplication hint:
4821 error hint:
4822
4823 \o
4824 \! sql/maskout.sh results/ut-R.tmpout
4825                                 QUERY PLAN                                 
4826 ---------------------------------------------------------------------------
4827  Merge Join  (cost=xxx rows=200 width=xxx)
4828    Merge Cond: (t1.c1 = t2.c1)
4829    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4830    ->  Sort  (cost=xxx rows=100 width=xxx)
4831          Sort Key: t2.c1
4832          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4833 (6 rows)
4834
4835 -- No. R-3-3-3
4836 \o results/ut-R.tmpout
4837 /*+Rows(t1 t2 *0.1)*/
4838 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4839 LOG:  pg_hint_plan:
4840 used hint:
4841 Rows(t1 t2 *0.1)
4842 not used hint:
4843 duplication hint:
4844 error hint:
4845
4846 \o
4847 \! sql/maskout.sh results/ut-R.tmpout
4848                                 QUERY PLAN                                 
4849 ---------------------------------------------------------------------------
4850  Merge Join  (cost=xxx rows=10 width=xxx)
4851    Merge Cond: (t1.c1 = t2.c1)
4852    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
4853    ->  Sort  (cost=xxx rows=100 width=xxx)
4854          Sort Key: t2.c1
4855          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
4856 (6 rows)
4857
4858 ----
4859 ---- No. R-3-4 join inherit tables
4860 ----
4861 -- No. R-3-4-1
4862 \o results/ut-R.tmpout
4863 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4864 \o
4865 \! sql/maskout.sh results/ut-R.tmpout
4866                                QUERY PLAN                                
4867 -------------------------------------------------------------------------
4868  Hash Join  (cost=xxx rows=301 width=xxx)
4869    Hash Cond: (p2.c1 = p1.c1)
4870    ->  Append  (cost=xxx rows=304 width=xxx)
4871          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4872          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4873          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4874          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4875          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4876          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4877          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4878          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4879          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4880          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4881    ->  Hash  (cost=xxx rows=301 width=xxx)
4882          ->  Append  (cost=xxx rows=301 width=xxx)
4883                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4884                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4885                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4886                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4887 (19 rows)
4888
4889 \o results/ut-R.tmpout
4890 /*+Rows(p1 p2 #1)*/
4891 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4892 LOG:  pg_hint_plan:
4893 used hint:
4894 Rows(p1 p2 #1)
4895 not used hint:
4896 duplication hint:
4897 error hint:
4898
4899 \o
4900 \! sql/maskout.sh results/ut-R.tmpout
4901                                QUERY PLAN                                
4902 -------------------------------------------------------------------------
4903  Hash Join  (cost=xxx rows=1 width=xxx)
4904    Hash Cond: (p2.c1 = p1.c1)
4905    ->  Append  (cost=xxx rows=304 width=xxx)
4906          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4907          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4908          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4909          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4910          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4911          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4912          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4913          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4914          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4915          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4916    ->  Hash  (cost=xxx rows=301 width=xxx)
4917          ->  Append  (cost=xxx rows=301 width=xxx)
4918                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4919                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4920                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4921                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4922 (19 rows)
4923
4924 -- No. R-3-4-2
4925 \o results/ut-R.tmpout
4926 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4927 \o
4928 \! sql/maskout.sh results/ut-R.tmpout
4929                                QUERY PLAN                                
4930 -------------------------------------------------------------------------
4931  Hash Join  (cost=xxx rows=301 width=xxx)
4932    Hash Cond: (p2.c1 = p1.c1)
4933    ->  Append  (cost=xxx rows=304 width=xxx)
4934          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4935          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4936          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4937          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4938          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4939          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4940          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4941          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4942          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4943          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4944    ->  Hash  (cost=xxx rows=301 width=xxx)
4945          ->  Append  (cost=xxx rows=301 width=xxx)
4946                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4947                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4948                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4949                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4950 (19 rows)
4951
4952 \o results/ut-R.tmpout
4953 /*+Rows(p1c1 p2c1 #1)*/
4954 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
4955 LOG:  pg_hint_plan:
4956 used hint:
4957 not used hint:
4958 Rows(p1c1 p2c1 #1)
4959 duplication hint:
4960 error hint:
4961
4962 \o
4963 \! sql/maskout.sh results/ut-R.tmpout
4964                                QUERY PLAN                                
4965 -------------------------------------------------------------------------
4966  Hash Join  (cost=xxx rows=301 width=xxx)
4967    Hash Cond: (p2.c1 = p1.c1)
4968    ->  Append  (cost=xxx rows=304 width=xxx)
4969          ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
4970          ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
4971          ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
4972          ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
4973          ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
4974          ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
4975          ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
4976          ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
4977          ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
4978          ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
4979    ->  Hash  (cost=xxx rows=301 width=xxx)
4980          ->  Append  (cost=xxx rows=301 width=xxx)
4981                ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
4982                ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
4983                ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
4984                ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
4985 (19 rows)
4986
4987 ----
4988 ---- No. R-3-5 conflict join method hint
4989 ----
4990 -- No. R-3-5-1
4991 \o results/ut-R.tmpout
4992 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4993 \o
4994 \! sql/maskout.sh results/ut-R.tmpout
4995                                 QUERY PLAN                                 
4996 ---------------------------------------------------------------------------
4997  Merge Join  (cost=xxx rows=100 width=xxx)
4998    Merge Cond: (t1.c1 = t2.c1)
4999    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5000    ->  Sort  (cost=xxx rows=100 width=xxx)
5001          Sort Key: t2.c1
5002          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5003 (6 rows)
5004
5005 \o results/ut-R.tmpout
5006 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)*/
5007 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5008 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)"
5009 DETAIL:  Conflict rows hint.
5010 LOG:  pg_hint_plan:
5011 used hint:
5012 Rows(t1 t2 #1)
5013 not used hint:
5014 duplication hint:
5015 Rows(t1 t2 #1)
5016 error hint:
5017
5018 \o
5019 \! sql/maskout.sh results/ut-R.tmpout
5020                                 QUERY PLAN                                 
5021 ---------------------------------------------------------------------------
5022  Merge Join  (cost=xxx rows=1 width=xxx)
5023    Merge Cond: (t1.c1 = t2.c1)
5024    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5025    ->  Sort  (cost=xxx rows=100 width=xxx)
5026          Sort Key: t2.c1
5027          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5028 (6 rows)
5029
5030 -- No. R-3-5-2
5031 \o results/ut-R.tmpout
5032 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5033 \o
5034 \! sql/maskout.sh results/ut-R.tmpout
5035                                 QUERY PLAN                                 
5036 ---------------------------------------------------------------------------
5037  Merge Join  (cost=xxx rows=100 width=xxx)
5038    Merge Cond: (t1.c1 = t2.c1)
5039    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5040    ->  Sort  (cost=xxx rows=100 width=xxx)
5041          Sort Key: t2.c1
5042          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5043 (6 rows)
5044
5045 \o results/ut-R.tmpout
5046 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)*/
5047 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5048 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)"
5049 DETAIL:  Conflict rows hint.
5050 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)"
5051 DETAIL:  Conflict rows hint.
5052 LOG:  pg_hint_plan:
5053 used hint:
5054 Rows(t1 t2 #1)
5055 not used hint:
5056 duplication hint:
5057 Rows(t1 t2 #1)
5058 Rows(t1 t2 #1)
5059 error hint:
5060
5061 \o
5062 \! sql/maskout.sh results/ut-R.tmpout
5063                                 QUERY PLAN                                 
5064 ---------------------------------------------------------------------------
5065  Merge Join  (cost=xxx rows=1 width=xxx)
5066    Merge Cond: (t1.c1 = t2.c1)
5067    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5068    ->  Sort  (cost=xxx rows=100 width=xxx)
5069          Sort Key: t2.c1
5070          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5071 (6 rows)
5072
5073 -- No. R-3-5-3
5074 \o results/ut-R.tmpout
5075 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5076 \o
5077 \! sql/maskout.sh results/ut-R.tmpout
5078                                 QUERY PLAN                                 
5079 ---------------------------------------------------------------------------
5080  Merge Join  (cost=xxx rows=100 width=xxx)
5081    Merge Cond: (t1.c1 = t2.c1)
5082    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5083    ->  Sort  (cost=xxx rows=100 width=xxx)
5084          Sort Key: t2.c1
5085          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5086 (6 rows)
5087
5088 \o results/ut-R.tmpout
5089 /*+Rows(t1 t2 #1)Rows(t2 t1 #1)*/
5090 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5091 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t2 t1 #1)"
5092 DETAIL:  Conflict rows hint.
5093 LOG:  pg_hint_plan:
5094 used hint:
5095 Rows(t1 t2 #1)
5096 not used hint:
5097 duplication hint:
5098 Rows(t1 t2 #1)
5099 error hint:
5100
5101 \o
5102 \! sql/maskout.sh results/ut-R.tmpout
5103                                 QUERY PLAN                                 
5104 ---------------------------------------------------------------------------
5105  Merge Join  (cost=xxx rows=1 width=xxx)
5106    Merge Cond: (t1.c1 = t2.c1)
5107    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5108    ->  Sort  (cost=xxx rows=100 width=xxx)
5109          Sort Key: t2.c1
5110          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5111 (6 rows)
5112
5113 -- No. R-3-5-4
5114 \o results/ut-R.tmpout
5115 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5116 \o
5117 \! sql/maskout.sh results/ut-R.tmpout
5118                                 QUERY PLAN                                 
5119 ---------------------------------------------------------------------------
5120  Merge Join  (cost=xxx rows=100 width=xxx)
5121    Merge Cond: (t1.c1 = t2.c1)
5122    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5123    ->  Sort  (cost=xxx rows=100 width=xxx)
5124          Sort Key: t2.c1
5125          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5126 (6 rows)
5127
5128 \o results/ut-R.tmpout
5129 /*+Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)*/
5130 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5131 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)"
5132 DETAIL:  Conflict rows hint.
5133 INFO:  pg_hint_plan: hint syntax error at or near "Rows(t1 t2 #1)Rows(t2 t1 #1)"
5134 DETAIL:  Conflict rows hint.
5135 LOG:  pg_hint_plan:
5136 used hint:
5137 Rows(t1 t2 #1)
5138 not used hint:
5139 duplication hint:
5140 Rows(t1 t2 #1)
5141 Rows(t1 t2 #1)
5142 error hint:
5143
5144 \o
5145 \! sql/maskout.sh results/ut-R.tmpout
5146                                 QUERY PLAN                                 
5147 ---------------------------------------------------------------------------
5148  Merge Join  (cost=xxx rows=1 width=xxx)
5149    Merge Cond: (t1.c1 = t2.c1)
5150    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5151    ->  Sort  (cost=xxx rows=100 width=xxx)
5152          Sort Key: t2.c1
5153          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5154 (6 rows)
5155
5156 ----
5157 ---- No. R-3-6 hint state output
5158 ----
5159 -- No. R-3-6-1
5160 SET client_min_messages TO DEBUG1;
5161 \o results/ut-R.tmpout
5162 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5163 \o
5164 \! sql/maskout.sh results/ut-R.tmpout
5165                                 QUERY PLAN                                 
5166 ---------------------------------------------------------------------------
5167  Merge Join  (cost=xxx rows=100 width=xxx)
5168    Merge Cond: (t1.c1 = t2.c1)
5169    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5170    ->  Sort  (cost=xxx rows=100 width=xxx)
5171          Sort Key: t2.c1
5172          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5173 (6 rows)
5174
5175 \o results/ut-R.tmpout
5176 /*+Rows(t1 t2 +1)*/
5177 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
5178 DEBUG:  adjusted rows 100 to 101
5179 LOG:  pg_hint_plan:
5180 used hint:
5181 Rows(t1 t2 +1)
5182 not used hint:
5183 duplication hint:
5184 error hint:
5185
5186 \o
5187 \! sql/maskout.sh results/ut-R.tmpout
5188                                 QUERY PLAN                                 
5189 ---------------------------------------------------------------------------
5190  Merge Join  (cost=xxx rows=101 width=xxx)
5191    Merge Cond: (t1.c1 = t2.c1)
5192    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
5193    ->  Sort  (cost=xxx rows=100 width=xxx)
5194          Sort Key: t2.c1
5195          ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
5196 (6 rows)
5197
5198 \! rm results/ut-R.tmpout