OSDN Git Service

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