OSDN Git Service

Stabilize regression test.
[pghintplan/pg_hint_plan.git] / expected / pg_hint_plan.out
1 SET search_path TO public;
2 SET client_min_messages TO log;
3 \set SHOW_CONTEXT always
4 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
5               QUERY PLAN              
6 --------------------------------------
7  Merge Join
8    Merge Cond: (t1.id = t2.id)
9    ->  Index Scan using t1_pkey on t1
10    ->  Index Scan using t2_pkey on t2
11 (4 rows)
12
13 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
14            QUERY PLAN           
15 --------------------------------
16  Hash Join
17    Hash Cond: (t2.val = t1.val)
18    ->  Seq Scan on t2
19    ->  Hash
20          ->  Seq Scan on t1
21 (5 rows)
22
23 LOAD 'pg_hint_plan';
24 SET pg_hint_plan.debug_print TO on;
25 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
26               QUERY PLAN              
27 --------------------------------------
28  Merge Join
29    Merge Cond: (t1.id = t2.id)
30    ->  Index Scan using t1_pkey on t1
31    ->  Index Scan using t2_pkey on t2
32 (4 rows)
33
34 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
35            QUERY PLAN           
36 --------------------------------
37  Hash Join
38    Hash Cond: (t2.val = t1.val)
39    ->  Seq Scan on t2
40    ->  Hash
41          ->  Seq Scan on t1
42 (5 rows)
43
44 /*+ Test (t1 t2) */
45 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
46 INFO:  pg_hint_plan: hint syntax error at or near "Test (t1 t2) "
47 DETAIL:  Unrecognized hint keyword "Test".
48               QUERY PLAN              
49 --------------------------------------
50  Merge Join
51    Merge Cond: (t1.id = t2.id)
52    ->  Index Scan using t1_pkey on t1
53    ->  Index Scan using t2_pkey on t2
54 (4 rows)
55
56 SET pg_hint_plan.enable_hint TO off;
57 /*+ Test (t1 t2) */
58 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
59               QUERY PLAN              
60 --------------------------------------
61  Merge Join
62    Merge Cond: (t1.id = t2.id)
63    ->  Index Scan using t1_pkey on t1
64    ->  Index Scan using t2_pkey on t2
65 (4 rows)
66
67 SET pg_hint_plan.enable_hint TO on;
68 /*Set(enable_indexscan off)*/
69 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
70               QUERY PLAN              
71 --------------------------------------
72  Merge Join
73    Merge Cond: (t1.id = t2.id)
74    ->  Index Scan using t1_pkey on t1
75    ->  Index Scan using t2_pkey on t2
76 (4 rows)
77
78 --+Set(enable_indexscan off)
79 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
80               QUERY PLAN              
81 --------------------------------------
82  Merge Join
83    Merge Cond: (t1.id = t2.id)
84    ->  Index Scan using t1_pkey on t1
85    ->  Index Scan using t2_pkey on t2
86 (4 rows)
87
88 /*+Set(enable_indexscan off) /* nest comment */ */
89 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
90 INFO:  pg_hint_plan: hint syntax error at or near "/* nest comment */ */
91 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;"
92 DETAIL:  Nested block comments are not supported.
93               QUERY PLAN              
94 --------------------------------------
95  Merge Join
96    Merge Cond: (t1.id = t2.id)
97    ->  Index Scan using t1_pkey on t1
98    ->  Index Scan using t2_pkey on t2
99 (4 rows)
100
101 /*+Set(enable_indexscan off)*/
102 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
103 LOG:  pg_hint_plan:
104 used hint:
105 Set(enable_indexscan off)
106 not used hint:
107 duplication hint:
108 error hint:
109
110           QUERY PLAN          
111 ------------------------------
112  Hash Join
113    Hash Cond: (t1.id = t2.id)
114    ->  Seq Scan on t1
115    ->  Hash
116          ->  Seq Scan on t2
117 (5 rows)
118
119 EXPLAIN (COSTS false) /*+Set(enable_indexscan off)*/
120  SELECT * FROM t1, t2 WHERE t1.id = t2.id;
121 LOG:  pg_hint_plan:
122 used hint:
123 Set(enable_indexscan off)
124 not used hint:
125 duplication hint:
126 error hint:
127
128           QUERY PLAN          
129 ------------------------------
130  Hash Join
131    Hash Cond: (t1.id = t2.id)
132    ->  Seq Scan on t1
133    ->  Hash
134          ->  Seq Scan on t2
135 (5 rows)
136
137 /*+ Set(enable_indexscan off) Set(enable_hashjoin off) */
138 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
139 LOG:  pg_hint_plan:
140 used hint:
141 Set(enable_hashjoin off)
142 Set(enable_indexscan off)
143 not used hint:
144 duplication hint:
145 error hint:
146
147           QUERY PLAN           
148 -------------------------------
149  Merge Join
150    Merge Cond: (t1.id = t2.id)
151    ->  Sort
152          Sort Key: t1.id
153          ->  Seq Scan on t1
154    ->  Sort
155          Sort Key: t2.id
156          ->  Seq Scan on t2
157 (8 rows)
158
159 /*+      Set     (       enable_indexscan        off     )       */
160 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
161 LOG:  pg_hint_plan:
162 used hint:
163 Set(enable_indexscan off)
164 not used hint:
165 duplication hint:
166 error hint:
167
168           QUERY PLAN          
169 ------------------------------
170  Hash Join
171    Hash Cond: (t1.id = t2.id)
172    ->  Seq Scan on t1
173    ->  Hash
174          ->  Seq Scan on t2
175 (5 rows)
176
177 /*+      
178                 Set      
179                 (        
180                 enable_indexscan         
181                 off      
182                 )        
183                 */              
184 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
185 LOG:  pg_hint_plan:
186 used hint:
187 Set(enable_indexscan off)
188 not used hint:
189 duplication hint:
190 error hint:
191
192           QUERY PLAN          
193 ------------------------------
194  Hash Join
195    Hash Cond: (t1.id = t2.id)
196    ->  Seq Scan on t1
197    ->  Hash
198          ->  Seq Scan on t2
199 (5 rows)
200
201 /*+ Set(enable_indexscan off)Set(enable_nestloop off)Set(enable_mergejoin off)          
202                 Set(enable_seqscan off)
203                 */
204 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
205 LOG:  pg_hint_plan:
206 used hint:
207 Set(enable_indexscan off)
208 Set(enable_mergejoin off)
209 Set(enable_nestloop off)
210 Set(enable_seqscan off)
211 not used hint:
212 duplication hint:
213 error hint:
214
215                  QUERY PLAN                 
216 --------------------------------------------
217  Hash Join
218    Hash Cond: (t1.id = t2.id)
219    ->  Index Scan using t1_pkey on t1
220    ->  Hash
221          ->  Index Scan using t2_pkey on t2
222 (5 rows)
223
224 /*+Set(work_mem "1M")*/
225 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
226 INFO:  invalid value for parameter "work_mem": "1M"
227 HINT:  Valid units for this parameter are "B", "kB", "MB", "GB", and "TB".
228 LOG:  pg_hint_plan:
229 used hint:
230 not used hint:
231 duplication hint:
232 error hint:
233 Set(work_mem 1M)
234
235               QUERY PLAN              
236 --------------------------------------
237  Merge Join
238    Merge Cond: (t1.id = t2.id)
239    ->  Index Scan using t1_pkey on t1
240    ->  Index Scan using t2_pkey on t2
241 (4 rows)
242
243 /*+Set(work_mem "1MB")*/
244 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
245 LOG:  pg_hint_plan:
246 used hint:
247 Set(work_mem 1MB)
248 not used hint:
249 duplication hint:
250 error hint:
251
252               QUERY PLAN              
253 --------------------------------------
254  Merge Join
255    Merge Cond: (t1.id = t2.id)
256    ->  Index Scan using t1_pkey on t1
257    ->  Index Scan using t2_pkey on t2
258 (4 rows)
259
260 /*+Set(work_mem TO "1MB")*/
261 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
262 INFO:  pg_hint_plan: hint syntax error at or near "Set(work_mem TO "1MB")"
263 DETAIL:  Set hint requires name and value of GUC parameter.
264 LOG:  pg_hint_plan:
265 used hint:
266 not used hint:
267 duplication hint:
268 error hint:
269 Set(work_mem TO 1MB)
270
271               QUERY PLAN              
272 --------------------------------------
273  Merge Join
274    Merge Cond: (t1.id = t2.id)
275    ->  Index Scan using t1_pkey on t1
276    ->  Index Scan using t2_pkey on t2
277 (4 rows)
278
279 /*+SeqScan() */ SELECT 1;
280 INFO:  pg_hint_plan: hint syntax error at or near " "
281 DETAIL:  SeqScan hint requires a relation.
282 LOG:  pg_hint_plan:
283 used hint:
284 not used hint:
285 duplication hint:
286 error hint:
287 SeqScan()
288
289  ?column? 
290 ----------
291         1
292 (1 row)
293
294 /*+SeqScan(t1 t2)*/
295 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
296 INFO:  pg_hint_plan: hint syntax error at or near ""
297 DETAIL:  SeqScan hint accepts only one relation.
298 LOG:  pg_hint_plan:
299 used hint:
300 not used hint:
301 duplication hint:
302 error hint:
303 SeqScan(t1 t2)
304
305               QUERY PLAN              
306 --------------------------------------
307  Merge Join
308    Merge Cond: (t1.id = t2.id)
309    ->  Index Scan using t1_pkey on t1
310    ->  Index Scan using t2_pkey on t2
311 (4 rows)
312
313 /*+SeqScan(t1)*/
314 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
315 LOG:  pg_hint_plan:
316 used hint:
317 SeqScan(t1)
318 not used hint:
319 duplication hint:
320 error hint:
321
322           QUERY PLAN          
323 ------------------------------
324  Hash Join
325    Hash Cond: (t1.id = t2.id)
326    ->  Seq Scan on t1
327    ->  Hash
328          ->  Seq Scan on t2
329 (5 rows)
330
331 /*+SeqScan(t1)IndexScan(t2)*/
332 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
333 LOG:  pg_hint_plan:
334 used hint:
335 SeqScan(t1)
336 IndexScan(t2)
337 not used hint:
338 duplication hint:
339 error hint:
340
341                  QUERY PLAN                 
342 --------------------------------------------
343  Hash Join
344    Hash Cond: (t1.id = t2.id)
345    ->  Seq Scan on t1
346    ->  Hash
347          ->  Index Scan using t2_pkey on t2
348 (5 rows)
349
350 /*+BitmapScan(t2)*/
351 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
352 LOG:  pg_hint_plan:
353 used hint:
354 BitmapScan(t2)
355 not used hint:
356 duplication hint:
357 error hint:
358
359                 QUERY PLAN                
360 ------------------------------------------
361  Nested Loop
362    ->  Seq Scan on t1
363    ->  Bitmap Heap Scan on t2
364          Recheck Cond: (id = t1.id)
365          ->  Bitmap Index Scan on t2_pkey
366                Index Cond: (id = t1.id)
367 (6 rows)
368
369 /*+BitmapScan(t2)NoSeqScan(t1)*/
370 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
371 LOG:  pg_hint_plan:
372 used hint:
373 NoSeqScan(t1)
374 BitmapScan(t2)
375 not used hint:
376 duplication hint:
377 error hint:
378
379                 QUERY PLAN                
380 ------------------------------------------
381  Nested Loop
382    ->  Index Scan using t1_pkey on t1
383    ->  Bitmap Heap Scan on t2
384          Recheck Cond: (id = t1.id)
385          ->  Bitmap Index Scan on t2_pkey
386                Index Cond: (id = t1.id)
387 (6 rows)
388
389 /*+NoIndexScan(t1)*/
390 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
391 LOG:  pg_hint_plan:
392 used hint:
393 NoIndexScan(t1)
394 not used hint:
395 duplication hint:
396 error hint:
397
398           QUERY PLAN          
399 ------------------------------
400  Hash Join
401    Hash Cond: (t1.id = t2.id)
402    ->  Seq Scan on t1
403    ->  Hash
404          ->  Seq Scan on t2
405 (5 rows)
406
407 /*+NoBitmapScan(t1)*/
408 EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
409 LOG:  pg_hint_plan:
410 used hint:
411 NoBitmapScan(t1)
412 not used hint:
413 duplication hint:
414 error hint:
415
416          QUERY PLAN         
417 ----------------------------
418  Nested Loop
419    ->  Seq Scan on t1
420          Filter: (val < 10)
421    ->  Materialize
422          ->  Seq Scan on t4
423 (5 rows)
424
425 /*+TidScan(t4)*/
426 EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
427 LOG:  pg_hint_plan:
428 used hint:
429 TidScan(t4)
430 not used hint:
431 duplication hint:
432 error hint:
433
434                   QUERY PLAN                   
435 -----------------------------------------------
436  Merge Join
437    Merge Cond: (t3.id = t4.id)
438    ->  Index Scan using t3_pkey on t3
439    ->  Sort
440          Sort Key: t4.id
441          ->  Tid Scan on t4
442                TID Cond: (ctid = '(1,1)'::tid)
443 (7 rows)
444
445 /*+NoTidScan(t1)*/
446 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
447 LOG:  pg_hint_plan:
448 used hint:
449 NoTidScan(t1)
450 not used hint:
451 duplication hint:
452 error hint:
453
454               QUERY PLAN               
455 ---------------------------------------
456  Nested Loop
457    ->  Seq Scan on t1
458          Filter: (ctid = '(1,1)'::tid)
459    ->  Index Scan using t2_pkey on t2
460          Index Cond: (id = t1.id)
461 (5 rows)
462
463 /*+ NestLoop() */ SELECT 1;
464 INFO:  pg_hint_plan: hint syntax error at or near " "
465 DETAIL:  NestLoop hint requires at least two relations.
466 LOG:  pg_hint_plan:
467 used hint:
468 not used hint:
469 duplication hint:
470 error hint:
471 NestLoop()
472
473  ?column? 
474 ----------
475         1
476 (1 row)
477
478 /*+ NestLoop(x) */ SELECT 1;
479 INFO:  pg_hint_plan: hint syntax error at or near " "
480 DETAIL:  NestLoop hint requires at least two relations.
481 LOG:  pg_hint_plan:
482 used hint:
483 not used hint:
484 duplication hint:
485 error hint:
486 NestLoop(x)
487
488  ?column? 
489 ----------
490         1
491 (1 row)
492
493 /*+HashJoin(t1 t2)*/
494 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
495 LOG:  pg_hint_plan:
496 used hint:
497 HashJoin(t1 t2)
498 not used hint:
499 duplication hint:
500 error hint:
501
502           QUERY PLAN          
503 ------------------------------
504  Hash Join
505    Hash Cond: (t1.id = t2.id)
506    ->  Seq Scan on t1
507    ->  Hash
508          ->  Seq Scan on t2
509 (5 rows)
510
511 /*+NestLoop(t1 t2)*/
512 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
513 LOG:  pg_hint_plan:
514 used hint:
515 NestLoop(t1 t2)
516 not used hint:
517 duplication hint:
518 error hint:
519
520               QUERY PLAN              
521 --------------------------------------
522  Nested Loop
523    ->  Seq Scan on t2
524    ->  Index Scan using t1_pkey on t1
525          Index Cond: (id = t2.id)
526 (4 rows)
527
528 /*+NoMergeJoin(t1 t2)*/
529 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
530 LOG:  pg_hint_plan:
531 used hint:
532 NoMergeJoin(t1 t2)
533 not used hint:
534 duplication hint:
535 error hint:
536
537           QUERY PLAN          
538 ------------------------------
539  Hash Join
540    Hash Cond: (t1.id = t2.id)
541    ->  Seq Scan on t1
542    ->  Hash
543          ->  Seq Scan on t2
544 (5 rows)
545
546 /*+MergeJoin(t1 t3)*/
547 EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
548 LOG:  pg_hint_plan:
549 used hint:
550 MergeJoin(t1 t3)
551 not used hint:
552 duplication hint:
553 error hint:
554
555              QUERY PLAN              
556 -------------------------------------
557  Merge Join
558    Merge Cond: (t1.val = t3.val)
559    ->  Index Scan using t1_val on t1
560    ->  Sort
561          Sort Key: t3.val
562          ->  Seq Scan on t3
563 (6 rows)
564
565 /*+NestLoop(t1 t3)*/
566 EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
567 LOG:  pg_hint_plan:
568 used hint:
569 NestLoop(t1 t3)
570 not used hint:
571 duplication hint:
572 error hint:
573
574              QUERY PLAN              
575 -------------------------------------
576  Nested Loop
577    ->  Seq Scan on t3
578    ->  Index Scan using t1_val on t1
579          Index Cond: (val = t3.val)
580 (4 rows)
581
582 /*+NoHashJoin(t1 t3)*/
583 EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
584 LOG:  pg_hint_plan:
585 used hint:
586 NoHashJoin(t1 t3)
587 not used hint:
588 duplication hint:
589 error hint:
590
591              QUERY PLAN              
592 -------------------------------------
593  Nested Loop
594    ->  Seq Scan on t3
595    ->  Index Scan using t1_val on t1
596          Index Cond: (val = t3.val)
597 (4 rows)
598
599 /*+MergeJoin(t4 t1 t2 t3)*/
600 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
601 LOG:  pg_hint_plan:
602 used hint:
603 MergeJoin(t1 t2 t3 t4)
604 not used hint:
605 duplication hint:
606 error hint:
607
608                     QUERY PLAN                    
609 --------------------------------------------------
610  Merge Join
611    Merge Cond: (t1.id = t3.id)
612    ->  Merge Join
613          Merge Cond: (t1.id = t2.id)
614          ->  Index Scan using t1_pkey on t1
615          ->  Index Scan using t2_pkey on t2
616    ->  Materialize
617          ->  Merge Join
618                Merge Cond: (t3.id = t4.id)
619                ->  Index Scan using t3_pkey on t3
620                ->  Sort
621                      Sort Key: t4.id
622                      ->  Seq Scan on t4
623 (13 rows)
624
625 /*+HashJoin(t3 t4 t1 t2)*/
626 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
627 LOG:  pg_hint_plan:
628 used hint:
629 HashJoin(t1 t2 t3 t4)
630 not used hint:
631 duplication hint:
632 error hint:
633
634                        QUERY PLAN                       
635 --------------------------------------------------------
636  Hash Join
637    Hash Cond: (t3.id = t1.id)
638    ->  Seq Scan on t3
639    ->  Hash
640          ->  Merge Join
641                Merge Cond: (t1.id = t4.id)
642                ->  Merge Join
643                      Merge Cond: (t1.id = t2.id)
644                      ->  Index Scan using t1_pkey on t1
645                      ->  Index Scan using t2_pkey on t2
646                ->  Sort
647                      Sort Key: t4.id
648                      ->  Seq Scan on t4
649 (13 rows)
650
651 /*+NestLoop(t2 t3 t4 t1) IndexScan(t3)*/
652 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
653 LOG:  pg_hint_plan:
654 used hint:
655 IndexScan(t3)
656 NestLoop(t1 t2 t3 t4)
657 not used hint:
658 duplication hint:
659 error hint:
660
661                     QUERY PLAN                    
662 --------------------------------------------------
663  Nested Loop
664    ->  Merge Join
665          Merge Cond: (t1.id = t4.id)
666          ->  Merge Join
667                Merge Cond: (t1.id = t2.id)
668                ->  Index Scan using t1_pkey on t1
669                ->  Index Scan using t2_pkey on t2
670          ->  Sort
671                Sort Key: t4.id
672                ->  Seq Scan on t4
673    ->  Index Scan using t3_pkey on t3
674          Index Cond: (id = t1.id)
675 (12 rows)
676
677 /*+NoNestLoop(t4 t1 t3 t2)*/
678 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
679 LOG:  pg_hint_plan:
680 used hint:
681 NoNestLoop(t1 t2 t3 t4)
682 not used hint:
683 duplication hint:
684 error hint:
685
686                     QUERY PLAN                    
687 --------------------------------------------------
688  Merge Join
689    Merge Cond: (t1.id = t3.id)
690    ->  Merge Join
691          Merge Cond: (t1.id = t2.id)
692          ->  Index Scan using t1_pkey on t1
693          ->  Index Scan using t2_pkey on t2
694    ->  Materialize
695          ->  Merge Join
696                Merge Cond: (t3.id = t4.id)
697                ->  Index Scan using t3_pkey on t3
698                ->  Sort
699                      Sort Key: t4.id
700                      ->  Seq Scan on t4
701 (13 rows)
702
703 /*+Leading( */
704 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
705 INFO:  pg_hint_plan: hint syntax error at or near ""
706 DETAIL:  Closing parenthesis is necessary.
707                     QUERY PLAN                    
708 --------------------------------------------------
709  Nested Loop
710    ->  Merge Join
711          Merge Cond: (t1.id = t4.id)
712          ->  Merge Join
713                Merge Cond: (t1.id = t2.id)
714                ->  Index Scan using t1_pkey on t1
715                ->  Index Scan using t2_pkey on t2
716          ->  Sort
717                Sort Key: t4.id
718                ->  Seq Scan on t4
719    ->  Index Scan using t3_pkey on t3
720          Index Cond: (id = t1.id)
721 (12 rows)
722
723 /*+Leading( )*/
724 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
725 INFO:  pg_hint_plan: hint syntax error at or near "Leading( )"
726 DETAIL:  Leading hint requires at least two relations.
727 LOG:  pg_hint_plan:
728 used hint:
729 not used hint:
730 duplication hint:
731 error hint:
732 Leading()
733
734                     QUERY PLAN                    
735 --------------------------------------------------
736  Nested Loop
737    ->  Merge Join
738          Merge Cond: (t1.id = t4.id)
739          ->  Merge Join
740                Merge Cond: (t1.id = t2.id)
741                ->  Index Scan using t1_pkey on t1
742                ->  Index Scan using t2_pkey on t2
743          ->  Sort
744                Sort Key: t4.id
745                ->  Seq Scan on t4
746    ->  Index Scan using t3_pkey on t3
747          Index Cond: (id = t1.id)
748 (12 rows)
749
750 /*+Leading( t3 )*/
751 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
752 INFO:  pg_hint_plan: hint syntax error at or near "Leading( t3 )"
753 DETAIL:  Leading hint requires at least two relations.
754 LOG:  pg_hint_plan:
755 used hint:
756 not used hint:
757 duplication hint:
758 error hint:
759 Leading(t3)
760
761                     QUERY PLAN                    
762 --------------------------------------------------
763  Nested Loop
764    ->  Merge Join
765          Merge Cond: (t1.id = t4.id)
766          ->  Merge Join
767                Merge Cond: (t1.id = t2.id)
768                ->  Index Scan using t1_pkey on t1
769                ->  Index Scan using t2_pkey on t2
770          ->  Sort
771                Sort Key: t4.id
772                ->  Seq Scan on t4
773    ->  Index Scan using t3_pkey on t3
774          Index Cond: (id = t1.id)
775 (12 rows)
776
777 /*+Leading( t3 t4 )*/
778 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
779 LOG:  pg_hint_plan:
780 used hint:
781 Leading(t3 t4)
782 not used hint:
783 duplication hint:
784 error hint:
785
786                     QUERY PLAN                    
787 --------------------------------------------------
788  Nested Loop
789    ->  Nested Loop
790          ->  Merge Join
791                Merge Cond: (t3.id = t4.id)
792                ->  Index Scan using t3_pkey on t3
793                ->  Sort
794                      Sort Key: t4.id
795                      ->  Seq Scan on t4
796          ->  Index Scan using t2_pkey on t2
797                Index Cond: (id = t3.id)
798    ->  Index Scan using t1_pkey on t1
799          Index Cond: (id = t2.id)
800 (12 rows)
801
802 /*+Leading(t3 t4 t1)*/
803 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
804 LOG:  pg_hint_plan:
805 used hint:
806 Leading(t3 t4 t1)
807 not used hint:
808 duplication hint:
809 error hint:
810
811                     QUERY PLAN                    
812 --------------------------------------------------
813  Nested Loop
814    ->  Merge Join
815          Merge Cond: (t3.id = t1.id)
816          ->  Merge Join
817                Merge Cond: (t3.id = t4.id)
818                ->  Index Scan using t3_pkey on t3
819                ->  Sort
820                      Sort Key: t4.id
821                      ->  Seq Scan on t4
822          ->  Index Scan using t1_pkey on t1
823    ->  Index Scan using t2_pkey on t2
824          Index Cond: (id = t1.id)
825 (12 rows)
826
827 /*+Leading(t3 t4 t1 t2)*/
828 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
829 LOG:  pg_hint_plan:
830 used hint:
831 Leading(t3 t4 t1 t2)
832 not used hint:
833 duplication hint:
834 error hint:
835
836                     QUERY PLAN                    
837 --------------------------------------------------
838  Nested Loop
839    ->  Merge Join
840          Merge Cond: (t3.id = t1.id)
841          ->  Merge Join
842                Merge Cond: (t3.id = t4.id)
843                ->  Index Scan using t3_pkey on t3
844                ->  Sort
845                      Sort Key: t4.id
846                      ->  Seq Scan on t4
847          ->  Index Scan using t1_pkey on t1
848    ->  Index Scan using t2_pkey on t2
849          Index Cond: (id = t1.id)
850 (12 rows)
851
852 /*+Leading(t3 t4 t1 t2 t1)*/
853 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
854 INFO:  pg_hint_plan: hint syntax error at or near "Leading(t3 t4 t1 t2 t1)"
855 DETAIL:  Relation name "t1" is duplicated.
856 LOG:  pg_hint_plan:
857 used hint:
858 not used hint:
859 duplication hint:
860 error hint:
861 Leading(t3 t4 t1 t2 t1)
862
863                     QUERY PLAN                    
864 --------------------------------------------------
865  Nested Loop
866    ->  Merge Join
867          Merge Cond: (t1.id = t4.id)
868          ->  Merge Join
869                Merge Cond: (t1.id = t2.id)
870                ->  Index Scan using t1_pkey on t1
871                ->  Index Scan using t2_pkey on t2
872          ->  Sort
873                Sort Key: t4.id
874                ->  Seq Scan on t4
875    ->  Index Scan using t3_pkey on t3
876          Index Cond: (id = t1.id)
877 (12 rows)
878
879 /*+Leading(t3 t4 t4)*/
880 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
881 INFO:  pg_hint_plan: hint syntax error at or near "Leading(t3 t4 t4)"
882 DETAIL:  Relation name "t4" is duplicated.
883 LOG:  pg_hint_plan:
884 used hint:
885 not used hint:
886 duplication hint:
887 error hint:
888 Leading(t3 t4 t4)
889
890                     QUERY PLAN                    
891 --------------------------------------------------
892  Nested Loop
893    ->  Merge Join
894          Merge Cond: (t1.id = t4.id)
895          ->  Merge Join
896                Merge Cond: (t1.id = t2.id)
897                ->  Index Scan using t1_pkey on t1
898                ->  Index Scan using t2_pkey on t2
899          ->  Sort
900                Sort Key: t4.id
901                ->  Seq Scan on t4
902    ->  Index Scan using t3_pkey on t3
903          Index Cond: (id = t1.id)
904 (12 rows)
905
906 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
907                   QUERY PLAN                   
908 -----------------------------------------------
909  Nested Loop
910    ->  Values Scan on "*VALUES*"
911    ->  Index Scan using t1_pkey on t1
912          Index Cond: (id = "*VALUES*".column1)
913 (4 rows)
914
915 /*+HashJoin(t1 t2)*/
916 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
917 LOG:  pg_hint_plan:
918 used hint:
919 not used hint:
920 HashJoin(t1 t2)
921 duplication hint:
922 error hint:
923
924                   QUERY PLAN                   
925 -----------------------------------------------
926  Nested Loop
927    ->  Values Scan on "*VALUES*"
928    ->  Index Scan using t1_pkey on t1
929          Index Cond: (id = "*VALUES*".column1)
930 (4 rows)
931
932 /*+HashJoin(t1 *VALUES*)*/
933 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
934 LOG:  pg_hint_plan:
935 used hint:
936 HashJoin(*VALUES* t1)
937 not used hint:
938 duplication hint:
939 error hint:
940
941                 QUERY PLAN                 
942 -------------------------------------------
943  Hash Join
944    Hash Cond: (t1.id = "*VALUES*".column1)
945    ->  Seq Scan on t1
946    ->  Hash
947          ->  Values Scan on "*VALUES*"
948 (5 rows)
949
950 /*+HashJoin(t1 *VALUES*) IndexScan(t1) IndexScan(*VALUES*)*/
951 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
952 LOG:  pg_hint_plan:
953 used hint:
954 IndexScan(t1)
955 HashJoin(*VALUES* t1)
956 not used hint:
957 IndexScan(*VALUES*)
958 duplication hint:
959 error hint:
960
961                 QUERY PLAN                 
962 -------------------------------------------
963  Hash Join
964    Hash Cond: (t1.id = "*VALUES*".column1)
965    ->  Index Scan using t1_pkey on t1
966    ->  Hash
967          ->  Values Scan on "*VALUES*"
968 (5 rows)
969
970 -- single table scan hint test
971 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
972                                QUERY PLAN                               
973 ------------------------------------------------------------------------
974  Index Only Scan using t1_pkey on t1
975    Index Cond: (id = $3)
976    InitPlan 2 (returns $1)
977      ->  Result
978            InitPlan 1 (returns $0)
979              ->  Limit
980                    ->  Index Only Scan Backward using t1_pkey on t1 v_1
981                          Index Cond: ((id IS NOT NULL) AND (id < 10))
982    InitPlan 4 (returns $3)
983      ->  Result
984            InitPlan 3 (returns $2)
985              ->  Limit
986                    ->  Index Only Scan Backward using t1_pkey on t1 v_2
987                          Index Cond: ((id IS NOT NULL) AND (id < 10))
988 (14 rows)
989
990 /*+BitmapScan(v_1)*/
991 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
992 LOG:  pg_hint_plan:
993 used hint:
994 BitmapScan(v_1)
995 not used hint:
996 duplication hint:
997 error hint:
998
999                                QUERY PLAN                               
1000 ------------------------------------------------------------------------
1001  Index Only Scan using t1_pkey on t1
1002    Index Cond: (id = $3)
1003    InitPlan 1 (returns $1)
1004      ->  Aggregate
1005            ->  Bitmap Heap Scan on t1 v_1
1006                  Recheck Cond: (id < 10)
1007                  ->  Bitmap Index Scan on t1_pkey
1008                        Index Cond: (id < 10)
1009    InitPlan 3 (returns $3)
1010      ->  Result
1011            InitPlan 2 (returns $2)
1012              ->  Limit
1013                    ->  Index Only Scan Backward using t1_pkey on t1 v_2
1014                          Index Cond: ((id IS NOT NULL) AND (id < 10))
1015 (14 rows)
1016
1017 /*+BitmapScan(v_2)*/
1018 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
1019 LOG:  pg_hint_plan:
1020 used hint:
1021 BitmapScan(v_2)
1022 not used hint:
1023 duplication hint:
1024 error hint:
1025
1026                                QUERY PLAN                               
1027 ------------------------------------------------------------------------
1028  Index Only Scan using t1_pkey on t1
1029    Index Cond: (id = $3)
1030    InitPlan 2 (returns $1)
1031      ->  Result
1032            InitPlan 1 (returns $0)
1033              ->  Limit
1034                    ->  Index Only Scan Backward using t1_pkey on t1 v_1
1035                          Index Cond: ((id IS NOT NULL) AND (id < 10))
1036    InitPlan 3 (returns $3)
1037      ->  Aggregate
1038            ->  Bitmap Heap Scan on t1 v_2
1039                  Recheck Cond: (id < 10)
1040                  ->  Bitmap Index Scan on t1_pkey
1041                        Index Cond: (id < 10)
1042 (14 rows)
1043
1044 /*+BitmapScan(t1)*/
1045 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
1046 LOG:  pg_hint_plan:
1047 used hint:
1048 BitmapScan(t1)
1049 not used hint:
1050 duplication hint:
1051 error hint:
1052
1053                                QUERY PLAN                               
1054 ------------------------------------------------------------------------
1055  Bitmap Heap Scan on t1
1056    Recheck Cond: (id = $3)
1057    InitPlan 2 (returns $1)
1058      ->  Result
1059            InitPlan 1 (returns $0)
1060              ->  Limit
1061                    ->  Index Only Scan Backward using t1_pkey on t1 v_1
1062                          Index Cond: ((id IS NOT NULL) AND (id < 10))
1063    InitPlan 4 (returns $3)
1064      ->  Result
1065            InitPlan 3 (returns $2)
1066              ->  Limit
1067                    ->  Index Only Scan Backward using t1_pkey on t1 v_2
1068                          Index Cond: ((id IS NOT NULL) AND (id < 10))
1069    ->  Bitmap Index Scan on t1_pkey
1070          Index Cond: (id = $3)
1071 (16 rows)
1072
1073 /*+BitmapScan(v_1)BitmapScan(v_2)*/
1074 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
1075 LOG:  pg_hint_plan:
1076 used hint:
1077 BitmapScan(v_1)
1078 BitmapScan(v_2)
1079 not used hint:
1080 duplication hint:
1081 error hint:
1082
1083                     QUERY PLAN                    
1084 --------------------------------------------------
1085  Index Only Scan using t1_pkey on t1
1086    Index Cond: (id = $3)
1087    InitPlan 1 (returns $1)
1088      ->  Aggregate
1089            ->  Bitmap Heap Scan on t1 v_1
1090                  Recheck Cond: (id < 10)
1091                  ->  Bitmap Index Scan on t1_pkey
1092                        Index Cond: (id < 10)
1093    InitPlan 2 (returns $3)
1094      ->  Aggregate
1095            ->  Bitmap Heap Scan on t1 v_2
1096                  Recheck Cond: (id < 10)
1097                  ->  Bitmap Index Scan on t1_pkey
1098                        Index Cond: (id < 10)
1099 (14 rows)
1100
1101 /*+BitmapScan(v_1)BitmapScan(t1)*/
1102 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
1103 LOG:  pg_hint_plan:
1104 used hint:
1105 BitmapScan(t1)
1106 BitmapScan(v_1)
1107 not used hint:
1108 duplication hint:
1109 error hint:
1110
1111                                QUERY PLAN                               
1112 ------------------------------------------------------------------------
1113  Bitmap Heap Scan on t1
1114    Recheck Cond: (id = $3)
1115    InitPlan 1 (returns $1)
1116      ->  Aggregate
1117            ->  Bitmap Heap Scan on t1 v_1
1118                  Recheck Cond: (id < 10)
1119                  ->  Bitmap Index Scan on t1_pkey
1120                        Index Cond: (id < 10)
1121    InitPlan 3 (returns $3)
1122      ->  Result
1123            InitPlan 2 (returns $2)
1124              ->  Limit
1125                    ->  Index Only Scan Backward using t1_pkey on t1 v_2
1126                          Index Cond: ((id IS NOT NULL) AND (id < 10))
1127    ->  Bitmap Index Scan on t1_pkey
1128          Index Cond: (id = $3)
1129 (16 rows)
1130
1131 /*+BitmapScan(v_2)BitmapScan(t1)*/
1132 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
1133 LOG:  pg_hint_plan:
1134 used hint:
1135 BitmapScan(t1)
1136 BitmapScan(v_2)
1137 not used hint:
1138 duplication hint:
1139 error hint:
1140
1141                                QUERY PLAN                               
1142 ------------------------------------------------------------------------
1143  Bitmap Heap Scan on t1
1144    Recheck Cond: (id = $3)
1145    InitPlan 2 (returns $1)
1146      ->  Result
1147            InitPlan 1 (returns $0)
1148              ->  Limit
1149                    ->  Index Only Scan Backward using t1_pkey on t1 v_1
1150                          Index Cond: ((id IS NOT NULL) AND (id < 10))
1151    InitPlan 3 (returns $3)
1152      ->  Aggregate
1153            ->  Bitmap Heap Scan on t1 v_2
1154                  Recheck Cond: (id < 10)
1155                  ->  Bitmap Index Scan on t1_pkey
1156                        Index Cond: (id < 10)
1157    ->  Bitmap Index Scan on t1_pkey
1158          Index Cond: (id = $3)
1159 (16 rows)
1160
1161 /*+BitmapScan(v_1)BitmapScan(v_2)BitmapScan(t1)*/
1162 EXPLAIN (COSTS false) SELECT (SELECT max(id) FROM t1 v_1 WHERE id < 10), id FROM v1 WHERE v1.id = (SELECT max(id) FROM t1 v_2 WHERE id < 10);
1163 LOG:  pg_hint_plan:
1164 used hint:
1165 BitmapScan(t1)
1166 BitmapScan(v_1)
1167 BitmapScan(v_2)
1168 not used hint:
1169 duplication hint:
1170 error hint:
1171
1172                     QUERY PLAN                    
1173 --------------------------------------------------
1174  Bitmap Heap Scan on t1
1175    Recheck Cond: (id = $3)
1176    InitPlan 1 (returns $1)
1177      ->  Aggregate
1178            ->  Bitmap Heap Scan on t1 v_1
1179                  Recheck Cond: (id < 10)
1180                  ->  Bitmap Index Scan on t1_pkey
1181                        Index Cond: (id < 10)
1182    InitPlan 2 (returns $3)
1183      ->  Aggregate
1184            ->  Bitmap Heap Scan on t1 v_2
1185                  Recheck Cond: (id < 10)
1186                  ->  Bitmap Index Scan on t1_pkey
1187                        Index Cond: (id < 10)
1188    ->  Bitmap Index Scan on t1_pkey
1189          Index Cond: (id = $3)
1190 (16 rows)
1191
1192 -- full scan hint pattern test
1193 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1194             QUERY PLAN             
1195 -----------------------------------
1196  Tid Scan on t1
1197    TID Cond: (ctid = '(1,1)'::tid)
1198    Filter: (id < 10)
1199 (3 rows)
1200
1201 /*+SeqScan(t1)*/
1202 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1203 LOG:  pg_hint_plan:
1204 used hint:
1205 SeqScan(t1)
1206 not used hint:
1207 duplication hint:
1208 error hint:
1209
1210                    QUERY PLAN                    
1211 -------------------------------------------------
1212  Seq Scan on t1
1213    Filter: ((id < 10) AND (ctid = '(1,1)'::tid))
1214 (2 rows)
1215
1216 /*+IndexScan(t1)*/
1217 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1218 LOG:  pg_hint_plan:
1219 used hint:
1220 IndexScan(t1)
1221 not used hint:
1222 duplication hint:
1223 error hint:
1224
1225            QUERY PLAN            
1226 ---------------------------------
1227  Index Scan using t1_pkey on t1
1228    Index Cond: (id < 10)
1229    Filter: (ctid = '(1,1)'::tid)
1230 (3 rows)
1231
1232 /*+BitmapScan(t1)*/
1233 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1234 LOG:  pg_hint_plan:
1235 used hint:
1236 BitmapScan(t1)
1237 not used hint:
1238 duplication hint:
1239 error hint:
1240
1241              QUERY PLAN             
1242 ------------------------------------
1243  Bitmap Heap Scan on t1
1244    Recheck Cond: (id < 10)
1245    Filter: (ctid = '(1,1)'::tid)
1246    ->  Bitmap Index Scan on t1_pkey
1247          Index Cond: (id < 10)
1248 (5 rows)
1249
1250 /*+TidScan(t1)*/
1251 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1252 LOG:  pg_hint_plan:
1253 used hint:
1254 TidScan(t1)
1255 not used hint:
1256 duplication hint:
1257 error hint:
1258
1259             QUERY PLAN             
1260 -----------------------------------
1261  Tid Scan on t1
1262    TID Cond: (ctid = '(1,1)'::tid)
1263    Filter: (id < 10)
1264 (3 rows)
1265
1266 /*+NoSeqScan(t1)*/
1267 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1268 LOG:  pg_hint_plan:
1269 used hint:
1270 NoSeqScan(t1)
1271 not used hint:
1272 duplication hint:
1273 error hint:
1274
1275             QUERY PLAN             
1276 -----------------------------------
1277  Tid Scan on t1
1278    TID Cond: (ctid = '(1,1)'::tid)
1279    Filter: (id < 10)
1280 (3 rows)
1281
1282 /*+NoIndexScan(t1)*/
1283 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1284 LOG:  pg_hint_plan:
1285 used hint:
1286 NoIndexScan(t1)
1287 not used hint:
1288 duplication hint:
1289 error hint:
1290
1291             QUERY PLAN             
1292 -----------------------------------
1293  Tid Scan on t1
1294    TID Cond: (ctid = '(1,1)'::tid)
1295    Filter: (id < 10)
1296 (3 rows)
1297
1298 /*+NoBitmapScan(t1)*/
1299 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1300 LOG:  pg_hint_plan:
1301 used hint:
1302 NoBitmapScan(t1)
1303 not used hint:
1304 duplication hint:
1305 error hint:
1306
1307             QUERY PLAN             
1308 -----------------------------------
1309  Tid Scan on t1
1310    TID Cond: (ctid = '(1,1)'::tid)
1311    Filter: (id < 10)
1312 (3 rows)
1313
1314 /*+NoTidScan(t1)*/
1315 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE id < 10 AND ctid = '(1,1)';
1316 LOG:  pg_hint_plan:
1317 used hint:
1318 NoTidScan(t1)
1319 not used hint:
1320 duplication hint:
1321 error hint:
1322
1323            QUERY PLAN            
1324 ---------------------------------
1325  Index Scan using t1_pkey on t1
1326    Index Cond: (id < 10)
1327    Filter: (ctid = '(1,1)'::tid)
1328 (3 rows)
1329
1330 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1331                QUERY PLAN                
1332 -----------------------------------------
1333  Nested Loop
1334    Join Filter: (t1.id = t2.id)
1335    ->  Tid Scan on t1
1336          TID Cond: (ctid = '(1,1)'::tid)
1337    ->  Tid Scan on t2
1338          TID Cond: (ctid = '(1,1)'::tid)
1339 (6 rows)
1340
1341 /*+SeqScan(t1)*/
1342 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1343 LOG:  pg_hint_plan:
1344 used hint:
1345 SeqScan(t1)
1346 not used hint:
1347 duplication hint:
1348 error hint:
1349
1350                QUERY PLAN                
1351 -----------------------------------------
1352  Nested Loop
1353    Join Filter: (t1.id = t2.id)
1354    ->  Seq Scan on t1
1355          Filter: (ctid = '(1,1)'::tid)
1356    ->  Tid Scan on t2
1357          TID Cond: (ctid = '(1,1)'::tid)
1358 (6 rows)
1359
1360 /*+SeqScan(t2)*/
1361 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1362 LOG:  pg_hint_plan:
1363 used hint:
1364 SeqScan(t2)
1365 not used hint:
1366 duplication hint:
1367 error hint:
1368
1369                QUERY PLAN                
1370 -----------------------------------------
1371  Nested Loop
1372    Join Filter: (t1.id = t2.id)
1373    ->  Tid Scan on t1
1374          TID Cond: (ctid = '(1,1)'::tid)
1375    ->  Seq Scan on t2
1376          Filter: (ctid = '(1,1)'::tid)
1377 (6 rows)
1378
1379 /*+SeqScan(t1) SeqScan(t2)*/
1380 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1381 LOG:  pg_hint_plan:
1382 used hint:
1383 SeqScan(t1)
1384 SeqScan(t2)
1385 not used hint:
1386 duplication hint:
1387 error hint:
1388
1389               QUERY PLAN               
1390 ---------------------------------------
1391  Nested Loop
1392    Join Filter: (t1.id = t2.id)
1393    ->  Seq Scan on t1
1394          Filter: (ctid = '(1,1)'::tid)
1395    ->  Seq Scan on t2
1396          Filter: (ctid = '(1,1)'::tid)
1397 (6 rows)
1398
1399 /*+SeqScan(t1) IndexScan(t2)*/
1400 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1401 LOG:  pg_hint_plan:
1402 used hint:
1403 SeqScan(t1)
1404 IndexScan(t2)
1405 not used hint:
1406 duplication hint:
1407 error hint:
1408
1409               QUERY PLAN               
1410 ---------------------------------------
1411  Nested Loop
1412    ->  Seq Scan on t1
1413          Filter: (ctid = '(1,1)'::tid)
1414    ->  Index Scan using t2_pkey on t2
1415          Index Cond: (id = t1.id)
1416          Filter: (ctid = '(1,1)'::tid)
1417 (6 rows)
1418
1419 /*+SeqScan(t1) BitmapScan(t2)*/
1420 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1421 LOG:  pg_hint_plan:
1422 used hint:
1423 SeqScan(t1)
1424 BitmapScan(t2)
1425 not used hint:
1426 duplication hint:
1427 error hint:
1428
1429                 QUERY PLAN                
1430 ------------------------------------------
1431  Nested Loop
1432    ->  Seq Scan on t1
1433          Filter: (ctid = '(1,1)'::tid)
1434    ->  Bitmap Heap Scan on t2
1435          Recheck Cond: (id = t1.id)
1436          Filter: (ctid = '(1,1)'::tid)
1437          ->  Bitmap Index Scan on t2_pkey
1438                Index Cond: (id = t1.id)
1439 (8 rows)
1440
1441 /*+SeqScan(t1) TidScan(t2)*/
1442 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1443 LOG:  pg_hint_plan:
1444 used hint:
1445 SeqScan(t1)
1446 TidScan(t2)
1447 not used hint:
1448 duplication hint:
1449 error hint:
1450
1451                QUERY PLAN                
1452 -----------------------------------------
1453  Nested Loop
1454    Join Filter: (t1.id = t2.id)
1455    ->  Seq Scan on t1
1456          Filter: (ctid = '(1,1)'::tid)
1457    ->  Tid Scan on t2
1458          TID Cond: (ctid = '(1,1)'::tid)
1459 (6 rows)
1460
1461 /*+SeqScan(t1) NoSeqScan(t2)*/
1462 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1463 LOG:  pg_hint_plan:
1464 used hint:
1465 SeqScan(t1)
1466 NoSeqScan(t2)
1467 not used hint:
1468 duplication hint:
1469 error hint:
1470
1471                QUERY PLAN                
1472 -----------------------------------------
1473  Nested Loop
1474    Join Filter: (t1.id = t2.id)
1475    ->  Seq Scan on t1
1476          Filter: (ctid = '(1,1)'::tid)
1477    ->  Tid Scan on t2
1478          TID Cond: (ctid = '(1,1)'::tid)
1479 (6 rows)
1480
1481 /*+SeqScan(t1) NoIndexScan(t2)*/
1482 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1483 LOG:  pg_hint_plan:
1484 used hint:
1485 SeqScan(t1)
1486 NoIndexScan(t2)
1487 not used hint:
1488 duplication hint:
1489 error hint:
1490
1491                QUERY PLAN                
1492 -----------------------------------------
1493  Nested Loop
1494    Join Filter: (t1.id = t2.id)
1495    ->  Seq Scan on t1
1496          Filter: (ctid = '(1,1)'::tid)
1497    ->  Tid Scan on t2
1498          TID Cond: (ctid = '(1,1)'::tid)
1499 (6 rows)
1500
1501 /*+SeqScan(t1) NoBitmapScan(t2)*/
1502 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1503 LOG:  pg_hint_plan:
1504 used hint:
1505 SeqScan(t1)
1506 NoBitmapScan(t2)
1507 not used hint:
1508 duplication hint:
1509 error hint:
1510
1511                QUERY PLAN                
1512 -----------------------------------------
1513  Nested Loop
1514    Join Filter: (t1.id = t2.id)
1515    ->  Seq Scan on t1
1516          Filter: (ctid = '(1,1)'::tid)
1517    ->  Tid Scan on t2
1518          TID Cond: (ctid = '(1,1)'::tid)
1519 (6 rows)
1520
1521 /*+SeqScan(t1) NoTidScan(t2)*/
1522 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1523 LOG:  pg_hint_plan:
1524 used hint:
1525 SeqScan(t1)
1526 NoTidScan(t2)
1527 not used hint:
1528 duplication hint:
1529 error hint:
1530
1531               QUERY PLAN               
1532 ---------------------------------------
1533  Nested Loop
1534    Join Filter: (t1.id = t2.id)
1535    ->  Seq Scan on t1
1536          Filter: (ctid = '(1,1)'::tid)
1537    ->  Seq Scan on t2
1538          Filter: (ctid = '(1,1)'::tid)
1539 (6 rows)
1540
1541 /*+IndexScan(t1)*/
1542 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1543 LOG:  pg_hint_plan:
1544 used hint:
1545 IndexScan(t1)
1546 not used hint:
1547 duplication hint:
1548 error hint:
1549
1550                QUERY PLAN                
1551 -----------------------------------------
1552  Nested Loop
1553    ->  Tid Scan on t2
1554          TID Cond: (ctid = '(1,1)'::tid)
1555    ->  Index Scan using t1_pkey on t1
1556          Index Cond: (id = t2.id)
1557          Filter: (ctid = '(1,1)'::tid)
1558 (6 rows)
1559
1560 /*+IndexScan(t2)*/
1561 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1562 LOG:  pg_hint_plan:
1563 used hint:
1564 IndexScan(t2)
1565 not used hint:
1566 duplication hint:
1567 error hint:
1568
1569                QUERY PLAN                
1570 -----------------------------------------
1571  Nested Loop
1572    ->  Tid Scan on t1
1573          TID Cond: (ctid = '(1,1)'::tid)
1574    ->  Index Scan using t2_pkey on t2
1575          Index Cond: (id = t1.id)
1576          Filter: (ctid = '(1,1)'::tid)
1577 (6 rows)
1578
1579 /*+IndexScan(t1) SeqScan(t2)*/
1580 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1581 LOG:  pg_hint_plan:
1582 used hint:
1583 IndexScan(t1)
1584 SeqScan(t2)
1585 not used hint:
1586 duplication hint:
1587 error hint:
1588
1589               QUERY PLAN               
1590 ---------------------------------------
1591  Nested Loop
1592    ->  Seq Scan on t2
1593          Filter: (ctid = '(1,1)'::tid)
1594    ->  Index Scan using t1_pkey on t1
1595          Index Cond: (id = t2.id)
1596          Filter: (ctid = '(1,1)'::tid)
1597 (6 rows)
1598
1599 /*+IndexScan(t1) IndexScan(t2)*/
1600 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1601 LOG:  pg_hint_plan:
1602 used hint:
1603 IndexScan(t1)
1604 IndexScan(t2)
1605 not used hint:
1606 duplication hint:
1607 error hint:
1608
1609               QUERY PLAN               
1610 ---------------------------------------
1611  Nested Loop
1612    ->  Index Scan using t2_pkey on t2
1613          Filter: (ctid = '(1,1)'::tid)
1614    ->  Index Scan using t1_pkey on t1
1615          Index Cond: (id = t2.id)
1616          Filter: (ctid = '(1,1)'::tid)
1617 (6 rows)
1618
1619 /*+IndexScan(t1) BitmapScan(t2)*/
1620 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1621 LOG:  pg_hint_plan:
1622 used hint:
1623 IndexScan(t1)
1624 BitmapScan(t2)
1625 not used hint:
1626 duplication hint:
1627 error hint:
1628
1629                 QUERY PLAN                
1630 ------------------------------------------
1631  Nested Loop
1632    ->  Index Scan using t1_pkey on t1
1633          Filter: (ctid = '(1,1)'::tid)
1634    ->  Bitmap Heap Scan on t2
1635          Recheck Cond: (id = t1.id)
1636          Filter: (ctid = '(1,1)'::tid)
1637          ->  Bitmap Index Scan on t2_pkey
1638                Index Cond: (id = t1.id)
1639 (8 rows)
1640
1641 /*+IndexScan(t1) TidScan(t2)*/
1642 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1643 LOG:  pg_hint_plan:
1644 used hint:
1645 IndexScan(t1)
1646 TidScan(t2)
1647 not used hint:
1648 duplication hint:
1649 error hint:
1650
1651                QUERY PLAN                
1652 -----------------------------------------
1653  Nested Loop
1654    ->  Tid Scan on t2
1655          TID Cond: (ctid = '(1,1)'::tid)
1656    ->  Index Scan using t1_pkey on t1
1657          Index Cond: (id = t2.id)
1658          Filter: (ctid = '(1,1)'::tid)
1659 (6 rows)
1660
1661 /*+IndexScan(t1) NoSeqScan(t2)*/
1662 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1663 LOG:  pg_hint_plan:
1664 used hint:
1665 IndexScan(t1)
1666 NoSeqScan(t2)
1667 not used hint:
1668 duplication hint:
1669 error hint:
1670
1671                QUERY PLAN                
1672 -----------------------------------------
1673  Nested Loop
1674    ->  Tid Scan on t2
1675          TID Cond: (ctid = '(1,1)'::tid)
1676    ->  Index Scan using t1_pkey on t1
1677          Index Cond: (id = t2.id)
1678          Filter: (ctid = '(1,1)'::tid)
1679 (6 rows)
1680
1681 /*+IndexScan(t1) NoIndexScan(t2)*/
1682 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1683 LOG:  pg_hint_plan:
1684 used hint:
1685 IndexScan(t1)
1686 NoIndexScan(t2)
1687 not used hint:
1688 duplication hint:
1689 error hint:
1690
1691                QUERY PLAN                
1692 -----------------------------------------
1693  Nested Loop
1694    ->  Tid Scan on t2
1695          TID Cond: (ctid = '(1,1)'::tid)
1696    ->  Index Scan using t1_pkey on t1
1697          Index Cond: (id = t2.id)
1698          Filter: (ctid = '(1,1)'::tid)
1699 (6 rows)
1700
1701 /*+IndexScan(t1) NoBitmapScan(t2)*/
1702 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1703 LOG:  pg_hint_plan:
1704 used hint:
1705 IndexScan(t1)
1706 NoBitmapScan(t2)
1707 not used hint:
1708 duplication hint:
1709 error hint:
1710
1711                QUERY PLAN                
1712 -----------------------------------------
1713  Nested Loop
1714    ->  Tid Scan on t2
1715          TID Cond: (ctid = '(1,1)'::tid)
1716    ->  Index Scan using t1_pkey on t1
1717          Index Cond: (id = t2.id)
1718          Filter: (ctid = '(1,1)'::tid)
1719 (6 rows)
1720
1721 /*+IndexScan(t1) NoTidScan(t2)*/
1722 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1723 LOG:  pg_hint_plan:
1724 used hint:
1725 IndexScan(t1)
1726 NoTidScan(t2)
1727 not used hint:
1728 duplication hint:
1729 error hint:
1730
1731               QUERY PLAN               
1732 ---------------------------------------
1733  Nested Loop
1734    ->  Seq Scan on t2
1735          Filter: (ctid = '(1,1)'::tid)
1736    ->  Index Scan using t1_pkey on t1
1737          Index Cond: (id = t2.id)
1738          Filter: (ctid = '(1,1)'::tid)
1739 (6 rows)
1740
1741 /*+BitmapScan(t1)*/
1742 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1743 LOG:  pg_hint_plan:
1744 used hint:
1745 BitmapScan(t1)
1746 not used hint:
1747 duplication hint:
1748 error hint:
1749
1750                 QUERY PLAN                
1751 ------------------------------------------
1752  Nested Loop
1753    ->  Tid Scan on t2
1754          TID Cond: (ctid = '(1,1)'::tid)
1755    ->  Bitmap Heap Scan on t1
1756          Recheck Cond: (id = t2.id)
1757          Filter: (ctid = '(1,1)'::tid)
1758          ->  Bitmap Index Scan on t1_pkey
1759                Index Cond: (id = t2.id)
1760 (8 rows)
1761
1762 /*+BitmapScan(t2)*/
1763 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1764 LOG:  pg_hint_plan:
1765 used hint:
1766 BitmapScan(t2)
1767 not used hint:
1768 duplication hint:
1769 error hint:
1770
1771                 QUERY PLAN                
1772 ------------------------------------------
1773  Nested Loop
1774    ->  Tid Scan on t1
1775          TID Cond: (ctid = '(1,1)'::tid)
1776    ->  Bitmap Heap Scan on t2
1777          Recheck Cond: (id = t1.id)
1778          Filter: (ctid = '(1,1)'::tid)
1779          ->  Bitmap Index Scan on t2_pkey
1780                Index Cond: (id = t1.id)
1781 (8 rows)
1782
1783 /*+BitmapScan(t2)*/
1784 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1785 LOG:  pg_hint_plan:
1786 used hint:
1787 BitmapScan(t2)
1788 not used hint:
1789 duplication hint:
1790 error hint:
1791
1792                 QUERY PLAN                
1793 ------------------------------------------
1794  Nested Loop
1795    ->  Tid Scan on t1
1796          TID Cond: (ctid = '(1,1)'::tid)
1797    ->  Bitmap Heap Scan on t2
1798          Recheck Cond: (id = t1.id)
1799          Filter: (ctid = '(1,1)'::tid)
1800          ->  Bitmap Index Scan on t2_pkey
1801                Index Cond: (id = t1.id)
1802 (8 rows)
1803
1804 /*+BitmapScan(t1) SeqScan(t2)*/
1805 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1806 LOG:  pg_hint_plan:
1807 used hint:
1808 BitmapScan(t1)
1809 SeqScan(t2)
1810 not used hint:
1811 duplication hint:
1812 error hint:
1813
1814                 QUERY PLAN                
1815 ------------------------------------------
1816  Nested Loop
1817    ->  Seq Scan on t2
1818          Filter: (ctid = '(1,1)'::tid)
1819    ->  Bitmap Heap Scan on t1
1820          Recheck Cond: (id = t2.id)
1821          Filter: (ctid = '(1,1)'::tid)
1822          ->  Bitmap Index Scan on t1_pkey
1823                Index Cond: (id = t2.id)
1824 (8 rows)
1825
1826 /*+BitmapScan(t1) IndexScan(t2)*/
1827 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1828 LOG:  pg_hint_plan:
1829 used hint:
1830 BitmapScan(t1)
1831 IndexScan(t2)
1832 not used hint:
1833 duplication hint:
1834 error hint:
1835
1836                 QUERY PLAN                
1837 ------------------------------------------
1838  Nested Loop
1839    ->  Index Scan using t2_pkey on t2
1840          Filter: (ctid = '(1,1)'::tid)
1841    ->  Bitmap Heap Scan on t1
1842          Recheck Cond: (id = t2.id)
1843          Filter: (ctid = '(1,1)'::tid)
1844          ->  Bitmap Index Scan on t1_pkey
1845                Index Cond: (id = t2.id)
1846 (8 rows)
1847
1848 /*+BitmapScan(t1) BitmapScan(t2)*/
1849 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1850 LOG:  pg_hint_plan:
1851 used hint:
1852 BitmapScan(t1)
1853 BitmapScan(t2)
1854 not used hint:
1855 duplication hint:
1856 error hint:
1857
1858                 QUERY PLAN                
1859 ------------------------------------------
1860  Nested Loop
1861    ->  Index Scan using t2_pkey on t2
1862          Filter: (ctid = '(1,1)'::tid)
1863    ->  Bitmap Heap Scan on t1
1864          Recheck Cond: (id = t2.id)
1865          Filter: (ctid = '(1,1)'::tid)
1866          ->  Bitmap Index Scan on t1_pkey
1867                Index Cond: (id = t2.id)
1868 (8 rows)
1869
1870 /*+BitmapScan(t1) TidScan(t2)*/
1871 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1872 LOG:  pg_hint_plan:
1873 used hint:
1874 BitmapScan(t1)
1875 TidScan(t2)
1876 not used hint:
1877 duplication hint:
1878 error hint:
1879
1880                 QUERY PLAN                
1881 ------------------------------------------
1882  Nested Loop
1883    ->  Tid Scan on t2
1884          TID Cond: (ctid = '(1,1)'::tid)
1885    ->  Bitmap Heap Scan on t1
1886          Recheck Cond: (id = t2.id)
1887          Filter: (ctid = '(1,1)'::tid)
1888          ->  Bitmap Index Scan on t1_pkey
1889                Index Cond: (id = t2.id)
1890 (8 rows)
1891
1892 /*+BitmapScan(t1) NoSeqScan(t2)*/
1893 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1894 LOG:  pg_hint_plan:
1895 used hint:
1896 BitmapScan(t1)
1897 NoSeqScan(t2)
1898 not used hint:
1899 duplication hint:
1900 error hint:
1901
1902                 QUERY PLAN                
1903 ------------------------------------------
1904  Nested Loop
1905    ->  Tid Scan on t2
1906          TID Cond: (ctid = '(1,1)'::tid)
1907    ->  Bitmap Heap Scan on t1
1908          Recheck Cond: (id = t2.id)
1909          Filter: (ctid = '(1,1)'::tid)
1910          ->  Bitmap Index Scan on t1_pkey
1911                Index Cond: (id = t2.id)
1912 (8 rows)
1913
1914 /*+BitmapScan(t1) NoIndexScan(t2)*/
1915 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1916 LOG:  pg_hint_plan:
1917 used hint:
1918 BitmapScan(t1)
1919 NoIndexScan(t2)
1920 not used hint:
1921 duplication hint:
1922 error hint:
1923
1924                 QUERY PLAN                
1925 ------------------------------------------
1926  Nested Loop
1927    ->  Tid Scan on t2
1928          TID Cond: (ctid = '(1,1)'::tid)
1929    ->  Bitmap Heap Scan on t1
1930          Recheck Cond: (id = t2.id)
1931          Filter: (ctid = '(1,1)'::tid)
1932          ->  Bitmap Index Scan on t1_pkey
1933                Index Cond: (id = t2.id)
1934 (8 rows)
1935
1936 /*+BitmapScan(t1) NoBitmapScan(t2)*/
1937 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1938 LOG:  pg_hint_plan:
1939 used hint:
1940 BitmapScan(t1)
1941 NoBitmapScan(t2)
1942 not used hint:
1943 duplication hint:
1944 error hint:
1945
1946                 QUERY PLAN                
1947 ------------------------------------------
1948  Nested Loop
1949    ->  Tid Scan on t2
1950          TID Cond: (ctid = '(1,1)'::tid)
1951    ->  Bitmap Heap Scan on t1
1952          Recheck Cond: (id = t2.id)
1953          Filter: (ctid = '(1,1)'::tid)
1954          ->  Bitmap Index Scan on t1_pkey
1955                Index Cond: (id = t2.id)
1956 (8 rows)
1957
1958 /*+BitmapScan(t1) NoTidScan(t2)*/
1959 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1960 LOG:  pg_hint_plan:
1961 used hint:
1962 BitmapScan(t1)
1963 NoTidScan(t2)
1964 not used hint:
1965 duplication hint:
1966 error hint:
1967
1968                 QUERY PLAN                
1969 ------------------------------------------
1970  Nested Loop
1971    ->  Seq Scan on t2
1972          Filter: (ctid = '(1,1)'::tid)
1973    ->  Bitmap Heap Scan on t1
1974          Recheck Cond: (id = t2.id)
1975          Filter: (ctid = '(1,1)'::tid)
1976          ->  Bitmap Index Scan on t1_pkey
1977                Index Cond: (id = t2.id)
1978 (8 rows)
1979
1980 /*+TidScan(t1)*/
1981 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
1982 LOG:  pg_hint_plan:
1983 used hint:
1984 TidScan(t1)
1985 not used hint:
1986 duplication hint:
1987 error hint:
1988
1989                QUERY PLAN                
1990 -----------------------------------------
1991  Nested Loop
1992    Join Filter: (t1.id = t2.id)
1993    ->  Tid Scan on t1
1994          TID Cond: (ctid = '(1,1)'::tid)
1995    ->  Tid Scan on t2
1996          TID Cond: (ctid = '(1,1)'::tid)
1997 (6 rows)
1998
1999 /*+TidScan(t2)*/
2000 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2001 LOG:  pg_hint_plan:
2002 used hint:
2003 TidScan(t2)
2004 not used hint:
2005 duplication hint:
2006 error hint:
2007
2008                QUERY PLAN                
2009 -----------------------------------------
2010  Nested Loop
2011    Join Filter: (t1.id = t2.id)
2012    ->  Tid Scan on t1
2013          TID Cond: (ctid = '(1,1)'::tid)
2014    ->  Tid Scan on t2
2015          TID Cond: (ctid = '(1,1)'::tid)
2016 (6 rows)
2017
2018 /*+TidScan(t1) SeqScan(t2)*/
2019 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2020 LOG:  pg_hint_plan:
2021 used hint:
2022 TidScan(t1)
2023 SeqScan(t2)
2024 not used hint:
2025 duplication hint:
2026 error hint:
2027
2028                QUERY PLAN                
2029 -----------------------------------------
2030  Nested Loop
2031    Join Filter: (t1.id = t2.id)
2032    ->  Tid Scan on t1
2033          TID Cond: (ctid = '(1,1)'::tid)
2034    ->  Seq Scan on t2
2035          Filter: (ctid = '(1,1)'::tid)
2036 (6 rows)
2037
2038 /*+TidScan(t1) IndexScan(t2)*/
2039 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2040 LOG:  pg_hint_plan:
2041 used hint:
2042 TidScan(t1)
2043 IndexScan(t2)
2044 not used hint:
2045 duplication hint:
2046 error hint:
2047
2048                QUERY PLAN                
2049 -----------------------------------------
2050  Nested Loop
2051    ->  Tid Scan on t1
2052          TID Cond: (ctid = '(1,1)'::tid)
2053    ->  Index Scan using t2_pkey on t2
2054          Index Cond: (id = t1.id)
2055          Filter: (ctid = '(1,1)'::tid)
2056 (6 rows)
2057
2058 /*+TidScan(t1) BitmapScan(t2)*/
2059 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2060 LOG:  pg_hint_plan:
2061 used hint:
2062 TidScan(t1)
2063 BitmapScan(t2)
2064 not used hint:
2065 duplication hint:
2066 error hint:
2067
2068                 QUERY PLAN                
2069 ------------------------------------------
2070  Nested Loop
2071    ->  Tid Scan on t1
2072          TID Cond: (ctid = '(1,1)'::tid)
2073    ->  Bitmap Heap Scan on t2
2074          Recheck Cond: (id = t1.id)
2075          Filter: (ctid = '(1,1)'::tid)
2076          ->  Bitmap Index Scan on t2_pkey
2077                Index Cond: (id = t1.id)
2078 (8 rows)
2079
2080 /*+TidScan(t1) TidScan(t2)*/
2081 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2082 LOG:  pg_hint_plan:
2083 used hint:
2084 TidScan(t1)
2085 TidScan(t2)
2086 not used hint:
2087 duplication hint:
2088 error hint:
2089
2090                QUERY PLAN                
2091 -----------------------------------------
2092  Nested Loop
2093    Join Filter: (t1.id = t2.id)
2094    ->  Tid Scan on t1
2095          TID Cond: (ctid = '(1,1)'::tid)
2096    ->  Tid Scan on t2
2097          TID Cond: (ctid = '(1,1)'::tid)
2098 (6 rows)
2099
2100 /*+TidScan(t1) NoSeqScan(t2)*/
2101 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2102 LOG:  pg_hint_plan:
2103 used hint:
2104 TidScan(t1)
2105 NoSeqScan(t2)
2106 not used hint:
2107 duplication hint:
2108 error hint:
2109
2110                QUERY PLAN                
2111 -----------------------------------------
2112  Nested Loop
2113    Join Filter: (t1.id = t2.id)
2114    ->  Tid Scan on t1
2115          TID Cond: (ctid = '(1,1)'::tid)
2116    ->  Tid Scan on t2
2117          TID Cond: (ctid = '(1,1)'::tid)
2118 (6 rows)
2119
2120 /*+TidScan(t1) NoIndexScan(t2)*/
2121 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2122 LOG:  pg_hint_plan:
2123 used hint:
2124 TidScan(t1)
2125 NoIndexScan(t2)
2126 not used hint:
2127 duplication hint:
2128 error hint:
2129
2130                QUERY PLAN                
2131 -----------------------------------------
2132  Nested Loop
2133    Join Filter: (t1.id = t2.id)
2134    ->  Tid Scan on t1
2135          TID Cond: (ctid = '(1,1)'::tid)
2136    ->  Tid Scan on t2
2137          TID Cond: (ctid = '(1,1)'::tid)
2138 (6 rows)
2139
2140 /*+TidScan(t1) NoBitmapScan(t2)*/
2141 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2142 LOG:  pg_hint_plan:
2143 used hint:
2144 TidScan(t1)
2145 NoBitmapScan(t2)
2146 not used hint:
2147 duplication hint:
2148 error hint:
2149
2150                QUERY PLAN                
2151 -----------------------------------------
2152  Nested Loop
2153    Join Filter: (t1.id = t2.id)
2154    ->  Tid Scan on t1
2155          TID Cond: (ctid = '(1,1)'::tid)
2156    ->  Tid Scan on t2
2157          TID Cond: (ctid = '(1,1)'::tid)
2158 (6 rows)
2159
2160 /*+TidScan(t1) NoTidScan(t2)*/
2161 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2162 LOG:  pg_hint_plan:
2163 used hint:
2164 TidScan(t1)
2165 NoTidScan(t2)
2166 not used hint:
2167 duplication hint:
2168 error hint:
2169
2170                QUERY PLAN                
2171 -----------------------------------------
2172  Nested Loop
2173    ->  Tid Scan on t1
2174          TID Cond: (ctid = '(1,1)'::tid)
2175    ->  Index Scan using t2_pkey on t2
2176          Index Cond: (id = t1.id)
2177          Filter: (ctid = '(1,1)'::tid)
2178 (6 rows)
2179
2180 /*+NoSeqScan(t1)*/
2181 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2182 LOG:  pg_hint_plan:
2183 used hint:
2184 NoSeqScan(t1)
2185 not used hint:
2186 duplication hint:
2187 error hint:
2188
2189                QUERY PLAN                
2190 -----------------------------------------
2191  Nested Loop
2192    Join Filter: (t1.id = t2.id)
2193    ->  Tid Scan on t1
2194          TID Cond: (ctid = '(1,1)'::tid)
2195    ->  Tid Scan on t2
2196          TID Cond: (ctid = '(1,1)'::tid)
2197 (6 rows)
2198
2199 /*+NoSeqScan(t2)*/
2200 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2201 LOG:  pg_hint_plan:
2202 used hint:
2203 NoSeqScan(t2)
2204 not used hint:
2205 duplication hint:
2206 error hint:
2207
2208                QUERY PLAN                
2209 -----------------------------------------
2210  Nested Loop
2211    Join Filter: (t1.id = t2.id)
2212    ->  Tid Scan on t1
2213          TID Cond: (ctid = '(1,1)'::tid)
2214    ->  Tid Scan on t2
2215          TID Cond: (ctid = '(1,1)'::tid)
2216 (6 rows)
2217
2218 /*+NoSeqScan(t1) SeqScan(t2)*/
2219 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2220 LOG:  pg_hint_plan:
2221 used hint:
2222 NoSeqScan(t1)
2223 SeqScan(t2)
2224 not used hint:
2225 duplication hint:
2226 error hint:
2227
2228                QUERY PLAN                
2229 -----------------------------------------
2230  Nested Loop
2231    Join Filter: (t1.id = t2.id)
2232    ->  Tid Scan on t1
2233          TID Cond: (ctid = '(1,1)'::tid)
2234    ->  Seq Scan on t2
2235          Filter: (ctid = '(1,1)'::tid)
2236 (6 rows)
2237
2238 /*+NoSeqScan(t1) IndexScan(t2)*/
2239 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2240 LOG:  pg_hint_plan:
2241 used hint:
2242 NoSeqScan(t1)
2243 IndexScan(t2)
2244 not used hint:
2245 duplication hint:
2246 error hint:
2247
2248                QUERY PLAN                
2249 -----------------------------------------
2250  Nested Loop
2251    ->  Tid Scan on t1
2252          TID Cond: (ctid = '(1,1)'::tid)
2253    ->  Index Scan using t2_pkey on t2
2254          Index Cond: (id = t1.id)
2255          Filter: (ctid = '(1,1)'::tid)
2256 (6 rows)
2257
2258 /*+NoSeqScan(t1) BitmapScan(t2)*/
2259 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2260 LOG:  pg_hint_plan:
2261 used hint:
2262 NoSeqScan(t1)
2263 BitmapScan(t2)
2264 not used hint:
2265 duplication hint:
2266 error hint:
2267
2268                 QUERY PLAN                
2269 ------------------------------------------
2270  Nested Loop
2271    ->  Tid Scan on t1
2272          TID Cond: (ctid = '(1,1)'::tid)
2273    ->  Bitmap Heap Scan on t2
2274          Recheck Cond: (id = t1.id)
2275          Filter: (ctid = '(1,1)'::tid)
2276          ->  Bitmap Index Scan on t2_pkey
2277                Index Cond: (id = t1.id)
2278 (8 rows)
2279
2280 /*+NoSeqScan(t1) TidScan(t2)*/
2281 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2282 LOG:  pg_hint_plan:
2283 used hint:
2284 NoSeqScan(t1)
2285 TidScan(t2)
2286 not used hint:
2287 duplication hint:
2288 error hint:
2289
2290                QUERY PLAN                
2291 -----------------------------------------
2292  Nested Loop
2293    Join Filter: (t1.id = t2.id)
2294    ->  Tid Scan on t1
2295          TID Cond: (ctid = '(1,1)'::tid)
2296    ->  Tid Scan on t2
2297          TID Cond: (ctid = '(1,1)'::tid)
2298 (6 rows)
2299
2300 /*+NoSeqScan(t1) NoSeqScan(t2)*/
2301 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2302 LOG:  pg_hint_plan:
2303 used hint:
2304 NoSeqScan(t1)
2305 NoSeqScan(t2)
2306 not used hint:
2307 duplication hint:
2308 error hint:
2309
2310                QUERY PLAN                
2311 -----------------------------------------
2312  Nested Loop
2313    Join Filter: (t1.id = t2.id)
2314    ->  Tid Scan on t1
2315          TID Cond: (ctid = '(1,1)'::tid)
2316    ->  Tid Scan on t2
2317          TID Cond: (ctid = '(1,1)'::tid)
2318 (6 rows)
2319
2320 /*+NoSeqScan(t1) NoIndexScan(t2)*/
2321 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2322 LOG:  pg_hint_plan:
2323 used hint:
2324 NoSeqScan(t1)
2325 NoIndexScan(t2)
2326 not used hint:
2327 duplication hint:
2328 error hint:
2329
2330                QUERY PLAN                
2331 -----------------------------------------
2332  Nested Loop
2333    Join Filter: (t1.id = t2.id)
2334    ->  Tid Scan on t1
2335          TID Cond: (ctid = '(1,1)'::tid)
2336    ->  Tid Scan on t2
2337          TID Cond: (ctid = '(1,1)'::tid)
2338 (6 rows)
2339
2340 /*+NoSeqScan(t1) NoBitmapScan(t2)*/
2341 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2342 LOG:  pg_hint_plan:
2343 used hint:
2344 NoSeqScan(t1)
2345 NoBitmapScan(t2)
2346 not used hint:
2347 duplication hint:
2348 error hint:
2349
2350                QUERY PLAN                
2351 -----------------------------------------
2352  Nested Loop
2353    Join Filter: (t1.id = t2.id)
2354    ->  Tid Scan on t1
2355          TID Cond: (ctid = '(1,1)'::tid)
2356    ->  Tid Scan on t2
2357          TID Cond: (ctid = '(1,1)'::tid)
2358 (6 rows)
2359
2360 /*+NoSeqScan(t1) NoTidScan(t2)*/
2361 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2362 LOG:  pg_hint_plan:
2363 used hint:
2364 NoSeqScan(t1)
2365 NoTidScan(t2)
2366 not used hint:
2367 duplication hint:
2368 error hint:
2369
2370                QUERY PLAN                
2371 -----------------------------------------
2372  Nested Loop
2373    ->  Tid Scan on t1
2374          TID Cond: (ctid = '(1,1)'::tid)
2375    ->  Index Scan using t2_pkey on t2
2376          Index Cond: (id = t1.id)
2377          Filter: (ctid = '(1,1)'::tid)
2378 (6 rows)
2379
2380 /*+NoIndexScan(t1)*/
2381 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2382 LOG:  pg_hint_plan:
2383 used hint:
2384 NoIndexScan(t1)
2385 not used hint:
2386 duplication hint:
2387 error hint:
2388
2389                QUERY PLAN                
2390 -----------------------------------------
2391  Nested Loop
2392    Join Filter: (t1.id = t2.id)
2393    ->  Tid Scan on t1
2394          TID Cond: (ctid = '(1,1)'::tid)
2395    ->  Tid Scan on t2
2396          TID Cond: (ctid = '(1,1)'::tid)
2397 (6 rows)
2398
2399 /*+NoIndexScan(t2)*/
2400 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2401 LOG:  pg_hint_plan:
2402 used hint:
2403 NoIndexScan(t2)
2404 not used hint:
2405 duplication hint:
2406 error hint:
2407
2408                QUERY PLAN                
2409 -----------------------------------------
2410  Nested Loop
2411    Join Filter: (t1.id = t2.id)
2412    ->  Tid Scan on t1
2413          TID Cond: (ctid = '(1,1)'::tid)
2414    ->  Tid Scan on t2
2415          TID Cond: (ctid = '(1,1)'::tid)
2416 (6 rows)
2417
2418 /*+NoIndexScan(t1) SeqScan(t2)*/
2419 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2420 LOG:  pg_hint_plan:
2421 used hint:
2422 NoIndexScan(t1)
2423 SeqScan(t2)
2424 not used hint:
2425 duplication hint:
2426 error hint:
2427
2428                QUERY PLAN                
2429 -----------------------------------------
2430  Nested Loop
2431    Join Filter: (t1.id = t2.id)
2432    ->  Tid Scan on t1
2433          TID Cond: (ctid = '(1,1)'::tid)
2434    ->  Seq Scan on t2
2435          Filter: (ctid = '(1,1)'::tid)
2436 (6 rows)
2437
2438 /*+NoIndexScan(t1) IndexScan(t2)*/
2439 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2440 LOG:  pg_hint_plan:
2441 used hint:
2442 NoIndexScan(t1)
2443 IndexScan(t2)
2444 not used hint:
2445 duplication hint:
2446 error hint:
2447
2448                QUERY PLAN                
2449 -----------------------------------------
2450  Nested Loop
2451    ->  Tid Scan on t1
2452          TID Cond: (ctid = '(1,1)'::tid)
2453    ->  Index Scan using t2_pkey on t2
2454          Index Cond: (id = t1.id)
2455          Filter: (ctid = '(1,1)'::tid)
2456 (6 rows)
2457
2458 /*+NoIndexScan(t1) BitmapScan(t2)*/
2459 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2460 LOG:  pg_hint_plan:
2461 used hint:
2462 NoIndexScan(t1)
2463 BitmapScan(t2)
2464 not used hint:
2465 duplication hint:
2466 error hint:
2467
2468                 QUERY PLAN                
2469 ------------------------------------------
2470  Nested Loop
2471    ->  Tid Scan on t1
2472          TID Cond: (ctid = '(1,1)'::tid)
2473    ->  Bitmap Heap Scan on t2
2474          Recheck Cond: (id = t1.id)
2475          Filter: (ctid = '(1,1)'::tid)
2476          ->  Bitmap Index Scan on t2_pkey
2477                Index Cond: (id = t1.id)
2478 (8 rows)
2479
2480 /*+NoIndexScan(t1) TidScan(t2)*/
2481 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2482 LOG:  pg_hint_plan:
2483 used hint:
2484 NoIndexScan(t1)
2485 TidScan(t2)
2486 not used hint:
2487 duplication hint:
2488 error hint:
2489
2490                QUERY PLAN                
2491 -----------------------------------------
2492  Nested Loop
2493    Join Filter: (t1.id = t2.id)
2494    ->  Tid Scan on t1
2495          TID Cond: (ctid = '(1,1)'::tid)
2496    ->  Tid Scan on t2
2497          TID Cond: (ctid = '(1,1)'::tid)
2498 (6 rows)
2499
2500 /*+NoIndexScan(t1) NoSeqScan(t2)*/
2501 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2502 LOG:  pg_hint_plan:
2503 used hint:
2504 NoIndexScan(t1)
2505 NoSeqScan(t2)
2506 not used hint:
2507 duplication hint:
2508 error hint:
2509
2510                QUERY PLAN                
2511 -----------------------------------------
2512  Nested Loop
2513    Join Filter: (t1.id = t2.id)
2514    ->  Tid Scan on t1
2515          TID Cond: (ctid = '(1,1)'::tid)
2516    ->  Tid Scan on t2
2517          TID Cond: (ctid = '(1,1)'::tid)
2518 (6 rows)
2519
2520 /*+NoIndexScan(t1) NoIndexScan(t2)*/
2521 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2522 LOG:  pg_hint_plan:
2523 used hint:
2524 NoIndexScan(t1)
2525 NoIndexScan(t2)
2526 not used hint:
2527 duplication hint:
2528 error hint:
2529
2530                QUERY PLAN                
2531 -----------------------------------------
2532  Nested Loop
2533    Join Filter: (t1.id = t2.id)
2534    ->  Tid Scan on t1
2535          TID Cond: (ctid = '(1,1)'::tid)
2536    ->  Tid Scan on t2
2537          TID Cond: (ctid = '(1,1)'::tid)
2538 (6 rows)
2539
2540 /*+NoIndexScan(t1) NoBitmapScan(t2)*/
2541 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2542 LOG:  pg_hint_plan:
2543 used hint:
2544 NoIndexScan(t1)
2545 NoBitmapScan(t2)
2546 not used hint:
2547 duplication hint:
2548 error hint:
2549
2550                QUERY PLAN                
2551 -----------------------------------------
2552  Nested Loop
2553    Join Filter: (t1.id = t2.id)
2554    ->  Tid Scan on t1
2555          TID Cond: (ctid = '(1,1)'::tid)
2556    ->  Tid Scan on t2
2557          TID Cond: (ctid = '(1,1)'::tid)
2558 (6 rows)
2559
2560 /*+NoIndexScan(t1) NoTidScan(t2)*/
2561 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2562 LOG:  pg_hint_plan:
2563 used hint:
2564 NoIndexScan(t1)
2565 NoTidScan(t2)
2566 not used hint:
2567 duplication hint:
2568 error hint:
2569
2570                QUERY PLAN                
2571 -----------------------------------------
2572  Nested Loop
2573    ->  Tid Scan on t1
2574          TID Cond: (ctid = '(1,1)'::tid)
2575    ->  Index Scan using t2_pkey on t2
2576          Index Cond: (id = t1.id)
2577          Filter: (ctid = '(1,1)'::tid)
2578 (6 rows)
2579
2580 /*+NoBitmapScan(t1)*/
2581 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2582 LOG:  pg_hint_plan:
2583 used hint:
2584 NoBitmapScan(t1)
2585 not used hint:
2586 duplication hint:
2587 error hint:
2588
2589                QUERY PLAN                
2590 -----------------------------------------
2591  Nested Loop
2592    Join Filter: (t1.id = t2.id)
2593    ->  Tid Scan on t1
2594          TID Cond: (ctid = '(1,1)'::tid)
2595    ->  Tid Scan on t2
2596          TID Cond: (ctid = '(1,1)'::tid)
2597 (6 rows)
2598
2599 /*+NoBitmapScan(t2)*/
2600 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2601 LOG:  pg_hint_plan:
2602 used hint:
2603 NoBitmapScan(t2)
2604 not used hint:
2605 duplication hint:
2606 error hint:
2607
2608                QUERY PLAN                
2609 -----------------------------------------
2610  Nested Loop
2611    Join Filter: (t1.id = t2.id)
2612    ->  Tid Scan on t1
2613          TID Cond: (ctid = '(1,1)'::tid)
2614    ->  Tid Scan on t2
2615          TID Cond: (ctid = '(1,1)'::tid)
2616 (6 rows)
2617
2618 /*+NoBitmapScan(t1) SeqScan(t2)*/
2619 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2620 LOG:  pg_hint_plan:
2621 used hint:
2622 NoBitmapScan(t1)
2623 SeqScan(t2)
2624 not used hint:
2625 duplication hint:
2626 error hint:
2627
2628                QUERY PLAN                
2629 -----------------------------------------
2630  Nested Loop
2631    Join Filter: (t1.id = t2.id)
2632    ->  Tid Scan on t1
2633          TID Cond: (ctid = '(1,1)'::tid)
2634    ->  Seq Scan on t2
2635          Filter: (ctid = '(1,1)'::tid)
2636 (6 rows)
2637
2638 /*+NoBitmapScan(t1) IndexScan(t2)*/
2639 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2640 LOG:  pg_hint_plan:
2641 used hint:
2642 NoBitmapScan(t1)
2643 IndexScan(t2)
2644 not used hint:
2645 duplication hint:
2646 error hint:
2647
2648                QUERY PLAN                
2649 -----------------------------------------
2650  Nested Loop
2651    ->  Tid Scan on t1
2652          TID Cond: (ctid = '(1,1)'::tid)
2653    ->  Index Scan using t2_pkey on t2
2654          Index Cond: (id = t1.id)
2655          Filter: (ctid = '(1,1)'::tid)
2656 (6 rows)
2657
2658 /*+NoBitmapScan(t1) BitmapScan(t2)*/
2659 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2660 LOG:  pg_hint_plan:
2661 used hint:
2662 NoBitmapScan(t1)
2663 BitmapScan(t2)
2664 not used hint:
2665 duplication hint:
2666 error hint:
2667
2668                 QUERY PLAN                
2669 ------------------------------------------
2670  Nested Loop
2671    ->  Tid Scan on t1
2672          TID Cond: (ctid = '(1,1)'::tid)
2673    ->  Bitmap Heap Scan on t2
2674          Recheck Cond: (id = t1.id)
2675          Filter: (ctid = '(1,1)'::tid)
2676          ->  Bitmap Index Scan on t2_pkey
2677                Index Cond: (id = t1.id)
2678 (8 rows)
2679
2680 /*+NoBitmapScan(t1) TidScan(t2)*/
2681 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2682 LOG:  pg_hint_plan:
2683 used hint:
2684 NoBitmapScan(t1)
2685 TidScan(t2)
2686 not used hint:
2687 duplication hint:
2688 error hint:
2689
2690                QUERY PLAN                
2691 -----------------------------------------
2692  Nested Loop
2693    Join Filter: (t1.id = t2.id)
2694    ->  Tid Scan on t1
2695          TID Cond: (ctid = '(1,1)'::tid)
2696    ->  Tid Scan on t2
2697          TID Cond: (ctid = '(1,1)'::tid)
2698 (6 rows)
2699
2700 /*+NoBitmapScan(t1) NoSeqScan(t2)*/
2701 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2702 LOG:  pg_hint_plan:
2703 used hint:
2704 NoBitmapScan(t1)
2705 NoSeqScan(t2)
2706 not used hint:
2707 duplication hint:
2708 error hint:
2709
2710                QUERY PLAN                
2711 -----------------------------------------
2712  Nested Loop
2713    Join Filter: (t1.id = t2.id)
2714    ->  Tid Scan on t1
2715          TID Cond: (ctid = '(1,1)'::tid)
2716    ->  Tid Scan on t2
2717          TID Cond: (ctid = '(1,1)'::tid)
2718 (6 rows)
2719
2720 /*+NoBitmapScan(t1) NoIndexScan(t2)*/
2721 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2722 LOG:  pg_hint_plan:
2723 used hint:
2724 NoBitmapScan(t1)
2725 NoIndexScan(t2)
2726 not used hint:
2727 duplication hint:
2728 error hint:
2729
2730                QUERY PLAN                
2731 -----------------------------------------
2732  Nested Loop
2733    Join Filter: (t1.id = t2.id)
2734    ->  Tid Scan on t1
2735          TID Cond: (ctid = '(1,1)'::tid)
2736    ->  Tid Scan on t2
2737          TID Cond: (ctid = '(1,1)'::tid)
2738 (6 rows)
2739
2740 /*+NoBitmapScan(t1) NoBitmapScan(t2)*/
2741 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2742 LOG:  pg_hint_plan:
2743 used hint:
2744 NoBitmapScan(t1)
2745 NoBitmapScan(t2)
2746 not used hint:
2747 duplication hint:
2748 error hint:
2749
2750                QUERY PLAN                
2751 -----------------------------------------
2752  Nested Loop
2753    Join Filter: (t1.id = t2.id)
2754    ->  Tid Scan on t1
2755          TID Cond: (ctid = '(1,1)'::tid)
2756    ->  Tid Scan on t2
2757          TID Cond: (ctid = '(1,1)'::tid)
2758 (6 rows)
2759
2760 /*+NoBitmapScan(t1) NoTidScan(t2)*/
2761 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2762 LOG:  pg_hint_plan:
2763 used hint:
2764 NoBitmapScan(t1)
2765 NoTidScan(t2)
2766 not used hint:
2767 duplication hint:
2768 error hint:
2769
2770                QUERY PLAN                
2771 -----------------------------------------
2772  Nested Loop
2773    ->  Tid Scan on t1
2774          TID Cond: (ctid = '(1,1)'::tid)
2775    ->  Index Scan using t2_pkey on t2
2776          Index Cond: (id = t1.id)
2777          Filter: (ctid = '(1,1)'::tid)
2778 (6 rows)
2779
2780 /*+NoTidScan(t1)*/
2781 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2782 LOG:  pg_hint_plan:
2783 used hint:
2784 NoTidScan(t1)
2785 not used hint:
2786 duplication hint:
2787 error hint:
2788
2789                QUERY PLAN                
2790 -----------------------------------------
2791  Nested Loop
2792    ->  Tid Scan on t2
2793          TID Cond: (ctid = '(1,1)'::tid)
2794    ->  Index Scan using t1_pkey on t1
2795          Index Cond: (id = t2.id)
2796          Filter: (ctid = '(1,1)'::tid)
2797 (6 rows)
2798
2799 /*+NoTidScan(t2)*/
2800 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2801 LOG:  pg_hint_plan:
2802 used hint:
2803 NoTidScan(t2)
2804 not used hint:
2805 duplication hint:
2806 error hint:
2807
2808                QUERY PLAN                
2809 -----------------------------------------
2810  Nested Loop
2811    ->  Tid Scan on t1
2812          TID Cond: (ctid = '(1,1)'::tid)
2813    ->  Index Scan using t2_pkey on t2
2814          Index Cond: (id = t1.id)
2815          Filter: (ctid = '(1,1)'::tid)
2816 (6 rows)
2817
2818 /*+NoTidScan(t1) SeqScan(t2)*/
2819 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2820 LOG:  pg_hint_plan:
2821 used hint:
2822 NoTidScan(t1)
2823 SeqScan(t2)
2824 not used hint:
2825 duplication hint:
2826 error hint:
2827
2828               QUERY PLAN               
2829 ---------------------------------------
2830  Nested Loop
2831    ->  Seq Scan on t2
2832          Filter: (ctid = '(1,1)'::tid)
2833    ->  Index Scan using t1_pkey on t1
2834          Index Cond: (id = t2.id)
2835          Filter: (ctid = '(1,1)'::tid)
2836 (6 rows)
2837
2838 /*+NoTidScan(t1) IndexScan(t2)*/
2839 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2840 LOG:  pg_hint_plan:
2841 used hint:
2842 NoTidScan(t1)
2843 IndexScan(t2)
2844 not used hint:
2845 duplication hint:
2846 error hint:
2847
2848               QUERY PLAN               
2849 ---------------------------------------
2850  Nested Loop
2851    ->  Index Scan using t2_pkey on t2
2852          Filter: (ctid = '(1,1)'::tid)
2853    ->  Index Scan using t1_pkey on t1
2854          Index Cond: (id = t2.id)
2855          Filter: (ctid = '(1,1)'::tid)
2856 (6 rows)
2857
2858 /*+NoTidScan(t1) BitmapScan(t2)*/
2859 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2860 LOG:  pg_hint_plan:
2861 used hint:
2862 NoTidScan(t1)
2863 BitmapScan(t2)
2864 not used hint:
2865 duplication hint:
2866 error hint:
2867
2868                 QUERY PLAN                
2869 ------------------------------------------
2870  Nested Loop
2871    ->  Seq Scan on t1
2872          Filter: (ctid = '(1,1)'::tid)
2873    ->  Bitmap Heap Scan on t2
2874          Recheck Cond: (id = t1.id)
2875          Filter: (ctid = '(1,1)'::tid)
2876          ->  Bitmap Index Scan on t2_pkey
2877                Index Cond: (id = t1.id)
2878 (8 rows)
2879
2880 /*+NoTidScan(t1) TidScan(t2)*/
2881 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2882 LOG:  pg_hint_plan:
2883 used hint:
2884 NoTidScan(t1)
2885 TidScan(t2)
2886 not used hint:
2887 duplication hint:
2888 error hint:
2889
2890                QUERY PLAN                
2891 -----------------------------------------
2892  Nested Loop
2893    ->  Tid Scan on t2
2894          TID Cond: (ctid = '(1,1)'::tid)
2895    ->  Index Scan using t1_pkey on t1
2896          Index Cond: (id = t2.id)
2897          Filter: (ctid = '(1,1)'::tid)
2898 (6 rows)
2899
2900 /*+NoTidScan(t1) NoSeqScan(t2)*/
2901 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2902 LOG:  pg_hint_plan:
2903 used hint:
2904 NoTidScan(t1)
2905 NoSeqScan(t2)
2906 not used hint:
2907 duplication hint:
2908 error hint:
2909
2910                QUERY PLAN                
2911 -----------------------------------------
2912  Nested Loop
2913    ->  Tid Scan on t2
2914          TID Cond: (ctid = '(1,1)'::tid)
2915    ->  Index Scan using t1_pkey on t1
2916          Index Cond: (id = t2.id)
2917          Filter: (ctid = '(1,1)'::tid)
2918 (6 rows)
2919
2920 /*+NoTidScan(t1) NoIndexScan(t2)*/
2921 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2922 LOG:  pg_hint_plan:
2923 used hint:
2924 NoTidScan(t1)
2925 NoIndexScan(t2)
2926 not used hint:
2927 duplication hint:
2928 error hint:
2929
2930                QUERY PLAN                
2931 -----------------------------------------
2932  Nested Loop
2933    ->  Tid Scan on t2
2934          TID Cond: (ctid = '(1,1)'::tid)
2935    ->  Index Scan using t1_pkey on t1
2936          Index Cond: (id = t2.id)
2937          Filter: (ctid = '(1,1)'::tid)
2938 (6 rows)
2939
2940 /*+NoTidScan(t1) NoBitmapScan(t2)*/
2941 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2942 LOG:  pg_hint_plan:
2943 used hint:
2944 NoTidScan(t1)
2945 NoBitmapScan(t2)
2946 not used hint:
2947 duplication hint:
2948 error hint:
2949
2950                QUERY PLAN                
2951 -----------------------------------------
2952  Nested Loop
2953    ->  Tid Scan on t2
2954          TID Cond: (ctid = '(1,1)'::tid)
2955    ->  Index Scan using t1_pkey on t1
2956          Index Cond: (id = t2.id)
2957          Filter: (ctid = '(1,1)'::tid)
2958 (6 rows)
2959
2960 /*+NoTidScan(t1) NoTidScan(t2)*/
2961 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
2962 LOG:  pg_hint_plan:
2963 used hint:
2964 NoTidScan(t1)
2965 NoTidScan(t2)
2966 not used hint:
2967 duplication hint:
2968 error hint:
2969
2970               QUERY PLAN               
2971 ---------------------------------------
2972  Nested Loop
2973    ->  Seq Scan on t2
2974          Filter: (ctid = '(1,1)'::tid)
2975    ->  Index Scan using t1_pkey on t1
2976          Index Cond: (id = t2.id)
2977          Filter: (ctid = '(1,1)'::tid)
2978 (6 rows)
2979
2980 -- additional test
2981 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
2982                QUERY PLAN                
2983 -----------------------------------------
2984  Nested Loop
2985    Join Filter: (t1.id = t2.id)
2986    ->  Tid Scan on t1
2987          TID Cond: (ctid = '(1,1)'::tid)
2988          Filter: (id < 10)
2989    ->  Tid Scan on t2
2990          TID Cond: (ctid = '(1,1)'::tid)
2991          Filter: (id < 10)
2992 (8 rows)
2993
2994 /*+BitmapScan(t1) BitmapScan(t2)*/
2995 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)' AND t1.id < 10 AND t2.id < 10;
2996 LOG:  pg_hint_plan:
2997 used hint:
2998 BitmapScan(t1)
2999 BitmapScan(t2)
3000 not used hint:
3001 duplication hint:
3002 error hint:
3003
3004                        QUERY PLAN                       
3005 --------------------------------------------------------
3006  Nested Loop
3007    ->  Bitmap Heap Scan on t2
3008          Recheck Cond: (id < 10)
3009          Filter: (ctid = '(1,1)'::tid)
3010          ->  Bitmap Index Scan on t2_pkey
3011                Index Cond: (id < 10)
3012    ->  Bitmap Heap Scan on t1
3013          Recheck Cond: ((id = t2.id) AND (id < 10))
3014          Filter: (ctid = '(1,1)'::tid)
3015          ->  Bitmap Index Scan on t1_pkey
3016                Index Cond: ((id = t2.id) AND (id < 10))
3017 (11 rows)
3018
3019 -- outer join test
3020 EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN  t2 ON (t1.id = t2.id);
3021           QUERY PLAN          
3022 ------------------------------
3023  Hash Full Join
3024    Hash Cond: (t1.id = t2.id)
3025    ->  Seq Scan on t1
3026    ->  Hash
3027          ->  Seq Scan on t2
3028 (5 rows)
3029
3030 /*+MergeJoin(t1 t2)*/
3031 EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN  t2 ON (t1.id = t2.id);
3032 LOG:  pg_hint_plan:
3033 used hint:
3034 MergeJoin(t1 t2)
3035 not used hint:
3036 duplication hint:
3037 error hint:
3038
3039               QUERY PLAN              
3040 --------------------------------------
3041  Merge Full Join
3042    Merge Cond: (t1.id = t2.id)
3043    ->  Index Scan using t1_pkey on t1
3044    ->  Index Scan using t2_pkey on t2
3045 (4 rows)
3046
3047 -- Cannot work
3048 /*+NestLoop(t1 t2)*/
3049 EXPLAIN (COSTS false) SELECT * FROM t1 FULL OUTER JOIN  t2 ON (t1.id = t2.id);
3050 LOG:  pg_hint_plan:
3051 used hint:
3052 NestLoop(t1 t2)
3053 not used hint:
3054 duplication hint:
3055 error hint:
3056
3057           QUERY PLAN          
3058 ------------------------------
3059  Hash Full Join
3060    Hash Cond: (t1.id = t2.id)
3061    ->  Seq Scan on t1
3062    ->  Hash
3063          ->  Seq Scan on t2
3064 (5 rows)
3065
3066 -- inheritance tables test
3067 SET constraint_exclusion TO off;
3068 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3069                               QUERY PLAN                               
3070 -----------------------------------------------------------------------
3071  Append
3072    ->  Seq Scan on p1 p1_1
3073          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3074    ->  Seq Scan on p1_c1 p1_2
3075          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3076    ->  Seq Scan on p1_c2 p1_3
3077          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3078    ->  Seq Scan on p1_c3 p1_4
3079          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3080    ->  Seq Scan on p1_c4 p1_5
3081          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3082    ->  Seq Scan on p1_c1_c1 p1_6
3083          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3084    ->  Seq Scan on p1_c1_c2 p1_7
3085          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3086    ->  Seq Scan on p1_c3_c1 p1_8
3087          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3088    ->  Seq Scan on p1_c3_c2 p1_9
3089          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3090 (19 rows)
3091
3092 SET constraint_exclusion TO on;
3093 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3094                               QUERY PLAN                               
3095 -----------------------------------------------------------------------
3096  Append
3097    ->  Seq Scan on p1 p1_1
3098          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3099    ->  Seq Scan on p1_c1 p1_2
3100          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3101    ->  Seq Scan on p1_c1_c1 p1_3
3102          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3103    ->  Seq Scan on p1_c1_c2 p1_4
3104          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3105 (9 rows)
3106
3107 SET constraint_exclusion TO off;
3108 /*+SeqScan(p1)*/
3109 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3110 LOG:  pg_hint_plan:
3111 used hint:
3112 SeqScan(p1)
3113 not used hint:
3114 duplication hint:
3115 error hint:
3116
3117                               QUERY PLAN                               
3118 -----------------------------------------------------------------------
3119  Append
3120    ->  Seq Scan on p1 p1_1
3121          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3122    ->  Seq Scan on p1_c1 p1_2
3123          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3124    ->  Seq Scan on p1_c2 p1_3
3125          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3126    ->  Seq Scan on p1_c3 p1_4
3127          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3128    ->  Seq Scan on p1_c4 p1_5
3129          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3130    ->  Seq Scan on p1_c1_c1 p1_6
3131          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3132    ->  Seq Scan on p1_c1_c2 p1_7
3133          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3134    ->  Seq Scan on p1_c3_c1 p1_8
3135          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3136    ->  Seq Scan on p1_c3_c2 p1_9
3137          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3138 (19 rows)
3139
3140 /*+IndexScan(p1)*/
3141 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3142 LOG:  pg_hint_plan:
3143 used hint:
3144 IndexScan(p1)
3145 not used hint:
3146 duplication hint:
3147 error hint:
3148
3149                       QUERY PLAN                       
3150 -------------------------------------------------------
3151  Append
3152    ->  Index Scan using p1_pkey on p1 p1_1
3153          Index Cond: ((id >= 50) AND (id <= 51))
3154          Filter: (ctid = '(1,1)'::tid)
3155    ->  Index Scan using p1_c1_pkey on p1_c1 p1_2
3156          Index Cond: ((id >= 50) AND (id <= 51))
3157          Filter: (ctid = '(1,1)'::tid)
3158    ->  Index Scan using p1_c2_pkey on p1_c2 p1_3
3159          Index Cond: ((id >= 50) AND (id <= 51))
3160          Filter: (ctid = '(1,1)'::tid)
3161    ->  Index Scan using p1_c3_pkey on p1_c3 p1_4
3162          Index Cond: ((id >= 50) AND (id <= 51))
3163          Filter: (ctid = '(1,1)'::tid)
3164    ->  Index Scan using p1_c4_pkey on p1_c4 p1_5
3165          Index Cond: ((id >= 50) AND (id <= 51))
3166          Filter: (ctid = '(1,1)'::tid)
3167    ->  Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1_6
3168          Index Cond: ((id >= 50) AND (id <= 51))
3169          Filter: (ctid = '(1,1)'::tid)
3170    ->  Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1_7
3171          Index Cond: ((id >= 50) AND (id <= 51))
3172          Filter: (ctid = '(1,1)'::tid)
3173    ->  Index Scan using p1_c3_c1_pkey on p1_c3_c1 p1_8
3174          Index Cond: ((id >= 50) AND (id <= 51))
3175          Filter: (ctid = '(1,1)'::tid)
3176    ->  Index Scan using p1_c3_c2_pkey on p1_c3_c2 p1_9
3177          Index Cond: ((id >= 50) AND (id <= 51))
3178          Filter: (ctid = '(1,1)'::tid)
3179 (28 rows)
3180
3181 /*+BitmapScan(p1)*/
3182 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3183 LOG:  pg_hint_plan:
3184 used hint:
3185 BitmapScan(p1)
3186 not used hint:
3187 duplication hint:
3188 error hint:
3189
3190                       QUERY PLAN                       
3191 -------------------------------------------------------
3192  Append
3193    ->  Bitmap Heap Scan on p1 p1_1
3194          Recheck Cond: ((id >= 50) AND (id <= 51))
3195          Filter: (ctid = '(1,1)'::tid)
3196          ->  Bitmap Index Scan on p1_pkey
3197                Index Cond: ((id >= 50) AND (id <= 51))
3198    ->  Bitmap Heap Scan on p1_c1 p1_2
3199          Recheck Cond: ((id >= 50) AND (id <= 51))
3200          Filter: (ctid = '(1,1)'::tid)
3201          ->  Bitmap Index Scan on p1_c1_pkey
3202                Index Cond: ((id >= 50) AND (id <= 51))
3203    ->  Bitmap Heap Scan on p1_c2 p1_3
3204          Recheck Cond: ((id >= 50) AND (id <= 51))
3205          Filter: (ctid = '(1,1)'::tid)
3206          ->  Bitmap Index Scan on p1_c2_pkey
3207                Index Cond: ((id >= 50) AND (id <= 51))
3208    ->  Bitmap Heap Scan on p1_c3 p1_4
3209          Recheck Cond: ((id >= 50) AND (id <= 51))
3210          Filter: (ctid = '(1,1)'::tid)
3211          ->  Bitmap Index Scan on p1_c3_pkey
3212                Index Cond: ((id >= 50) AND (id <= 51))
3213    ->  Bitmap Heap Scan on p1_c4 p1_5
3214          Recheck Cond: ((id >= 50) AND (id <= 51))
3215          Filter: (ctid = '(1,1)'::tid)
3216          ->  Bitmap Index Scan on p1_c4_pkey
3217                Index Cond: ((id >= 50) AND (id <= 51))
3218    ->  Bitmap Heap Scan on p1_c1_c1 p1_6
3219          Recheck Cond: ((id >= 50) AND (id <= 51))
3220          Filter: (ctid = '(1,1)'::tid)
3221          ->  Bitmap Index Scan on p1_c1_c1_pkey
3222                Index Cond: ((id >= 50) AND (id <= 51))
3223    ->  Bitmap Heap Scan on p1_c1_c2 p1_7
3224          Recheck Cond: ((id >= 50) AND (id <= 51))
3225          Filter: (ctid = '(1,1)'::tid)
3226          ->  Bitmap Index Scan on p1_c1_c2_pkey
3227                Index Cond: ((id >= 50) AND (id <= 51))
3228    ->  Bitmap Heap Scan on p1_c3_c1 p1_8
3229          Recheck Cond: ((id >= 50) AND (id <= 51))
3230          Filter: (ctid = '(1,1)'::tid)
3231          ->  Bitmap Index Scan on p1_c3_c1_pkey
3232                Index Cond: ((id >= 50) AND (id <= 51))
3233    ->  Bitmap Heap Scan on p1_c3_c2 p1_9
3234          Recheck Cond: ((id >= 50) AND (id <= 51))
3235          Filter: (ctid = '(1,1)'::tid)
3236          ->  Bitmap Index Scan on p1_c3_c2_pkey
3237                Index Cond: ((id >= 50) AND (id <= 51))
3238 (46 rows)
3239
3240 /*+TidScan(p1)*/
3241 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3242 LOG:  pg_hint_plan:
3243 used hint:
3244 TidScan(p1)
3245 not used hint:
3246 duplication hint:
3247 error hint:
3248
3249                  QUERY PLAN                  
3250 ---------------------------------------------
3251  Append
3252    ->  Tid Scan on p1 p1_1
3253          TID Cond: (ctid = '(1,1)'::tid)
3254          Filter: ((id >= 50) AND (id <= 51))
3255    ->  Tid Scan on p1_c1 p1_2
3256          TID Cond: (ctid = '(1,1)'::tid)
3257          Filter: ((id >= 50) AND (id <= 51))
3258    ->  Tid Scan on p1_c2 p1_3
3259          TID Cond: (ctid = '(1,1)'::tid)
3260          Filter: ((id >= 50) AND (id <= 51))
3261    ->  Tid Scan on p1_c3 p1_4
3262          TID Cond: (ctid = '(1,1)'::tid)
3263          Filter: ((id >= 50) AND (id <= 51))
3264    ->  Tid Scan on p1_c4 p1_5
3265          TID Cond: (ctid = '(1,1)'::tid)
3266          Filter: ((id >= 50) AND (id <= 51))
3267    ->  Tid Scan on p1_c1_c1 p1_6
3268          TID Cond: (ctid = '(1,1)'::tid)
3269          Filter: ((id >= 50) AND (id <= 51))
3270    ->  Tid Scan on p1_c1_c2 p1_7
3271          TID Cond: (ctid = '(1,1)'::tid)
3272          Filter: ((id >= 50) AND (id <= 51))
3273    ->  Tid Scan on p1_c3_c1 p1_8
3274          TID Cond: (ctid = '(1,1)'::tid)
3275          Filter: ((id >= 50) AND (id <= 51))
3276    ->  Tid Scan on p1_c3_c2 p1_9
3277          TID Cond: (ctid = '(1,1)'::tid)
3278          Filter: ((id >= 50) AND (id <= 51))
3279 (28 rows)
3280
3281 SET constraint_exclusion TO on;
3282 /*+SeqScan(p1)*/
3283 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3284 LOG:  pg_hint_plan:
3285 used hint:
3286 SeqScan(p1)
3287 not used hint:
3288 duplication hint:
3289 error hint:
3290
3291                               QUERY PLAN                               
3292 -----------------------------------------------------------------------
3293  Append
3294    ->  Seq Scan on p1 p1_1
3295          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3296    ->  Seq Scan on p1_c1 p1_2
3297          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3298    ->  Seq Scan on p1_c1_c1 p1_3
3299          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3300    ->  Seq Scan on p1_c1_c2 p1_4
3301          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3302 (9 rows)
3303
3304 /*+IndexScan(p1)*/
3305 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3306 LOG:  pg_hint_plan:
3307 used hint:
3308 IndexScan(p1)
3309 not used hint:
3310 duplication hint:
3311 error hint:
3312
3313                       QUERY PLAN                       
3314 -------------------------------------------------------
3315  Append
3316    ->  Index Scan using p1_pkey on p1 p1_1
3317          Index Cond: ((id >= 50) AND (id <= 51))
3318          Filter: (ctid = '(1,1)'::tid)
3319    ->  Index Scan using p1_c1_pkey on p1_c1 p1_2
3320          Index Cond: ((id >= 50) AND (id <= 51))
3321          Filter: (ctid = '(1,1)'::tid)
3322    ->  Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1_3
3323          Index Cond: ((id >= 50) AND (id <= 51))
3324          Filter: (ctid = '(1,1)'::tid)
3325    ->  Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1_4
3326          Index Cond: ((id >= 50) AND (id <= 51))
3327          Filter: (ctid = '(1,1)'::tid)
3328 (13 rows)
3329
3330 /*+BitmapScan(p1)*/
3331 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3332 LOG:  pg_hint_plan:
3333 used hint:
3334 BitmapScan(p1)
3335 not used hint:
3336 duplication hint:
3337 error hint:
3338
3339                       QUERY PLAN                       
3340 -------------------------------------------------------
3341  Append
3342    ->  Bitmap Heap Scan on p1 p1_1
3343          Recheck Cond: ((id >= 50) AND (id <= 51))
3344          Filter: (ctid = '(1,1)'::tid)
3345          ->  Bitmap Index Scan on p1_pkey
3346                Index Cond: ((id >= 50) AND (id <= 51))
3347    ->  Bitmap Heap Scan on p1_c1 p1_2
3348          Recheck Cond: ((id >= 50) AND (id <= 51))
3349          Filter: (ctid = '(1,1)'::tid)
3350          ->  Bitmap Index Scan on p1_c1_pkey
3351                Index Cond: ((id >= 50) AND (id <= 51))
3352    ->  Bitmap Heap Scan on p1_c1_c1 p1_3
3353          Recheck Cond: ((id >= 50) AND (id <= 51))
3354          Filter: (ctid = '(1,1)'::tid)
3355          ->  Bitmap Index Scan on p1_c1_c1_pkey
3356                Index Cond: ((id >= 50) AND (id <= 51))
3357    ->  Bitmap Heap Scan on p1_c1_c2 p1_4
3358          Recheck Cond: ((id >= 50) AND (id <= 51))
3359          Filter: (ctid = '(1,1)'::tid)
3360          ->  Bitmap Index Scan on p1_c1_c2_pkey
3361                Index Cond: ((id >= 50) AND (id <= 51))
3362 (21 rows)
3363
3364 /*+TidScan(p1)*/
3365 EXPLAIN (COSTS false) SELECT * FROM p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3366 LOG:  pg_hint_plan:
3367 used hint:
3368 TidScan(p1)
3369 not used hint:
3370 duplication hint:
3371 error hint:
3372
3373                  QUERY PLAN                  
3374 ---------------------------------------------
3375  Append
3376    ->  Tid Scan on p1 p1_1
3377          TID Cond: (ctid = '(1,1)'::tid)
3378          Filter: ((id >= 50) AND (id <= 51))
3379    ->  Tid Scan on p1_c1 p1_2
3380          TID Cond: (ctid = '(1,1)'::tid)
3381          Filter: ((id >= 50) AND (id <= 51))
3382    ->  Tid Scan on p1_c1_c1 p1_3
3383          TID Cond: (ctid = '(1,1)'::tid)
3384          Filter: ((id >= 50) AND (id <= 51))
3385    ->  Tid Scan on p1_c1_c2 p1_4
3386          TID Cond: (ctid = '(1,1)'::tid)
3387          Filter: ((id >= 50) AND (id <= 51))
3388 (13 rows)
3389
3390 SET constraint_exclusion TO off;
3391 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3392                                     QUERY PLAN                                     
3393 -----------------------------------------------------------------------------------
3394  Merge Join
3395    Merge Cond: (p1.id = t1.id)
3396    ->  Sort
3397          Sort Key: p1.id
3398          ->  Append
3399                ->  Seq Scan on p1 p1_1
3400                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3401                ->  Seq Scan on p1_c1 p1_2
3402                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3403                ->  Seq Scan on p1_c2 p1_3
3404                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3405                ->  Seq Scan on p1_c3 p1_4
3406                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3407                ->  Seq Scan on p1_c4 p1_5
3408                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3409                ->  Seq Scan on p1_c1_c1 p1_6
3410                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3411                ->  Seq Scan on p1_c1_c2 p1_7
3412                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3413                ->  Seq Scan on p1_c3_c1 p1_8
3414                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3415                ->  Seq Scan on p1_c3_c2 p1_9
3416                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3417    ->  Index Scan using t1_pkey on t1
3418          Index Cond: (id < 10)
3419 (25 rows)
3420
3421 SET constraint_exclusion TO on;
3422 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3423                                     QUERY PLAN                                     
3424 -----------------------------------------------------------------------------------
3425  Merge Join
3426    Merge Cond: (p1.id = t1.id)
3427    ->  Sort
3428          Sort Key: p1.id
3429          ->  Append
3430                ->  Seq Scan on p1 p1_1
3431                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3432                ->  Seq Scan on p1_c1 p1_2
3433                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3434                ->  Seq Scan on p1_c1_c1 p1_3
3435                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3436                ->  Seq Scan on p1_c1_c2 p1_4
3437                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3438    ->  Index Scan using t1_pkey on t1
3439          Index Cond: (id < 10)
3440 (15 rows)
3441
3442 SET constraint_exclusion TO off;
3443 /*+SeqScan(p1)*/
3444 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3445 LOG:  pg_hint_plan:
3446 used hint:
3447 SeqScan(p1)
3448 not used hint:
3449 duplication hint:
3450 error hint:
3451
3452                                     QUERY PLAN                                     
3453 -----------------------------------------------------------------------------------
3454  Merge Join
3455    Merge Cond: (p1.id = t1.id)
3456    ->  Sort
3457          Sort Key: p1.id
3458          ->  Append
3459                ->  Seq Scan on p1 p1_1
3460                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3461                ->  Seq Scan on p1_c1 p1_2
3462                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3463                ->  Seq Scan on p1_c2 p1_3
3464                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3465                ->  Seq Scan on p1_c3 p1_4
3466                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3467                ->  Seq Scan on p1_c4 p1_5
3468                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3469                ->  Seq Scan on p1_c1_c1 p1_6
3470                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3471                ->  Seq Scan on p1_c1_c2 p1_7
3472                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3473                ->  Seq Scan on p1_c3_c1 p1_8
3474                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3475                ->  Seq Scan on p1_c3_c2 p1_9
3476                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3477    ->  Index Scan using t1_pkey on t1
3478          Index Cond: (id < 10)
3479 (25 rows)
3480
3481 /*+IndexScan(p1)*/
3482 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3483 LOG:  pg_hint_plan:
3484 used hint:
3485 IndexScan(p1)
3486 not used hint:
3487 duplication hint:
3488 error hint:
3489
3490                          QUERY PLAN                          
3491 -------------------------------------------------------------
3492  Merge Join
3493    Merge Cond: (p1.id = t1.id)
3494    ->  Merge Append
3495          Sort Key: p1.id
3496          ->  Index Scan using p1_pkey on p1 p1_1
3497                Index Cond: ((id >= 50) AND (id <= 51))
3498                Filter: (ctid = '(1,1)'::tid)
3499          ->  Index Scan using p1_c1_pkey on p1_c1 p1_2
3500                Index Cond: ((id >= 50) AND (id <= 51))
3501                Filter: (ctid = '(1,1)'::tid)
3502          ->  Index Scan using p1_c2_pkey on p1_c2 p1_3
3503                Index Cond: ((id >= 50) AND (id <= 51))
3504                Filter: (ctid = '(1,1)'::tid)
3505          ->  Index Scan using p1_c3_pkey on p1_c3 p1_4
3506                Index Cond: ((id >= 50) AND (id <= 51))
3507                Filter: (ctid = '(1,1)'::tid)
3508          ->  Index Scan using p1_c4_pkey on p1_c4 p1_5
3509                Index Cond: ((id >= 50) AND (id <= 51))
3510                Filter: (ctid = '(1,1)'::tid)
3511          ->  Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1_6
3512                Index Cond: ((id >= 50) AND (id <= 51))
3513                Filter: (ctid = '(1,1)'::tid)
3514          ->  Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1_7
3515                Index Cond: ((id >= 50) AND (id <= 51))
3516                Filter: (ctid = '(1,1)'::tid)
3517          ->  Index Scan using p1_c3_c1_pkey on p1_c3_c1 p1_8
3518                Index Cond: ((id >= 50) AND (id <= 51))
3519                Filter: (ctid = '(1,1)'::tid)
3520          ->  Index Scan using p1_c3_c2_pkey on p1_c3_c2 p1_9
3521                Index Cond: ((id >= 50) AND (id <= 51))
3522                Filter: (ctid = '(1,1)'::tid)
3523    ->  Index Scan using t1_pkey on t1
3524          Index Cond: (id < 10)
3525 (33 rows)
3526
3527 /*+BitmapScan(p1)*/
3528 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3529 LOG:  pg_hint_plan:
3530 used hint:
3531 BitmapScan(p1)
3532 not used hint:
3533 duplication hint:
3534 error hint:
3535
3536                             QUERY PLAN                             
3537 -------------------------------------------------------------------
3538  Merge Join
3539    Merge Cond: (p1.id = t1.id)
3540    ->  Sort
3541          Sort Key: p1.id
3542          ->  Append
3543                ->  Bitmap Heap Scan on p1 p1_1
3544                      Recheck Cond: ((id >= 50) AND (id <= 51))
3545                      Filter: (ctid = '(1,1)'::tid)
3546                      ->  Bitmap Index Scan on p1_pkey
3547                            Index Cond: ((id >= 50) AND (id <= 51))
3548                ->  Bitmap Heap Scan on p1_c1 p1_2
3549                      Recheck Cond: ((id >= 50) AND (id <= 51))
3550                      Filter: (ctid = '(1,1)'::tid)
3551                      ->  Bitmap Index Scan on p1_c1_pkey
3552                            Index Cond: ((id >= 50) AND (id <= 51))
3553                ->  Bitmap Heap Scan on p1_c2 p1_3
3554                      Recheck Cond: ((id >= 50) AND (id <= 51))
3555                      Filter: (ctid = '(1,1)'::tid)
3556                      ->  Bitmap Index Scan on p1_c2_pkey
3557                            Index Cond: ((id >= 50) AND (id <= 51))
3558                ->  Bitmap Heap Scan on p1_c3 p1_4
3559                      Recheck Cond: ((id >= 50) AND (id <= 51))
3560                      Filter: (ctid = '(1,1)'::tid)
3561                      ->  Bitmap Index Scan on p1_c3_pkey
3562                            Index Cond: ((id >= 50) AND (id <= 51))
3563                ->  Bitmap Heap Scan on p1_c4 p1_5
3564                      Recheck Cond: ((id >= 50) AND (id <= 51))
3565                      Filter: (ctid = '(1,1)'::tid)
3566                      ->  Bitmap Index Scan on p1_c4_pkey
3567                            Index Cond: ((id >= 50) AND (id <= 51))
3568                ->  Bitmap Heap Scan on p1_c1_c1 p1_6
3569                      Recheck Cond: ((id >= 50) AND (id <= 51))
3570                      Filter: (ctid = '(1,1)'::tid)
3571                      ->  Bitmap Index Scan on p1_c1_c1_pkey
3572                            Index Cond: ((id >= 50) AND (id <= 51))
3573                ->  Bitmap Heap Scan on p1_c1_c2 p1_7
3574                      Recheck Cond: ((id >= 50) AND (id <= 51))
3575                      Filter: (ctid = '(1,1)'::tid)
3576                      ->  Bitmap Index Scan on p1_c1_c2_pkey
3577                            Index Cond: ((id >= 50) AND (id <= 51))
3578                ->  Bitmap Heap Scan on p1_c3_c1 p1_8
3579                      Recheck Cond: ((id >= 50) AND (id <= 51))
3580                      Filter: (ctid = '(1,1)'::tid)
3581                      ->  Bitmap Index Scan on p1_c3_c1_pkey
3582                            Index Cond: ((id >= 50) AND (id <= 51))
3583                ->  Bitmap Heap Scan on p1_c3_c2 p1_9
3584                      Recheck Cond: ((id >= 50) AND (id <= 51))
3585                      Filter: (ctid = '(1,1)'::tid)
3586                      ->  Bitmap Index Scan on p1_c3_c2_pkey
3587                            Index Cond: ((id >= 50) AND (id <= 51))
3588    ->  Index Scan using t1_pkey on t1
3589          Index Cond: (id < 10)
3590 (52 rows)
3591
3592 /*+TidScan(p1)*/
3593 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3594 LOG:  pg_hint_plan:
3595 used hint:
3596 TidScan(p1)
3597 not used hint:
3598 duplication hint:
3599 error hint:
3600
3601                        QUERY PLAN                        
3602 ---------------------------------------------------------
3603  Merge Join
3604    Merge Cond: (p1.id = t1.id)
3605    ->  Sort
3606          Sort Key: p1.id
3607          ->  Append
3608                ->  Tid Scan on p1 p1_1
3609                      TID Cond: (ctid = '(1,1)'::tid)
3610                      Filter: ((id >= 50) AND (id <= 51))
3611                ->  Tid Scan on p1_c1 p1_2
3612                      TID Cond: (ctid = '(1,1)'::tid)
3613                      Filter: ((id >= 50) AND (id <= 51))
3614                ->  Tid Scan on p1_c2 p1_3
3615                      TID Cond: (ctid = '(1,1)'::tid)
3616                      Filter: ((id >= 50) AND (id <= 51))
3617                ->  Tid Scan on p1_c3 p1_4
3618                      TID Cond: (ctid = '(1,1)'::tid)
3619                      Filter: ((id >= 50) AND (id <= 51))
3620                ->  Tid Scan on p1_c4 p1_5
3621                      TID Cond: (ctid = '(1,1)'::tid)
3622                      Filter: ((id >= 50) AND (id <= 51))
3623                ->  Tid Scan on p1_c1_c1 p1_6
3624                      TID Cond: (ctid = '(1,1)'::tid)
3625                      Filter: ((id >= 50) AND (id <= 51))
3626                ->  Tid Scan on p1_c1_c2 p1_7
3627                      TID Cond: (ctid = '(1,1)'::tid)
3628                      Filter: ((id >= 50) AND (id <= 51))
3629                ->  Tid Scan on p1_c3_c1 p1_8
3630                      TID Cond: (ctid = '(1,1)'::tid)
3631                      Filter: ((id >= 50) AND (id <= 51))
3632                ->  Tid Scan on p1_c3_c2 p1_9
3633                      TID Cond: (ctid = '(1,1)'::tid)
3634                      Filter: ((id >= 50) AND (id <= 51))
3635    ->  Index Scan using t1_pkey on t1
3636          Index Cond: (id < 10)
3637 (34 rows)
3638
3639 /*+NestLoop(p1 t1)*/
3640 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3641 LOG:  pg_hint_plan:
3642 used hint:
3643 NestLoop(p1 t1)
3644 not used hint:
3645 duplication hint:
3646 error hint:
3647
3648                                  QUERY PLAN                                  
3649 -----------------------------------------------------------------------------
3650  Nested Loop
3651    Join Filter: (p1.id = t1.id)
3652    ->  Append
3653          ->  Seq Scan on p1 p1_1
3654                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3655          ->  Seq Scan on p1_c1 p1_2
3656                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3657          ->  Seq Scan on p1_c2 p1_3
3658                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3659          ->  Seq Scan on p1_c3 p1_4
3660                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3661          ->  Seq Scan on p1_c4 p1_5
3662                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3663          ->  Seq Scan on p1_c1_c1 p1_6
3664                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3665          ->  Seq Scan on p1_c1_c2 p1_7
3666                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3667          ->  Seq Scan on p1_c3_c1 p1_8
3668                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3669          ->  Seq Scan on p1_c3_c2 p1_9
3670                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3671    ->  Materialize
3672          ->  Index Scan using t1_pkey on t1
3673                Index Cond: (id < 10)
3674 (24 rows)
3675
3676 /*+MergeJoin(p1 t1)*/
3677 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3678 LOG:  pg_hint_plan:
3679 used hint:
3680 MergeJoin(p1 t1)
3681 not used hint:
3682 duplication hint:
3683 error hint:
3684
3685                                     QUERY PLAN                                     
3686 -----------------------------------------------------------------------------------
3687  Merge Join
3688    Merge Cond: (p1.id = t1.id)
3689    ->  Sort
3690          Sort Key: p1.id
3691          ->  Append
3692                ->  Seq Scan on p1 p1_1
3693                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3694                ->  Seq Scan on p1_c1 p1_2
3695                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3696                ->  Seq Scan on p1_c2 p1_3
3697                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3698                ->  Seq Scan on p1_c3 p1_4
3699                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3700                ->  Seq Scan on p1_c4 p1_5
3701                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3702                ->  Seq Scan on p1_c1_c1 p1_6
3703                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3704                ->  Seq Scan on p1_c1_c2 p1_7
3705                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3706                ->  Seq Scan on p1_c3_c1 p1_8
3707                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3708                ->  Seq Scan on p1_c3_c2 p1_9
3709                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3710    ->  Index Scan using t1_pkey on t1
3711          Index Cond: (id < 10)
3712 (25 rows)
3713
3714 /*+HashJoin(p1 t1)*/
3715 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3716 LOG:  pg_hint_plan:
3717 used hint:
3718 HashJoin(p1 t1)
3719 not used hint:
3720 duplication hint:
3721 error hint:
3722
3723                                  QUERY PLAN                                  
3724 -----------------------------------------------------------------------------
3725  Hash Join
3726    Hash Cond: (p1.id = t1.id)
3727    ->  Append
3728          ->  Seq Scan on p1 p1_1
3729                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3730          ->  Seq Scan on p1_c1 p1_2
3731                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3732          ->  Seq Scan on p1_c2 p1_3
3733                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3734          ->  Seq Scan on p1_c3 p1_4
3735                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3736          ->  Seq Scan on p1_c4 p1_5
3737                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3738          ->  Seq Scan on p1_c1_c1 p1_6
3739                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3740          ->  Seq Scan on p1_c1_c2 p1_7
3741                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3742          ->  Seq Scan on p1_c3_c1 p1_8
3743                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3744          ->  Seq Scan on p1_c3_c2 p1_9
3745                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3746    ->  Hash
3747          ->  Index Scan using t1_pkey on t1
3748                Index Cond: (id < 10)
3749 (24 rows)
3750
3751 SET constraint_exclusion TO on;
3752 /*+SeqScan(p1)*/
3753 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3754 LOG:  pg_hint_plan:
3755 used hint:
3756 SeqScan(p1)
3757 not used hint:
3758 duplication hint:
3759 error hint:
3760
3761                                     QUERY PLAN                                     
3762 -----------------------------------------------------------------------------------
3763  Merge Join
3764    Merge Cond: (p1.id = t1.id)
3765    ->  Sort
3766          Sort Key: p1.id
3767          ->  Append
3768                ->  Seq Scan on p1 p1_1
3769                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3770                ->  Seq Scan on p1_c1 p1_2
3771                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3772                ->  Seq Scan on p1_c1_c1 p1_3
3773                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3774                ->  Seq Scan on p1_c1_c2 p1_4
3775                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3776    ->  Index Scan using t1_pkey on t1
3777          Index Cond: (id < 10)
3778 (15 rows)
3779
3780 /*+IndexScan(p1)*/
3781 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3782 LOG:  pg_hint_plan:
3783 used hint:
3784 IndexScan(p1)
3785 not used hint:
3786 duplication hint:
3787 error hint:
3788
3789                          QUERY PLAN                          
3790 -------------------------------------------------------------
3791  Merge Join
3792    Merge Cond: (p1.id = t1.id)
3793    ->  Merge Append
3794          Sort Key: p1.id
3795          ->  Index Scan using p1_pkey on p1 p1_1
3796                Index Cond: ((id >= 50) AND (id <= 51))
3797                Filter: (ctid = '(1,1)'::tid)
3798          ->  Index Scan using p1_c1_pkey on p1_c1 p1_2
3799                Index Cond: ((id >= 50) AND (id <= 51))
3800                Filter: (ctid = '(1,1)'::tid)
3801          ->  Index Scan using p1_c1_c1_pkey on p1_c1_c1 p1_3
3802                Index Cond: ((id >= 50) AND (id <= 51))
3803                Filter: (ctid = '(1,1)'::tid)
3804          ->  Index Scan using p1_c1_c2_pkey on p1_c1_c2 p1_4
3805                Index Cond: ((id >= 50) AND (id <= 51))
3806                Filter: (ctid = '(1,1)'::tid)
3807    ->  Index Scan using t1_pkey on t1
3808          Index Cond: (id < 10)
3809 (18 rows)
3810
3811 /*+BitmapScan(p1)*/
3812 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3813 LOG:  pg_hint_plan:
3814 used hint:
3815 BitmapScan(p1)
3816 not used hint:
3817 duplication hint:
3818 error hint:
3819
3820                             QUERY PLAN                             
3821 -------------------------------------------------------------------
3822  Merge Join
3823    Merge Cond: (p1.id = t1.id)
3824    ->  Sort
3825          Sort Key: p1.id
3826          ->  Append
3827                ->  Bitmap Heap Scan on p1 p1_1
3828                      Recheck Cond: ((id >= 50) AND (id <= 51))
3829                      Filter: (ctid = '(1,1)'::tid)
3830                      ->  Bitmap Index Scan on p1_pkey
3831                            Index Cond: ((id >= 50) AND (id <= 51))
3832                ->  Bitmap Heap Scan on p1_c1 p1_2
3833                      Recheck Cond: ((id >= 50) AND (id <= 51))
3834                      Filter: (ctid = '(1,1)'::tid)
3835                      ->  Bitmap Index Scan on p1_c1_pkey
3836                            Index Cond: ((id >= 50) AND (id <= 51))
3837                ->  Bitmap Heap Scan on p1_c1_c1 p1_3
3838                      Recheck Cond: ((id >= 50) AND (id <= 51))
3839                      Filter: (ctid = '(1,1)'::tid)
3840                      ->  Bitmap Index Scan on p1_c1_c1_pkey
3841                            Index Cond: ((id >= 50) AND (id <= 51))
3842                ->  Bitmap Heap Scan on p1_c1_c2 p1_4
3843                      Recheck Cond: ((id >= 50) AND (id <= 51))
3844                      Filter: (ctid = '(1,1)'::tid)
3845                      ->  Bitmap Index Scan on p1_c1_c2_pkey
3846                            Index Cond: ((id >= 50) AND (id <= 51))
3847    ->  Index Scan using t1_pkey on t1
3848          Index Cond: (id < 10)
3849 (27 rows)
3850
3851 /*+TidScan(p1)*/
3852 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3853 LOG:  pg_hint_plan:
3854 used hint:
3855 TidScan(p1)
3856 not used hint:
3857 duplication hint:
3858 error hint:
3859
3860                        QUERY PLAN                        
3861 ---------------------------------------------------------
3862  Merge Join
3863    Merge Cond: (p1.id = t1.id)
3864    ->  Sort
3865          Sort Key: p1.id
3866          ->  Append
3867                ->  Tid Scan on p1 p1_1
3868                      TID Cond: (ctid = '(1,1)'::tid)
3869                      Filter: ((id >= 50) AND (id <= 51))
3870                ->  Tid Scan on p1_c1 p1_2
3871                      TID Cond: (ctid = '(1,1)'::tid)
3872                      Filter: ((id >= 50) AND (id <= 51))
3873                ->  Tid Scan on p1_c1_c1 p1_3
3874                      TID Cond: (ctid = '(1,1)'::tid)
3875                      Filter: ((id >= 50) AND (id <= 51))
3876                ->  Tid Scan on p1_c1_c2 p1_4
3877                      TID Cond: (ctid = '(1,1)'::tid)
3878                      Filter: ((id >= 50) AND (id <= 51))
3879    ->  Index Scan using t1_pkey on t1
3880          Index Cond: (id < 10)
3881 (19 rows)
3882
3883 /*+NestLoop(p1 t1)*/
3884 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3885 LOG:  pg_hint_plan:
3886 used hint:
3887 NestLoop(p1 t1)
3888 not used hint:
3889 duplication hint:
3890 error hint:
3891
3892                                     QUERY PLAN                                     
3893 -----------------------------------------------------------------------------------
3894  Nested Loop
3895    Join Filter: (p1.id = t1.id)
3896    ->  Index Scan using t1_pkey on t1
3897          Index Cond: (id < 10)
3898    ->  Materialize
3899          ->  Append
3900                ->  Seq Scan on p1 p1_1
3901                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3902                ->  Seq Scan on p1_c1 p1_2
3903                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3904                ->  Seq Scan on p1_c1_c1 p1_3
3905                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3906                ->  Seq Scan on p1_c1_c2 p1_4
3907                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3908 (14 rows)
3909
3910 /*+MergeJoin(p1 t1)*/
3911 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3912 LOG:  pg_hint_plan:
3913 used hint:
3914 MergeJoin(p1 t1)
3915 not used hint:
3916 duplication hint:
3917 error hint:
3918
3919                                     QUERY PLAN                                     
3920 -----------------------------------------------------------------------------------
3921  Merge Join
3922    Merge Cond: (p1.id = t1.id)
3923    ->  Sort
3924          Sort Key: p1.id
3925          ->  Append
3926                ->  Seq Scan on p1 p1_1
3927                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3928                ->  Seq Scan on p1_c1 p1_2
3929                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3930                ->  Seq Scan on p1_c1_c1 p1_3
3931                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3932                ->  Seq Scan on p1_c1_c2 p1_4
3933                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3934    ->  Index Scan using t1_pkey on t1
3935          Index Cond: (id < 10)
3936 (15 rows)
3937
3938 /*+HashJoin(p1 t1)*/
3939 EXPLAIN (COSTS false) SELECT * FROM p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
3940 LOG:  pg_hint_plan:
3941 used hint:
3942 HashJoin(p1 t1)
3943 not used hint:
3944 duplication hint:
3945 error hint:
3946
3947                                     QUERY PLAN                                     
3948 -----------------------------------------------------------------------------------
3949  Hash Join
3950    Hash Cond: (t1.id = p1.id)
3951    ->  Index Scan using t1_pkey on t1
3952          Index Cond: (id < 10)
3953    ->  Hash
3954          ->  Append
3955                ->  Seq Scan on p1 p1_1
3956                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3957                ->  Seq Scan on p1_c1 p1_2
3958                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3959                ->  Seq Scan on p1_c1_c1 p1_3
3960                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3961                ->  Seq Scan on p1_c1_c2 p1_4
3962                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3963 (14 rows)
3964
3965 SET constraint_exclusion TO off;
3966 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3967                            QUERY PLAN                            
3968 -----------------------------------------------------------------
3969  Seq Scan on p1
3970    Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3971 (2 rows)
3972
3973 SET constraint_exclusion TO on;
3974 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3975                            QUERY PLAN                            
3976 -----------------------------------------------------------------
3977  Seq Scan on p1
3978    Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3979 (2 rows)
3980
3981 SET constraint_exclusion TO off;
3982 /*+SeqScan(p1)*/
3983 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3984 LOG:  pg_hint_plan:
3985 used hint:
3986 SeqScan(p1)
3987 not used hint:
3988 duplication hint:
3989 error hint:
3990
3991                            QUERY PLAN                            
3992 -----------------------------------------------------------------
3993  Seq Scan on p1
3994    Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3995 (2 rows)
3996
3997 /*+IndexScan(p1)*/
3998 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
3999 LOG:  pg_hint_plan:
4000 used hint:
4001 IndexScan(p1)
4002 not used hint:
4003 duplication hint:
4004 error hint:
4005
4006                 QUERY PLAN                 
4007 -------------------------------------------
4008  Index Scan using p1_pkey on p1
4009    Index Cond: ((id >= 50) AND (id <= 51))
4010    Filter: (ctid = '(1,1)'::tid)
4011 (3 rows)
4012
4013 /*+BitmapScan(p1)*/
4014 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
4015 LOG:  pg_hint_plan:
4016 used hint:
4017 BitmapScan(p1)
4018 not used hint:
4019 duplication hint:
4020 error hint:
4021
4022                    QUERY PLAN                    
4023 -------------------------------------------------
4024  Bitmap Heap Scan on p1
4025    Recheck Cond: ((id >= 50) AND (id <= 51))
4026    Filter: (ctid = '(1,1)'::tid)
4027    ->  Bitmap Index Scan on p1_pkey
4028          Index Cond: ((id >= 50) AND (id <= 51))
4029 (5 rows)
4030
4031 /*+TidScan(p1)*/
4032 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
4033 LOG:  pg_hint_plan:
4034 used hint:
4035 TidScan(p1)
4036 not used hint:
4037 duplication hint:
4038 error hint:
4039
4040               QUERY PLAN               
4041 ---------------------------------------
4042  Tid Scan on p1
4043    TID Cond: (ctid = '(1,1)'::tid)
4044    Filter: ((id >= 50) AND (id <= 51))
4045 (3 rows)
4046
4047 /*+NestLoop(p1 t1)*/
4048 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4049 LOG:  pg_hint_plan:
4050 used hint:
4051 NestLoop(p1 t1)
4052 not used hint:
4053 duplication hint:
4054 error hint:
4055
4056                               QUERY PLAN                               
4057 -----------------------------------------------------------------------
4058  Nested Loop
4059    Join Filter: (p1.id = t1.id)
4060    ->  Seq Scan on p1
4061          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4062    ->  Index Scan using t1_pkey on t1
4063          Index Cond: (id < 10)
4064 (6 rows)
4065
4066 /*+MergeJoin(p1 t1)*/
4067 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4068 LOG:  pg_hint_plan:
4069 used hint:
4070 MergeJoin(p1 t1)
4071 not used hint:
4072 duplication hint:
4073 error hint:
4074
4075                                  QUERY PLAN                                  
4076 -----------------------------------------------------------------------------
4077  Merge Join
4078    Merge Cond: (p1.id = t1.id)
4079    ->  Sort
4080          Sort Key: p1.id
4081          ->  Seq Scan on p1
4082                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4083    ->  Index Scan using t1_pkey on t1
4084          Index Cond: (id < 10)
4085 (8 rows)
4086
4087 /*+HashJoin(p1 t1)*/
4088 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4089 LOG:  pg_hint_plan:
4090 used hint:
4091 HashJoin(p1 t1)
4092 not used hint:
4093 duplication hint:
4094 error hint:
4095
4096                                  QUERY PLAN                                  
4097 -----------------------------------------------------------------------------
4098  Hash Join
4099    Hash Cond: (t1.id = p1.id)
4100    ->  Index Scan using t1_pkey on t1
4101          Index Cond: (id < 10)
4102    ->  Hash
4103          ->  Seq Scan on p1
4104                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4105 (7 rows)
4106
4107 SET constraint_exclusion TO on;
4108 /*+SeqScan(p1)*/
4109 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
4110 LOG:  pg_hint_plan:
4111 used hint:
4112 SeqScan(p1)
4113 not used hint:
4114 duplication hint:
4115 error hint:
4116
4117                            QUERY PLAN                            
4118 -----------------------------------------------------------------
4119  Seq Scan on p1
4120    Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4121 (2 rows)
4122
4123 /*+IndexScan(p1)*/
4124 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
4125 LOG:  pg_hint_plan:
4126 used hint:
4127 IndexScan(p1)
4128 not used hint:
4129 duplication hint:
4130 error hint:
4131
4132                 QUERY PLAN                 
4133 -------------------------------------------
4134  Index Scan using p1_pkey on p1
4135    Index Cond: ((id >= 50) AND (id <= 51))
4136    Filter: (ctid = '(1,1)'::tid)
4137 (3 rows)
4138
4139 /*+BitmapScan(p1)*/
4140 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
4141 LOG:  pg_hint_plan:
4142 used hint:
4143 BitmapScan(p1)
4144 not used hint:
4145 duplication hint:
4146 error hint:
4147
4148                    QUERY PLAN                    
4149 -------------------------------------------------
4150  Bitmap Heap Scan on p1
4151    Recheck Cond: ((id >= 50) AND (id <= 51))
4152    Filter: (ctid = '(1,1)'::tid)
4153    ->  Bitmap Index Scan on p1_pkey
4154          Index Cond: ((id >= 50) AND (id <= 51))
4155 (5 rows)
4156
4157 /*+TidScan(p1)*/
4158 EXPLAIN (COSTS false) SELECT * FROM ONLY p1 WHERE id >= 50 AND id <= 51 AND p1.ctid = '(1,1)';
4159 LOG:  pg_hint_plan:
4160 used hint:
4161 TidScan(p1)
4162 not used hint:
4163 duplication hint:
4164 error hint:
4165
4166               QUERY PLAN               
4167 ---------------------------------------
4168  Tid Scan on p1
4169    TID Cond: (ctid = '(1,1)'::tid)
4170    Filter: ((id >= 50) AND (id <= 51))
4171 (3 rows)
4172
4173 /*+NestLoop(p1 t1)*/
4174 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4175 LOG:  pg_hint_plan:
4176 used hint:
4177 NestLoop(p1 t1)
4178 not used hint:
4179 duplication hint:
4180 error hint:
4181
4182                               QUERY PLAN                               
4183 -----------------------------------------------------------------------
4184  Nested Loop
4185    Join Filter: (p1.id = t1.id)
4186    ->  Seq Scan on p1
4187          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4188    ->  Index Scan using t1_pkey on t1
4189          Index Cond: (id < 10)
4190 (6 rows)
4191
4192 /*+MergeJoin(p1 t1)*/
4193 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4194 LOG:  pg_hint_plan:
4195 used hint:
4196 MergeJoin(p1 t1)
4197 not used hint:
4198 duplication hint:
4199 error hint:
4200
4201                                  QUERY PLAN                                  
4202 -----------------------------------------------------------------------------
4203  Merge Join
4204    Merge Cond: (p1.id = t1.id)
4205    ->  Sort
4206          Sort Key: p1.id
4207          ->  Seq Scan on p1
4208                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4209    ->  Index Scan using t1_pkey on t1
4210          Index Cond: (id < 10)
4211 (8 rows)
4212
4213 /*+HashJoin(p1 t1)*/
4214 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4215 LOG:  pg_hint_plan:
4216 used hint:
4217 HashJoin(p1 t1)
4218 not used hint:
4219 duplication hint:
4220 error hint:
4221
4222                                  QUERY PLAN                                  
4223 -----------------------------------------------------------------------------
4224  Hash Join
4225    Hash Cond: (t1.id = p1.id)
4226    ->  Index Scan using t1_pkey on t1
4227          Index Cond: (id < 10)
4228    ->  Hash
4229          ->  Seq Scan on p1
4230                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4231 (7 rows)
4232
4233 SET constraint_exclusion TO off;
4234 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4235                               QUERY PLAN                               
4236 -----------------------------------------------------------------------
4237  Nested Loop
4238    Join Filter: (p1.id = t1.id)
4239    ->  Seq Scan on p1
4240          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4241    ->  Index Scan using t1_pkey on t1
4242          Index Cond: (id < 10)
4243 (6 rows)
4244
4245 SET constraint_exclusion TO on;
4246 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4247                               QUERY PLAN                               
4248 -----------------------------------------------------------------------
4249  Nested Loop
4250    Join Filter: (p1.id = t1.id)
4251    ->  Seq Scan on p1
4252          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4253    ->  Index Scan using t1_pkey on t1
4254          Index Cond: (id < 10)
4255 (6 rows)
4256
4257 SET constraint_exclusion TO off;
4258 /*+SeqScan(p1)*/
4259 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4260 LOG:  pg_hint_plan:
4261 used hint:
4262 SeqScan(p1)
4263 not used hint:
4264 duplication hint:
4265 error hint:
4266
4267                               QUERY PLAN                               
4268 -----------------------------------------------------------------------
4269  Nested Loop
4270    Join Filter: (p1.id = t1.id)
4271    ->  Seq Scan on p1
4272          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4273    ->  Index Scan using t1_pkey on t1
4274          Index Cond: (id < 10)
4275 (6 rows)
4276
4277 /*+IndexScan(p1)*/
4278 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4279 LOG:  pg_hint_plan:
4280 used hint:
4281 IndexScan(p1)
4282 not used hint:
4283 duplication hint:
4284 error hint:
4285
4286                    QUERY PLAN                    
4287 -------------------------------------------------
4288  Merge Join
4289    Merge Cond: (p1.id = t1.id)
4290    ->  Index Scan using p1_pkey on p1
4291          Index Cond: ((id >= 50) AND (id <= 51))
4292          Filter: (ctid = '(1,1)'::tid)
4293    ->  Index Scan using t1_pkey on t1
4294          Index Cond: (id < 10)
4295 (7 rows)
4296
4297 /*+BitmapScan(p1)*/
4298 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4299 LOG:  pg_hint_plan:
4300 used hint:
4301 BitmapScan(p1)
4302 not used hint:
4303 duplication hint:
4304 error hint:
4305
4306                       QUERY PLAN                       
4307 -------------------------------------------------------
4308  Nested Loop
4309    Join Filter: (p1.id = t1.id)
4310    ->  Bitmap Heap Scan on p1
4311          Recheck Cond: ((id >= 50) AND (id <= 51))
4312          Filter: (ctid = '(1,1)'::tid)
4313          ->  Bitmap Index Scan on p1_pkey
4314                Index Cond: ((id >= 50) AND (id <= 51))
4315    ->  Index Scan using t1_pkey on t1
4316          Index Cond: (id < 10)
4317 (9 rows)
4318
4319 /*+TidScan(p1)*/
4320 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4321 LOG:  pg_hint_plan:
4322 used hint:
4323 TidScan(p1)
4324 not used hint:
4325 duplication hint:
4326 error hint:
4327
4328                  QUERY PLAN                  
4329 ---------------------------------------------
4330  Nested Loop
4331    Join Filter: (p1.id = t1.id)
4332    ->  Tid Scan on p1
4333          TID Cond: (ctid = '(1,1)'::tid)
4334          Filter: ((id >= 50) AND (id <= 51))
4335    ->  Index Scan using t1_pkey on t1
4336          Index Cond: (id < 10)
4337 (7 rows)
4338
4339 SET constraint_exclusion TO on;
4340 /*+SeqScan(p1)*/
4341 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4342 LOG:  pg_hint_plan:
4343 used hint:
4344 SeqScan(p1)
4345 not used hint:
4346 duplication hint:
4347 error hint:
4348
4349                               QUERY PLAN                               
4350 -----------------------------------------------------------------------
4351  Nested Loop
4352    Join Filter: (p1.id = t1.id)
4353    ->  Seq Scan on p1
4354          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
4355    ->  Index Scan using t1_pkey on t1
4356          Index Cond: (id < 10)
4357 (6 rows)
4358
4359 /*+IndexScan(p1)*/
4360 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4361 LOG:  pg_hint_plan:
4362 used hint:
4363 IndexScan(p1)
4364 not used hint:
4365 duplication hint:
4366 error hint:
4367
4368                    QUERY PLAN                    
4369 -------------------------------------------------
4370  Merge Join
4371    Merge Cond: (p1.id = t1.id)
4372    ->  Index Scan using p1_pkey on p1
4373          Index Cond: ((id >= 50) AND (id <= 51))
4374          Filter: (ctid = '(1,1)'::tid)
4375    ->  Index Scan using t1_pkey on t1
4376          Index Cond: (id < 10)
4377 (7 rows)
4378
4379 /*+BitmapScan(p1)*/
4380 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4381 LOG:  pg_hint_plan:
4382 used hint:
4383 BitmapScan(p1)
4384 not used hint:
4385 duplication hint:
4386 error hint:
4387
4388                       QUERY PLAN                       
4389 -------------------------------------------------------
4390  Nested Loop
4391    Join Filter: (p1.id = t1.id)
4392    ->  Bitmap Heap Scan on p1
4393          Recheck Cond: ((id >= 50) AND (id <= 51))
4394          Filter: (ctid = '(1,1)'::tid)
4395          ->  Bitmap Index Scan on p1_pkey
4396                Index Cond: ((id >= 50) AND (id <= 51))
4397    ->  Index Scan using t1_pkey on t1
4398          Index Cond: (id < 10)
4399 (9 rows)
4400
4401 /*+TidScan(p1)*/
4402 EXPLAIN (COSTS false) SELECT * FROM ONLY p1, t1 WHERE p1.id >= 50 AND p1.id <= 51 AND p1.ctid = '(1,1)' AND p1.id = t1.id AND t1.id < 10;
4403 LOG:  pg_hint_plan:
4404 used hint:
4405 TidScan(p1)
4406 not used hint:
4407 duplication hint:
4408 error hint:
4409
4410                  QUERY PLAN                  
4411 ---------------------------------------------
4412  Nested Loop
4413    Join Filter: (p1.id = t1.id)
4414    ->  Tid Scan on p1
4415          TID Cond: (ctid = '(1,1)'::tid)
4416          Filter: ((id >= 50) AND (id <= 51))
4417    ->  Index Scan using t1_pkey on t1
4418          Index Cond: (id < 10)
4419 (7 rows)
4420
4421 -- quote test
4422 /*+SeqScan("""t1 )      ")IndexScan("t  2 """)HashJoin("""t1 )  "T3"t   2 """)Leading("""t1 )   "T3"t   2 """)Set(application_name"a    a       a""     a       A")*/
4423 EXPLAIN (COSTS false) SELECT * FROM t1 """t1 )  ", t2 "t        2 """, t3 "T3" WHERE """t1 )    ".id = "t       2 """.id AND """t1 )    ".id = "T3".id;
4424 LOG:  pg_hint_plan:
4425 used hint:
4426 SeqScan("""t1 ) ")
4427 IndexScan("t    2 """)
4428 HashJoin("""t1 )        " T3 "t 2 """)
4429 Leading("""t1 ) " T3 "t 2 """)
4430 Set(application_name "a a       a""     a       A")
4431 not used hint:
4432 duplication hint:
4433 error hint:
4434
4435                        QUERY PLAN                        
4436 ---------------------------------------------------------
4437  Hash Join
4438    Hash Cond: ("t        2 """.id = """t1 )      ".id)
4439    ->  Index Scan using t2_pkey on t2 "t 2 """
4440    ->  Hash
4441          ->  Hash Join
4442                Hash Cond: ("""t1 )       ".id = "T3".id)
4443                ->  Seq Scan on t1 """t1 )        "
4444                ->  Hash
4445                      ->  Seq Scan on t3 "T3"
4446 (9 rows)
4447
4448 -- duplicate hint test
4449 /*+SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)*/
4450 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)' AND t2.ctid = '(1,1)';
4451 INFO:  pg_hint_plan: hint syntax error at or near "SeqScan(t1)SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4452 DETAIL:  Conflict scan method hint.
4453 INFO:  pg_hint_plan: hint syntax error at or near "IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4454 DETAIL:  Conflict scan method hint.
4455 INFO:  pg_hint_plan: hint syntax error at or near "BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4456 DETAIL:  Conflict scan method hint.
4457 INFO:  pg_hint_plan: hint syntax error at or near "SeqScan(t2)IndexScan(t1)IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4458 DETAIL:  Conflict scan method hint.
4459 INFO:  pg_hint_plan: hint syntax error at or near "IndexScan(t2)BitmapScan(t1)BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4460 DETAIL:  Conflict scan method hint.
4461 INFO:  pg_hint_plan: hint syntax error at or near "BitmapScan(t2)TidScan(t1)TidScan(t2)HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4462 DETAIL:  Conflict scan method hint.
4463 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t1 t2)NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4464 DETAIL:  Conflict join method hint.
4465 INFO:  pg_hint_plan: hint syntax error at or near "NestLoop(t2 t1)MergeJoin(t1 t2)Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4466 DETAIL:  Conflict join method hint.
4467 INFO:  pg_hint_plan: hint syntax error at or near "Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4468 DETAIL:  Conflict set hint.
4469 INFO:  pg_hint_plan: hint syntax error at or near "Leading(t1 t2)Leading(t2 t1)Set(enable_seqscan off)Set(enable_mergejoin on)Set(enable_seqscan on)"
4470 DETAIL:  Conflict leading hint.
4471 LOG:  pg_hint_plan:
4472 used hint:
4473 TidScan(t1)
4474 TidScan(t2)
4475 MergeJoin(t1 t2)
4476 Leading(t2 t1)
4477 Set(enable_mergejoin on)
4478 Set(enable_seqscan on)
4479 not used hint:
4480 duplication hint:
4481 SeqScan(t1)
4482 IndexScan(t1)
4483 BitmapScan(t1)
4484 SeqScan(t2)
4485 IndexScan(t2)
4486 BitmapScan(t2)
4487 HashJoin(t1 t2)
4488 NestLoop(t1 t2)
4489 Leading(t1 t2)
4490 Set(enable_seqscan off)
4491 error hint:
4492
4493                   QUERY PLAN                   
4494 -----------------------------------------------
4495  Merge Join
4496    Merge Cond: (t1.id = t2.id)
4497    ->  Sort
4498          Sort Key: t1.id
4499          ->  Tid Scan on t1
4500                TID Cond: (ctid = '(1,1)'::tid)
4501    ->  Sort
4502          Sort Key: t2.id
4503          ->  Tid Scan on t2
4504                TID Cond: (ctid = '(1,1)'::tid)
4505 (10 rows)
4506
4507 -- sub query Leading hint test
4508 SET from_collapse_limit TO 100;
4509 SET geqo_threshold TO 100;
4510 EXPLAIN (COSTS false)
4511 WITH c1_1(id) AS (
4512 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4513 )
4514 SELECT t1_1.id, (
4515 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4516 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4517 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4518 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4519 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4520 );
4521                                   QUERY PLAN                                  
4522 ------------------------------------------------------------------------------
4523  Nested Loop
4524    InitPlan 1 (returns $0)
4525      ->  Aggregate
4526            ->  Merge Join
4527                  Merge Cond: (t1_2.id = t3_2.id)
4528                  ->  Merge Join
4529                        Merge Cond: (t1_2.id = t2_2.id)
4530                        ->  Index Only Scan using t1_pkey on t1 t1_2
4531                        ->  Index Only Scan using t2_pkey on t2 t2_2
4532                  ->  Sort
4533                        Sort Key: t3_2.id
4534                        ->  Seq Scan on t3 t3_2
4535    InitPlan 2 (returns $1)
4536      ->  Aggregate
4537            ->  Merge Join
4538                  Merge Cond: (t1_4.id = t3_4.id)
4539                  ->  Merge Join
4540                        Merge Cond: (t1_4.id = t2_4.id)
4541                        ->  Index Only Scan using t1_pkey on t1 t1_4
4542                        ->  Index Only Scan using t2_pkey on t2 t2_4
4543                  ->  Sort
4544                        Sort Key: t3_4.id
4545                        ->  Seq Scan on t3 t3_4
4546    ->  Nested Loop
4547          ->  Nested Loop
4548                ->  Nested Loop
4549                      ->  Nested Loop
4550                            ->  Nested Loop
4551                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4552                                        Index Cond: (id = $1)
4553                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4554                                        Index Cond: (id = $1)
4555                            ->  Seq Scan on t3 t3_1
4556                                  Filter: (id = $1)
4557                      ->  Index Only Scan using t1_pkey on t1 t1_3
4558                            Index Cond: (id = $1)
4559                ->  Index Only Scan using t2_pkey on t2 t2_3
4560                      Index Cond: (id = $1)
4561          ->  Seq Scan on t3 t3_3
4562                Filter: (id = $1)
4563    ->  Aggregate
4564          Filter: (max(t1_5.id) = $1)
4565          ->  Merge Join
4566                Merge Cond: (t1_5.id = t3_5.id)
4567                ->  Merge Join
4568                      Merge Cond: (t1_5.id = t2_5.id)
4569                      ->  Index Only Scan using t1_pkey on t1 t1_5
4570                      ->  Index Only Scan using t2_pkey on t2 t2_5
4571                ->  Sort
4572                      Sort Key: t3_5.id
4573                      ->  Seq Scan on t3 t3_5
4574 (51 rows)
4575
4576 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
4577 EXPLAIN (COSTS false)
4578 WITH c1_1(id) AS (
4579 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4580 )
4581 SELECT t1_1.id, (
4582 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4583 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4584 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4585 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4586 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4587 );
4588 LOG:  pg_hint_plan:
4589 used hint:
4590 HashJoin(t1_1 t3_1)
4591 NestLoop(t1_2 t2_2)
4592 MergeJoin(t1_3 t3_3)
4593 NestLoop(t1_4 t2_4)
4594 NestLoop(t1_5 t2_5)
4595 not used hint:
4596 duplication hint:
4597 error hint:
4598
4599                                   QUERY PLAN                                  
4600 ------------------------------------------------------------------------------
4601  Nested Loop
4602    InitPlan 1 (returns $1)
4603      ->  Aggregate
4604            ->  Merge Join
4605                  Merge Cond: (t1_2.id = t3_2.id)
4606                  ->  Nested Loop
4607                        ->  Index Only Scan using t2_pkey on t2 t2_2
4608                        ->  Index Only Scan using t1_pkey on t1 t1_2
4609                              Index Cond: (id = t2_2.id)
4610                  ->  Sort
4611                        Sort Key: t3_2.id
4612                        ->  Seq Scan on t3 t3_2
4613    InitPlan 2 (returns $3)
4614      ->  Aggregate
4615            ->  Merge Join
4616                  Merge Cond: (t1_4.id = t3_4.id)
4617                  ->  Nested Loop
4618                        ->  Index Only Scan using t2_pkey on t2 t2_4
4619                        ->  Index Only Scan using t1_pkey on t1 t1_4
4620                              Index Cond: (id = t2_4.id)
4621                  ->  Sort
4622                        Sort Key: t3_4.id
4623                        ->  Seq Scan on t3 t3_4
4624    ->  Nested Loop
4625          ->  Nested Loop
4626                ->  Nested Loop
4627                      ->  Nested Loop
4628                            ->  Nested Loop
4629                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4630                                        Index Cond: (id = $3)
4631                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4632                                        Index Cond: (id = $3)
4633                            ->  Seq Scan on t3 t3_1
4634                                  Filter: (id = $3)
4635                      ->  Index Only Scan using t1_pkey on t1 t1_3
4636                            Index Cond: (id = $3)
4637                ->  Index Only Scan using t2_pkey on t2 t2_3
4638                      Index Cond: (id = $3)
4639          ->  Seq Scan on t3 t3_3
4640                Filter: (id = $3)
4641    ->  Aggregate
4642          Filter: (max(t1_5.id) = $3)
4643          ->  Merge Join
4644                Merge Cond: (t1_5.id = t3_5.id)
4645                ->  Nested Loop
4646                      ->  Index Only Scan using t2_pkey on t2 t2_5
4647                      ->  Index Only Scan using t1_pkey on t1 t1_5
4648                            Index Cond: (id = t2_5.id)
4649                ->  Sort
4650                      Sort Key: t3_5.id
4651                      ->  Seq Scan on t3 t3_5
4652 (51 rows)
4653
4654 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
4655 EXPLAIN (COSTS false)
4656 WITH c1_1(id) AS (
4657 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4658 )
4659 SELECT t1_1.id, (
4660 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4661 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4662 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4663 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4664 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4665 );
4666 LOG:  pg_hint_plan:
4667 used hint:
4668 HashJoin(t1_1 t3_1)
4669 NestLoop(t1_2 t2_2)
4670 MergeJoin(t1_3 t3_3)
4671 NestLoop(t1_4 t2_4)
4672 NestLoop(t1_5 t2_5)
4673 not used hint:
4674 Leading(a t1_1 t1_2 t1_4 t1_5)
4675 duplication hint:
4676 error hint:
4677
4678                                   QUERY PLAN                                  
4679 ------------------------------------------------------------------------------
4680  Nested Loop
4681    InitPlan 1 (returns $1)
4682      ->  Aggregate
4683            ->  Merge Join
4684                  Merge Cond: (t1_2.id = t3_2.id)
4685                  ->  Nested Loop
4686                        ->  Index Only Scan using t2_pkey on t2 t2_2
4687                        ->  Index Only Scan using t1_pkey on t1 t1_2
4688                              Index Cond: (id = t2_2.id)
4689                  ->  Sort
4690                        Sort Key: t3_2.id
4691                        ->  Seq Scan on t3 t3_2
4692    InitPlan 2 (returns $3)
4693      ->  Aggregate
4694            ->  Merge Join
4695                  Merge Cond: (t1_4.id = t3_4.id)
4696                  ->  Nested Loop
4697                        ->  Index Only Scan using t2_pkey on t2 t2_4
4698                        ->  Index Only Scan using t1_pkey on t1 t1_4
4699                              Index Cond: (id = t2_4.id)
4700                  ->  Sort
4701                        Sort Key: t3_4.id
4702                        ->  Seq Scan on t3 t3_4
4703    ->  Nested Loop
4704          ->  Nested Loop
4705                ->  Nested Loop
4706                      ->  Nested Loop
4707                            ->  Nested Loop
4708                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4709                                        Index Cond: (id = $3)
4710                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4711                                        Index Cond: (id = $3)
4712                            ->  Seq Scan on t3 t3_1
4713                                  Filter: (id = $3)
4714                      ->  Index Only Scan using t1_pkey on t1 t1_3
4715                            Index Cond: (id = $3)
4716                ->  Index Only Scan using t2_pkey on t2 t2_3
4717                      Index Cond: (id = $3)
4718          ->  Seq Scan on t3 t3_3
4719                Filter: (id = $3)
4720    ->  Aggregate
4721          Filter: (max(t1_5.id) = $3)
4722          ->  Merge Join
4723                Merge Cond: (t1_5.id = t3_5.id)
4724                ->  Nested Loop
4725                      ->  Index Only Scan using t2_pkey on t2 t2_5
4726                      ->  Index Only Scan using t1_pkey on t1 t1_5
4727                            Index Cond: (id = t2_5.id)
4728                ->  Sort
4729                      Sort Key: t3_5.id
4730                      ->  Seq Scan on t3 t3_5
4731 (51 rows)
4732
4733 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
4734 EXPLAIN (COSTS false)
4735 WITH c1_1(id) AS (
4736 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4737 )
4738 SELECT t1_1.id, (
4739 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4740 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4741 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4742 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4743 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4744 );
4745 LOG:  pg_hint_plan:
4746 used hint:
4747 HashJoin(t1_1 t3_1)
4748 NestLoop(t1_2 t2_2)
4749 MergeJoin(t1_3 t3_3)
4750 NestLoop(t1_4 t2_4)
4751 NestLoop(t1_5 t2_5)
4752 not used hint:
4753 Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)
4754 duplication hint:
4755 error hint:
4756
4757                                   QUERY PLAN                                  
4758 ------------------------------------------------------------------------------
4759  Nested Loop
4760    InitPlan 1 (returns $1)
4761      ->  Aggregate
4762            ->  Merge Join
4763                  Merge Cond: (t1_2.id = t3_2.id)
4764                  ->  Nested Loop
4765                        ->  Index Only Scan using t2_pkey on t2 t2_2
4766                        ->  Index Only Scan using t1_pkey on t1 t1_2
4767                              Index Cond: (id = t2_2.id)
4768                  ->  Sort
4769                        Sort Key: t3_2.id
4770                        ->  Seq Scan on t3 t3_2
4771    InitPlan 2 (returns $3)
4772      ->  Aggregate
4773            ->  Merge Join
4774                  Merge Cond: (t1_4.id = t3_4.id)
4775                  ->  Nested Loop
4776                        ->  Index Only Scan using t2_pkey on t2 t2_4
4777                        ->  Index Only Scan using t1_pkey on t1 t1_4
4778                              Index Cond: (id = t2_4.id)
4779                  ->  Sort
4780                        Sort Key: t3_4.id
4781                        ->  Seq Scan on t3 t3_4
4782    ->  Nested Loop
4783          ->  Nested Loop
4784                ->  Nested Loop
4785                      ->  Nested Loop
4786                            ->  Nested Loop
4787                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4788                                        Index Cond: (id = $3)
4789                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4790                                        Index Cond: (id = $3)
4791                            ->  Seq Scan on t3 t3_1
4792                                  Filter: (id = $3)
4793                      ->  Index Only Scan using t1_pkey on t1 t1_3
4794                            Index Cond: (id = $3)
4795                ->  Index Only Scan using t2_pkey on t2 t2_3
4796                      Index Cond: (id = $3)
4797          ->  Seq Scan on t3 t3_3
4798                Filter: (id = $3)
4799    ->  Aggregate
4800          Filter: (max(t1_5.id) = $3)
4801          ->  Merge Join
4802                Merge Cond: (t1_5.id = t3_5.id)
4803                ->  Nested Loop
4804                      ->  Index Only Scan using t2_pkey on t2 t2_5
4805                      ->  Index Only Scan using t1_pkey on t1 t1_5
4806                            Index Cond: (id = t2_5.id)
4807                ->  Sort
4808                      Sort Key: t3_5.id
4809                      ->  Seq Scan on t3 t3_5
4810 (51 rows)
4811
4812 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(t3_5 t2_5 t1_5)Leading(t3_2 t2_2 t1_2)Leading(t3_4 t2_4 t1_4)Leading(c1_1 t3_3 t2_3 t1_3 t3_1 t2_1 t1_1)*/
4813 EXPLAIN (COSTS false)
4814 WITH c1_1(id) AS (
4815 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4816 )
4817 SELECT t1_1.id, (
4818 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4819 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4820 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4821 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4822 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4823 );
4824 LOG:  pg_hint_plan:
4825 used hint:
4826 Leading(t3_5 t2_5 t1_5)
4827 Leading(t3_2 t2_2 t1_2)
4828 Leading(t3_4 t2_4 t1_4)
4829 Leading(c1_1 t3_3 t2_3 t1_3 t3_1 t2_1 t1_1)
4830 not used hint:
4831 HashJoin(t1_1 t3_1)
4832 NestLoop(t1_2 t2_2)
4833 MergeJoin(t1_3 t3_3)
4834 NestLoop(t1_4 t2_4)
4835 NestLoop(t1_5 t2_5)
4836 duplication hint:
4837 error hint:
4838
4839                                            QUERY PLAN                                           
4840 ------------------------------------------------------------------------------------------------
4841  Nested Loop
4842    InitPlan 1 (returns $0)
4843      ->  Aggregate
4844            ->  Merge Join
4845                  Merge Cond: (t2_2.id = t1_2.id)
4846                  ->  Merge Join
4847                        Merge Cond: (t2_2.id = t3_2.id)
4848                        ->  Index Only Scan using t2_pkey on t2 t2_2
4849                        ->  Sort
4850                              Sort Key: t3_2.id
4851                              ->  Seq Scan on t3 t3_2
4852                  ->  Index Only Scan using t1_pkey on t1 t1_2
4853    InitPlan 2 (returns $1)
4854      ->  Aggregate
4855            ->  Merge Join
4856                  Merge Cond: (t2_4.id = t1_4.id)
4857                  ->  Merge Join
4858                        Merge Cond: (t2_4.id = t3_4.id)
4859                        ->  Index Only Scan using t2_pkey on t2 t2_4
4860                        ->  Sort
4861                              Sort Key: t3_4.id
4862                              ->  Seq Scan on t3 t3_4
4863                  ->  Index Only Scan using t1_pkey on t1 t1_4
4864    ->  Nested Loop
4865          ->  Nested Loop
4866                ->  Nested Loop
4867                      ->  Nested Loop
4868                            ->  Nested Loop
4869                                  ->  Seq Scan on t3 t3_3
4870                                        Filter: (id = $1)
4871                                  ->  Aggregate
4872                                        Filter: (max(t1_5.id) = $1)
4873                                        ->  Merge Join
4874                                              Merge Cond: (t2_5.id = t1_5.id)
4875                                              ->  Merge Join
4876                                                    Merge Cond: (t2_5.id = t3_5.id)
4877                                                    ->  Index Only Scan using t2_pkey on t2 t2_5
4878                                                    ->  Sort
4879                                                          Sort Key: t3_5.id
4880                                                          ->  Seq Scan on t3 t3_5
4881                                              ->  Index Only Scan using t1_pkey on t1 t1_5
4882                            ->  Index Only Scan using t2_pkey on t2 t2_3
4883                                  Index Cond: (id = $1)
4884                      ->  Index Only Scan using t1_pkey on t1 t1_3
4885                            Index Cond: (id = $1)
4886                ->  Seq Scan on t3 t3_1
4887                      Filter: (id = $1)
4888          ->  Index Only Scan using t2_pkey on t2 t2_1
4889                Index Cond: (id = $1)
4890    ->  Index Only Scan using t1_pkey on t1 t1_1
4891          Index Cond: (id = $1)
4892 (51 rows)
4893
4894 SET from_collapse_limit TO 1;
4895 EXPLAIN (COSTS false)
4896 WITH c1_1(id) AS (
4897 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4898 )
4899 SELECT t1_1.id, (
4900 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4901 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4902 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4903 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4904 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4905 );
4906                              QUERY PLAN                             
4907 --------------------------------------------------------------------
4908  Nested Loop
4909    InitPlan 1 (returns $0)
4910      ->  Aggregate
4911            ->  Merge Join
4912                  Merge Cond: (t1_2.id = t3_2.id)
4913                  ->  Merge Join
4914                        Merge Cond: (t1_2.id = t2_2.id)
4915                        ->  Index Only Scan using t1_pkey on t1 t1_2
4916                        ->  Index Only Scan using t2_pkey on t2 t2_2
4917                  ->  Sort
4918                        Sort Key: t3_2.id
4919                        ->  Seq Scan on t3 t3_2
4920    InitPlan 2 (returns $1)
4921      ->  Aggregate
4922            ->  Merge Join
4923                  Merge Cond: (t1_4.id = t3_4.id)
4924                  ->  Merge Join
4925                        Merge Cond: (t1_4.id = t2_4.id)
4926                        ->  Index Only Scan using t1_pkey on t1 t1_4
4927                        ->  Index Only Scan using t2_pkey on t2 t2_4
4928                  ->  Sort
4929                        Sort Key: t3_4.id
4930                        ->  Seq Scan on t3 t3_4
4931    ->  Nested Loop
4932          ->  Nested Loop
4933                ->  Nested Loop
4934                      ->  Index Only Scan using t1_pkey on t1 t1_1
4935                            Index Cond: (id = $1)
4936                      ->  Index Only Scan using t2_pkey on t2 t2_1
4937                            Index Cond: (id = $1)
4938                ->  Seq Scan on t3 t3_1
4939                      Filter: (id = $1)
4940          ->  Nested Loop
4941                ->  Nested Loop
4942                      ->  Index Only Scan using t1_pkey on t1 t1_3
4943                            Index Cond: (id = $1)
4944                      ->  Index Only Scan using t2_pkey on t2 t2_3
4945                            Index Cond: (id = $1)
4946                ->  Seq Scan on t3 t3_3
4947                      Filter: (id = $1)
4948    ->  Aggregate
4949          Filter: (max(t1_5.id) = $1)
4950          ->  Merge Join
4951                Merge Cond: (t1_5.id = t3_5.id)
4952                ->  Merge Join
4953                      Merge Cond: (t1_5.id = t2_5.id)
4954                      ->  Index Only Scan using t1_pkey on t1 t1_5
4955                      ->  Index Only Scan using t2_pkey on t2 t2_5
4956                ->  Sort
4957                      Sort Key: t3_5.id
4958                      ->  Seq Scan on t3 t3_5
4959 (51 rows)
4960
4961 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)*/
4962 EXPLAIN (COSTS false)
4963 WITH c1_1(id) AS (
4964 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
4965 )
4966 SELECT t1_1.id, (
4967 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
4968 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4969 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
4970 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
4971 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
4972 );
4973 LOG:  pg_hint_plan:
4974 used hint:
4975 HashJoin(t1_1 t3_1)
4976 NestLoop(t1_2 t2_2)
4977 MergeJoin(t1_3 t3_3)
4978 NestLoop(t1_4 t2_4)
4979 NestLoop(t1_5 t2_5)
4980 not used hint:
4981 duplication hint:
4982 error hint:
4983
4984                              QUERY PLAN                             
4985 --------------------------------------------------------------------
4986  Nested Loop
4987    InitPlan 1 (returns $1)
4988      ->  Aggregate
4989            ->  Merge Join
4990                  Merge Cond: (t1_2.id = t3_2.id)
4991                  ->  Nested Loop
4992                        ->  Index Only Scan using t2_pkey on t2 t2_2
4993                        ->  Index Only Scan using t1_pkey on t1 t1_2
4994                              Index Cond: (id = t2_2.id)
4995                  ->  Sort
4996                        Sort Key: t3_2.id
4997                        ->  Seq Scan on t3 t3_2
4998    InitPlan 2 (returns $3)
4999      ->  Aggregate
5000            ->  Merge Join
5001                  Merge Cond: (t1_4.id = t3_4.id)
5002                  ->  Nested Loop
5003                        ->  Index Only Scan using t2_pkey on t2 t2_4
5004                        ->  Index Only Scan using t1_pkey on t1 t1_4
5005                              Index Cond: (id = t2_4.id)
5006                  ->  Sort
5007                        Sort Key: t3_4.id
5008                        ->  Seq Scan on t3 t3_4
5009    ->  Nested Loop
5010          ->  Nested Loop
5011                ->  Nested Loop
5012                      ->  Index Only Scan using t1_pkey on t1 t1_1
5013                            Index Cond: (id = $3)
5014                      ->  Index Only Scan using t2_pkey on t2 t2_1
5015                            Index Cond: (id = $3)
5016                ->  Seq Scan on t3 t3_1
5017                      Filter: (id = $3)
5018          ->  Nested Loop
5019                ->  Nested Loop
5020                      ->  Index Only Scan using t1_pkey on t1 t1_3
5021                            Index Cond: (id = $3)
5022                      ->  Index Only Scan using t2_pkey on t2 t2_3
5023                            Index Cond: (id = $3)
5024                ->  Seq Scan on t3 t3_3
5025                      Filter: (id = $3)
5026    ->  Aggregate
5027          Filter: (max(t1_5.id) = $3)
5028          ->  Merge Join
5029                Merge Cond: (t1_5.id = t3_5.id)
5030                ->  Nested Loop
5031                      ->  Index Only Scan using t2_pkey on t2 t2_5
5032                      ->  Index Only Scan using t1_pkey on t1 t1_5
5033                            Index Cond: (id = t2_5.id)
5034                ->  Sort
5035                      Sort Key: t3_5.id
5036                      ->  Seq Scan on t3 t3_5
5037 (51 rows)
5038
5039 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t1_1 t1_2 t1_4 t1_5)*/
5040 EXPLAIN (COSTS false)
5041 WITH c1_1(id) AS (
5042 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
5043 )
5044 SELECT t1_1.id, (
5045 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
5046 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
5047 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
5048 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
5049 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
5050 );
5051 LOG:  pg_hint_plan:
5052 used hint:
5053 HashJoin(t1_1 t3_1)
5054 NestLoop(t1_2 t2_2)
5055 MergeJoin(t1_3 t3_3)
5056 NestLoop(t1_4 t2_4)
5057 NestLoop(t1_5 t2_5)
5058 not used hint:
5059 Leading(a t1_1 t1_2 t1_4 t1_5)
5060 duplication hint:
5061 error hint:
5062
5063                              QUERY PLAN                             
5064 --------------------------------------------------------------------
5065  Nested Loop
5066    InitPlan 1 (returns $1)
5067      ->  Aggregate
5068            ->  Merge Join
5069                  Merge Cond: (t1_2.id = t3_2.id)
5070                  ->  Nested Loop
5071                        ->  Index Only Scan using t2_pkey on t2 t2_2
5072                        ->  Index Only Scan using t1_pkey on t1 t1_2
5073                              Index Cond: (id = t2_2.id)
5074                  ->  Sort
5075                        Sort Key: t3_2.id
5076                        ->  Seq Scan on t3 t3_2
5077    InitPlan 2 (returns $3)
5078      ->  Aggregate
5079            ->  Merge Join
5080                  Merge Cond: (t1_4.id = t3_4.id)
5081                  ->  Nested Loop
5082                        ->  Index Only Scan using t2_pkey on t2 t2_4
5083                        ->  Index Only Scan using t1_pkey on t1 t1_4
5084                              Index Cond: (id = t2_4.id)
5085                  ->  Sort
5086                        Sort Key: t3_4.id
5087                        ->  Seq Scan on t3 t3_4
5088    ->  Nested Loop
5089          ->  Nested Loop
5090                ->  Nested Loop
5091                      ->  Index Only Scan using t1_pkey on t1 t1_1
5092                            Index Cond: (id = $3)
5093                      ->  Index Only Scan using t2_pkey on t2 t2_1
5094                            Index Cond: (id = $3)
5095                ->  Seq Scan on t3 t3_1
5096                      Filter: (id = $3)
5097          ->  Nested Loop
5098                ->  Nested Loop
5099                      ->  Index Only Scan using t1_pkey on t1 t1_3
5100                            Index Cond: (id = $3)
5101                      ->  Index Only Scan using t2_pkey on t2 t2_3
5102                            Index Cond: (id = $3)
5103                ->  Seq Scan on t3 t3_3
5104                      Filter: (id = $3)
5105    ->  Aggregate
5106          Filter: (max(t1_5.id) = $3)
5107          ->  Merge Join
5108                Merge Cond: (t1_5.id = t3_5.id)
5109                ->  Nested Loop
5110                      ->  Index Only Scan using t2_pkey on t2 t2_5
5111                      ->  Index Only Scan using t1_pkey on t1 t1_5
5112                            Index Cond: (id = t2_5.id)
5113                ->  Sort
5114                      Sort Key: t3_5.id
5115                      ->  Seq Scan on t3 t3_5
5116 (51 rows)
5117
5118 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)*/
5119 EXPLAIN (COSTS false)
5120 WITH c1_1(id) AS (
5121 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
5122 )
5123 SELECT t1_1.id, (
5124 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
5125 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
5126 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
5127 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
5128 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
5129 );
5130 LOG:  pg_hint_plan:
5131 used hint:
5132 HashJoin(t1_1 t3_1)
5133 NestLoop(t1_2 t2_2)
5134 MergeJoin(t1_3 t3_3)
5135 NestLoop(t1_4 t2_4)
5136 NestLoop(t1_5 t2_5)
5137 not used hint:
5138 Leading(a t3_2 t3_5 t2_2 c1_1 t3_4 t3_3 t2_3 t2_4 t1_3 t2_5 t1_2 t3_1 t1_4 t2_1 t1_5 t1_1)
5139 duplication hint:
5140 error hint:
5141
5142                              QUERY PLAN                             
5143 --------------------------------------------------------------------
5144  Nested Loop
5145    InitPlan 1 (returns $1)
5146      ->  Aggregate
5147            ->  Merge Join
5148                  Merge Cond: (t1_2.id = t3_2.id)
5149                  ->  Nested Loop
5150                        ->  Index Only Scan using t2_pkey on t2 t2_2
5151                        ->  Index Only Scan using t1_pkey on t1 t1_2
5152                              Index Cond: (id = t2_2.id)
5153                  ->  Sort
5154                        Sort Key: t3_2.id
5155                        ->  Seq Scan on t3 t3_2
5156    InitPlan 2 (returns $3)
5157      ->  Aggregate
5158            ->  Merge Join
5159                  Merge Cond: (t1_4.id = t3_4.id)
5160                  ->  Nested Loop
5161                        ->  Index Only Scan using t2_pkey on t2 t2_4
5162                        ->  Index Only Scan using t1_pkey on t1 t1_4
5163                              Index Cond: (id = t2_4.id)
5164                  ->  Sort
5165                        Sort Key: t3_4.id
5166                        ->  Seq Scan on t3 t3_4
5167    ->  Nested Loop
5168          ->  Nested Loop
5169                ->  Nested Loop
5170                      ->  Index Only Scan using t1_pkey on t1 t1_1
5171                            Index Cond: (id = $3)
5172                      ->  Index Only Scan using t2_pkey on t2 t2_1
5173                            Index Cond: (id = $3)
5174                ->  Seq Scan on t3 t3_1
5175                      Filter: (id = $3)
5176          ->  Nested Loop
5177                ->  Nested Loop
5178                      ->  Index Only Scan using t1_pkey on t1 t1_3
5179                            Index Cond: (id = $3)
5180                      ->  Index Only Scan using t2_pkey on t2 t2_3
5181                            Index Cond: (id = $3)
5182                ->  Seq Scan on t3 t3_3
5183                      Filter: (id = $3)
5184    ->  Aggregate
5185          Filter: (max(t1_5.id) = $3)
5186          ->  Merge Join
5187                Merge Cond: (t1_5.id = t3_5.id)
5188                ->  Nested Loop
5189                      ->  Index Only Scan using t2_pkey on t2 t2_5
5190                      ->  Index Only Scan using t1_pkey on t1 t1_5
5191                            Index Cond: (id = t2_5.id)
5192                ->  Sort
5193                      Sort Key: t3_5.id
5194                      ->  Seq Scan on t3 t3_5
5195 (51 rows)
5196
5197 /*+HashJoin(t1_1 t3_1)MergeJoin(t1_3 t3_3)NestLoop(t1_2 t2_2)NestLoop(t1_4 t2_4)NestLoop(t1_5 t2_5)Leading(t3_5 t2_5 t1_5)Leading(t3_2 t2_2 t1_2)Leading(t3_4 t2_4 t1_4)Leading(c1_1 t3_3 t2_3 t1_3 t3_1 t2_1 t1_1)*/
5198 EXPLAIN (COSTS false)
5199 WITH c1_1(id) AS (
5200 SELECT max(t1_5.id) FROM t1 t1_5, t2 t2_5, t3 t3_5 WHERE t1_5.id = t2_5.id AND t2_5.id = t3_5.id
5201 )
5202 SELECT t1_1.id, (
5203 SELECT max(t1_2.id) FROM t1 t1_2, t2 t2_2, t3 t3_2 WHERE t1_2.id = t2_2.id AND t2_2.id = t3_2.id
5204 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
5205 SELECT t1_3.id FROM t1 t1_3, t2 t2_3, t3 t3_3 WHERE t1_3.id = t2_3.id AND t2_3.id = t3_3.id
5206 ) v1_1(id), c1_1 WHERE t1_1.id = t2_1.id AND t2_1.id = t3_1.id AND t2_1.id = v1_1.id AND v1_1.id = c1_1.id AND t1_1.id = (
5207 SELECT max(t1_4.id) FROM t1 t1_4, t2 t2_4, t3 t3_4 WHERE t1_4.id = t2_4.id AND t2_4.id = t3_4.id 
5208 );
5209 LOG:  pg_hint_plan:
5210 used hint:
5211 MergeJoin(t1_3 t3_3)
5212 Leading(t3_5 t2_5 t1_5)
5213 Leading(t3_2 t2_2 t1_2)
5214 Leading(t3_4 t2_4 t1_4)
5215 Leading(c1_1 t3_3 t2_3 t1_3 t3_1 t2_1 t1_1)
5216 not used hint:
5217 HashJoin(t1_1 t3_1)
5218 NestLoop(t1_2 t2_2)
5219 NestLoop(t1_4 t2_4)
5220 NestLoop(t1_5 t2_5)
5221 duplication hint:
5222 error hint:
5223
5224                                      QUERY PLAN                                     
5225 ------------------------------------------------------------------------------------
5226  Nested Loop
5227    InitPlan 1 (returns $0)
5228      ->  Aggregate
5229            ->  Merge Join
5230                  Merge Cond: (t2_2.id = t1_2.id)
5231                  ->  Merge Join
5232                        Merge Cond: (t2_2.id = t3_2.id)
5233                        ->  Index Only Scan using t2_pkey on t2 t2_2
5234                        ->  Sort
5235                              Sort Key: t3_2.id
5236                              ->  Seq Scan on t3 t3_2
5237                  ->  Index Only Scan using t1_pkey on t1 t1_2
5238    InitPlan 2 (returns $1)
5239      ->  Aggregate
5240            ->  Merge Join
5241                  Merge Cond: (t2_4.id = t1_4.id)
5242                  ->  Merge Join
5243                        Merge Cond: (t2_4.id = t3_4.id)
5244                        ->  Index Only Scan using t2_pkey on t2 t2_4
5245                        ->  Sort
5246                              Sort Key: t3_4.id
5247                              ->  Seq Scan on t3 t3_4
5248                  ->  Index Only Scan using t1_pkey on t1 t1_4
5249    ->  Nested Loop
5250          ->  Nested Loop
5251                ->  Nested Loop
5252                      ->  Nested Loop
5253                            ->  Nested Loop
5254                                  ->  Index Only Scan using t1_pkey on t1 t1_3
5255                                        Index Cond: (id = $1)
5256                                  ->  Index Only Scan using t2_pkey on t2 t2_3
5257                                        Index Cond: (id = $1)
5258                            ->  Seq Scan on t3 t3_3
5259                                  Filter: (id = $1)
5260                      ->  Aggregate
5261                            Filter: (max(t1_5.id) = $1)
5262                            ->  Merge Join
5263                                  Merge Cond: (t2_5.id = t1_5.id)
5264                                  ->  Merge Join
5265                                        Merge Cond: (t2_5.id = t3_5.id)
5266                                        ->  Index Only Scan using t2_pkey on t2 t2_5
5267                                        ->  Sort
5268                                              Sort Key: t3_5.id
5269                                              ->  Seq Scan on t3 t3_5
5270                                  ->  Index Only Scan using t1_pkey on t1 t1_5
5271                ->  Seq Scan on t3 t3_1
5272                      Filter: (id = $1)
5273          ->  Index Only Scan using t2_pkey on t2 t2_1
5274                Index Cond: (id = $1)
5275    ->  Index Only Scan using t1_pkey on t1 t1_1
5276          Index Cond: (id = $1)
5277 (51 rows)
5278
5279 -- ambigous error
5280 EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
5281                    QUERY PLAN                    
5282 -------------------------------------------------
5283  Merge Join
5284    Merge Cond: (t1.id = t2.id)
5285    ->  Merge Join
5286          Merge Cond: (t1.id = t1_1.id)
5287          ->  Index Scan using t1_pkey on t1
5288          ->  Index Scan using t1_pkey on t1 t1_1
5289    ->  Index Scan using t2_pkey on t2
5290 (7 rows)
5291
5292 /*+NestLoop(t1 t2)*/
5293 EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
5294 INFO:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t2)"
5295 DETAIL:  Relation name "t1" is ambiguous.
5296 LOG:  pg_hint_plan:
5297 used hint:
5298 not used hint:
5299 duplication hint:
5300 error hint:
5301 NestLoop(t1 t2)
5302
5303                    QUERY PLAN                    
5304 -------------------------------------------------
5305  Merge Join
5306    Merge Cond: (t1.id = t2.id)
5307    ->  Merge Join
5308          Merge Cond: (t1.id = t1_1.id)
5309          ->  Index Scan using t1_pkey on t1
5310          ->  Index Scan using t1_pkey on t1 t1_1
5311    ->  Index Scan using t2_pkey on t2
5312 (7 rows)
5313
5314 /*+Leading(t1 t2 t1)*/
5315 EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
5316 INFO:  pg_hint_plan: hint syntax error at or near "Leading(t1 t2 t1)"
5317 DETAIL:  Relation name "t1" is ambiguous.
5318 LOG:  pg_hint_plan:
5319 used hint:
5320 not used hint:
5321 duplication hint:
5322 error hint:
5323 Leading(t1 t2 t1)
5324
5325                    QUERY PLAN                    
5326 -------------------------------------------------
5327  Merge Join
5328    Merge Cond: (t1.id = t2.id)
5329    ->  Merge Join
5330          Merge Cond: (t1.id = t1_1.id)
5331          ->  Index Scan using t1_pkey on t1
5332          ->  Index Scan using t1_pkey on t1 t1_1
5333    ->  Index Scan using t2_pkey on t2
5334 (7 rows)
5335
5336 -- identifier length test
5337 EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
5338                                                   QUERY PLAN                                                  
5339 --------------------------------------------------------------------------------------------------------------
5340  Merge Join
5341    Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
5342    ->  Merge Join
5343          Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id)
5344          ->  Index Scan using t1_pkey on t1 "123456789012345678901234567890123456789012345678901234567890123"
5345          ->  Index Scan using t2_pkey on t2
5346    ->  Sort
5347          Sort Key: t3.id
5348          ->  Seq Scan on t3
5349 (9 rows)
5350
5351 /*+
5352 Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
5353 SeqScan(123456789012345678901234567890123456789012345678901234567890123)
5354 MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
5355 Set(123456789012345678901234567890123456789012345678901234567890123 1)
5356 */
5357 EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
5358 INFO:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5359 LOG:  pg_hint_plan:
5360 used hint:
5361 SeqScan(123456789012345678901234567890123456789012345678901234567890123)
5362 MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
5363 Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
5364 not used hint:
5365 duplication hint:
5366 error hint:
5367 Set(123456789012345678901234567890123456789012345678901234567890123 1)
5368
5369                                              QUERY PLAN                                             
5370 ----------------------------------------------------------------------------------------------------
5371  Merge Join
5372    Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
5373    ->  Merge Join
5374          Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
5375          ->  Index Scan using t2_pkey on t2
5376          ->  Sort
5377                Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
5378                ->  Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
5379    ->  Sort
5380          Sort Key: t3.id
5381          ->  Seq Scan on t3
5382 (11 rows)
5383
5384 /*+
5385 Leading(1234567890123456789012345678901234567890123456789012345678901234 t2 t3)
5386 SeqScan(1234567890123456789012345678901234567890123456789012345678901234)
5387 MergeJoin(1234567890123456789012345678901234567890123456789012345678901234 t2)
5388 Set(1234567890123456789012345678901234567890123456789012345678901234 1)
5389 Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
5390 */
5391 EXPLAIN (COSTS false) SELECT * FROM t1 "1234567890123456789012345678901234567890123456789012345678901234" JOIN t2 ON ("1234567890123456789012345678901234567890123456789012345678901234".id = t2.id) JOIN t3 ON (t2.id = t3.id);
5392 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5393 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5394 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5395 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5396 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5397 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5398 INFO:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5399 LOG:  pg_hint_plan:
5400 used hint:
5401 SeqScan(123456789012345678901234567890123456789012345678901234567890123)
5402 MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
5403 Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
5404 Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
5405 not used hint:
5406 duplication hint:
5407 error hint:
5408 Set(123456789012345678901234567890123456789012345678901234567890123 1)
5409
5410                                              QUERY PLAN                                             
5411 ----------------------------------------------------------------------------------------------------
5412  Merge Join
5413    Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
5414    ->  Merge Join
5415          Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
5416          ->  Index Scan using t2_pkey on t2
5417          ->  Sort
5418                Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
5419                ->  Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
5420    ->  Sort
5421          Sort Key: t3.id
5422          ->  Seq Scan on t3
5423 (11 rows)
5424
5425 SET "123456789012345678901234567890123456789012345678901234567890123" TO 1;
5426 ERROR:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5427 SET "1234567890123456789012345678901234567890123456789012345678901234" TO 1;
5428 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5429 ERROR:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5430 SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
5431 ERROR:  1.23457e+63 is outside the valid range for parameter "cursor_tuple_fraction" (0 .. 1)
5432 -- multi error
5433 /*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
5434 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
5435 INFO:  parameter "enable_seqscan" requires a Boolean value
5436 INFO:  invalid value for parameter "seq_page_cost": "on"
5437 LOG:  pg_hint_plan:
5438 used hint:
5439 not used hint:
5440 duplication hint:
5441 error hint:
5442 Set(enable_seqscan 100)
5443 Set(seq_page_cost on)
5444
5445               QUERY PLAN              
5446 --------------------------------------
5447  Merge Join
5448    Merge Cond: (t1.id = t2.id)
5449    ->  Index Scan using t1_pkey on t1
5450    ->  Index Scan using t2_pkey on t2
5451 (4 rows)
5452
5453 -- debug log of candidate index to use IndexScan
5454 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5455                                        QUERY PLAN                                       
5456 ----------------------------------------------------------------------------------------
5457  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
5458    Index Cond: (id = 1)
5459 (2 rows)
5460
5461 /*+IndexScan(t5 t5_id2)*/
5462 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5463 LOG:  available indexes for IndexScan(t5): t5_id2
5464 LOG:  pg_hint_plan:
5465 used hint:
5466 IndexScan(t5 t5_id2)
5467 not used hint:
5468 duplication hint:
5469 error hint:
5470
5471           QUERY PLAN           
5472 -------------------------------
5473  Index Scan using t5_id2 on t5
5474    Index Cond: (id = 1)
5475 (2 rows)
5476
5477 /*+IndexScan(t5 no_exist)*/
5478 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5479 LOG:  available indexes for IndexScan(t5):
5480 LOG:  pg_hint_plan:
5481 used hint:
5482 IndexScan(t5 no_exist)
5483 not used hint:
5484 duplication hint:
5485 error hint:
5486
5487      QUERY PLAN     
5488 --------------------
5489  Seq Scan on t5
5490    Filter: (id = 1)
5491 (2 rows)
5492
5493 /*+IndexScan(t5 t5_id1 t5_id2)*/
5494 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5495 LOG:  available indexes for IndexScan(t5): t5_id2 t5_id1
5496 LOG:  pg_hint_plan:
5497 used hint:
5498 IndexScan(t5 t5_id1 t5_id2)
5499 not used hint:
5500 duplication hint:
5501 error hint:
5502
5503           QUERY PLAN           
5504 -------------------------------
5505  Index Scan using t5_id2 on t5
5506    Index Cond: (id = 1)
5507 (2 rows)
5508
5509 /*+IndexScan(t5 no_exist t5_id2)*/
5510 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5511 LOG:  available indexes for IndexScan(t5): t5_id2
5512 LOG:  pg_hint_plan:
5513 used hint:
5514 IndexScan(t5 no_exist t5_id2)
5515 not used hint:
5516 duplication hint:
5517 error hint:
5518
5519           QUERY PLAN           
5520 -------------------------------
5521  Index Scan using t5_id2 on t5
5522    Index Cond: (id = 1)
5523 (2 rows)
5524
5525 /*+IndexScan(t5 no_exist5 no_exist2)*/
5526 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5527 LOG:  available indexes for IndexScan(t5):
5528 LOG:  pg_hint_plan:
5529 used hint:
5530 IndexScan(t5 no_exist5 no_exist2)
5531 not used hint:
5532 duplication hint:
5533 error hint:
5534
5535      QUERY PLAN     
5536 --------------------
5537  Seq Scan on t5
5538    Filter: (id = 1)
5539 (2 rows)
5540
5541 -- outer inner
5542 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5543                        QUERY PLAN                       
5544 --------------------------------------------------------
5545  Hash Join
5546    Hash Cond: (t3.val = t2.val)
5547    ->  Seq Scan on t3
5548    ->  Hash
5549          ->  Hash Join
5550                Hash Cond: (t2.id = t1.id)
5551                ->  Seq Scan on t2
5552                ->  Hash
5553                      ->  Index Scan using t1_pkey on t1
5554                            Index Cond: (id < 10)
5555 (10 rows)
5556
5557 /*+Leading((t1))*/
5558 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5559 INFO:  pg_hint_plan: hint syntax error at or near "Leading((t1))"
5560 DETAIL:  Leading hint requires two sets of relations when parentheses nests.
5561 LOG:  pg_hint_plan:
5562 used hint:
5563 not used hint:
5564 duplication hint:
5565 error hint:
5566 Leading((t1))
5567
5568                        QUERY PLAN                       
5569 --------------------------------------------------------
5570  Hash Join
5571    Hash Cond: (t3.val = t2.val)
5572    ->  Seq Scan on t3
5573    ->  Hash
5574          ->  Hash Join
5575                Hash Cond: (t2.id = t1.id)
5576                ->  Seq Scan on t2
5577                ->  Hash
5578                      ->  Index Scan using t1_pkey on t1
5579                            Index Cond: (id < 10)
5580 (10 rows)
5581
5582 /*+Leading((t1 t2))*/
5583 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5584 LOG:  pg_hint_plan:
5585 used hint:
5586 Leading((t1 t2))
5587 not used hint:
5588 duplication hint:
5589 error hint:
5590
5591                  QUERY PLAN                 
5592 --------------------------------------------
5593  Nested Loop
5594    Join Filter: (t2.val = t3.val)
5595    ->  Hash Join
5596          Hash Cond: (t1.id = t2.id)
5597          ->  Index Scan using t1_pkey on t1
5598                Index Cond: (id < 10)
5599          ->  Hash
5600                ->  Seq Scan on t2
5601    ->  Seq Scan on t3
5602 (9 rows)
5603
5604 /*+Leading((t1 t2 t3))*/
5605 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5606 INFO:  pg_hint_plan: hint syntax error at or near "Leading((t1 t2 t3))"
5607 DETAIL:  Leading hint requires two sets of relations when parentheses nests.
5608 LOG:  pg_hint_plan:
5609 used hint:
5610 not used hint:
5611 duplication hint:
5612 error hint:
5613 Leading((t1 t2 t3))
5614
5615                        QUERY PLAN                       
5616 --------------------------------------------------------
5617  Hash Join
5618    Hash Cond: (t3.val = t2.val)
5619    ->  Seq Scan on t3
5620    ->  Hash
5621          ->  Hash Join
5622                Hash Cond: (t2.id = t1.id)
5623                ->  Seq Scan on t2
5624                ->  Hash
5625                      ->  Index Scan using t1_pkey on t1
5626                            Index Cond: (id < 10)
5627 (10 rows)
5628
5629 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.id < 10;
5630                  QUERY PLAN                 
5631 --------------------------------------------
5632  Hash Join
5633    Hash Cond: (t2.id = t1.id)
5634    ->  Seq Scan on t2
5635    ->  Hash
5636          ->  Index Scan using t1_pkey on t1
5637                Index Cond: (id < 10)
5638 (6 rows)
5639
5640 /*+Leading((t1 t2))*/
5641 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.id < 10;
5642 LOG:  pg_hint_plan:
5643 used hint:
5644 Leading((t1 t2))
5645 not used hint:
5646 duplication hint:
5647 error hint:
5648
5649               QUERY PLAN              
5650 --------------------------------------
5651  Hash Join
5652    Hash Cond: (t1.id = t2.id)
5653    ->  Index Scan using t1_pkey on t1
5654          Index Cond: (id < 10)
5655    ->  Hash
5656          ->  Seq Scan on t2
5657 (6 rows)
5658
5659 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5660                        QUERY PLAN                       
5661 --------------------------------------------------------
5662  Hash Join
5663    Hash Cond: (t3.val = t2.val)
5664    ->  Seq Scan on t3
5665    ->  Hash
5666          ->  Hash Join
5667                Hash Cond: (t2.id = t1.id)
5668                ->  Seq Scan on t2
5669                ->  Hash
5670                      ->  Index Scan using t1_pkey on t1
5671                            Index Cond: (id < 10)
5672 (10 rows)
5673
5674 /*+Leading(((t1 t2) t3))*/
5675 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5676 LOG:  pg_hint_plan:
5677 used hint:
5678 Leading(((t1 t2) t3))
5679 not used hint:
5680 duplication hint:
5681 error hint:
5682
5683                  QUERY PLAN                 
5684 --------------------------------------------
5685  Nested Loop
5686    Join Filter: (t2.val = t3.val)
5687    ->  Hash Join
5688          Hash Cond: (t1.id = t2.id)
5689          ->  Index Scan using t1_pkey on t1
5690                Index Cond: (id < 10)
5691          ->  Hash
5692                ->  Seq Scan on t2
5693    ->  Seq Scan on t3
5694 (9 rows)
5695
5696 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
5697                        QUERY PLAN                       
5698 --------------------------------------------------------
5699  Nested Loop
5700    ->  Merge Join
5701          Merge Cond: (t3.id = t4.id)
5702          ->  Nested Loop
5703                Join Filter: (t1.val = t3.val)
5704                ->  Index Scan using t3_pkey on t3
5705                ->  Materialize
5706                      ->  Index Scan using t1_pkey on t1
5707                            Index Cond: (id < 10)
5708          ->  Sort
5709                Sort Key: t4.id
5710                ->  Seq Scan on t4
5711    ->  Index Scan using t2_pkey on t2
5712          Index Cond: (id = t1.id)
5713 (14 rows)
5714
5715 /*+Leading((((t1 t2) t3) t4))*/
5716 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
5717 LOG:  pg_hint_plan:
5718 used hint:
5719 Leading((((t1 t2) t3) t4))
5720 not used hint:
5721 duplication hint:
5722 error hint:
5723
5724                     QUERY PLAN                    
5725 --------------------------------------------------
5726  Nested Loop
5727    ->  Nested Loop
5728          Join Filter: (t1.val = t3.val)
5729          ->  Hash Join
5730                Hash Cond: (t1.id = t2.id)
5731                ->  Index Scan using t1_pkey on t1
5732                      Index Cond: (id < 10)
5733                ->  Hash
5734                      ->  Seq Scan on t2
5735          ->  Seq Scan on t3
5736    ->  Index Scan using t4_pkey on t4
5737          Index Cond: (id = t3.id)
5738 (12 rows)
5739
5740 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5741                        QUERY PLAN                       
5742 --------------------------------------------------------
5743  Hash Join
5744    Hash Cond: (t3.val = t2.val)
5745    ->  Seq Scan on t3
5746    ->  Hash
5747          ->  Hash Join
5748                Hash Cond: (t2.id = t1.id)
5749                ->  Seq Scan on t2
5750                ->  Hash
5751                      ->  Index Scan using t1_pkey on t1
5752                            Index Cond: (id < 10)
5753 (10 rows)
5754
5755 /*+Leading(((t1 t2) t3))*/
5756 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5757 LOG:  pg_hint_plan:
5758 used hint:
5759 Leading(((t1 t2) t3))
5760 not used hint:
5761 duplication hint:
5762 error hint:
5763
5764                  QUERY PLAN                 
5765 --------------------------------------------
5766  Nested Loop
5767    Join Filter: (t2.val = t3.val)
5768    ->  Hash Join
5769          Hash Cond: (t1.id = t2.id)
5770          ->  Index Scan using t1_pkey on t1
5771                Index Cond: (id < 10)
5772          ->  Hash
5773                ->  Seq Scan on t2
5774    ->  Seq Scan on t3
5775 (9 rows)
5776
5777 /*+Leading((t1 (t2 t3)))*/
5778 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5779 LOG:  pg_hint_plan:
5780 used hint:
5781 Leading((t1 (t2 t3)))
5782 not used hint:
5783 duplication hint:
5784 error hint:
5785
5786                  QUERY PLAN                 
5787 --------------------------------------------
5788  Hash Join
5789    Hash Cond: (t1.id = t2.id)
5790    ->  Index Scan using t1_pkey on t1
5791          Index Cond: (id < 10)
5792    ->  Hash
5793          ->  Hash Join
5794                Hash Cond: (t2.val = t3.val)
5795                ->  Seq Scan on t2
5796                ->  Hash
5797                      ->  Seq Scan on t3
5798 (10 rows)
5799
5800 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
5801                        QUERY PLAN                       
5802 --------------------------------------------------------
5803  Nested Loop
5804    ->  Merge Join
5805          Merge Cond: (t3.id = t4.id)
5806          ->  Nested Loop
5807                Join Filter: (t1.val = t3.val)
5808                ->  Index Scan using t3_pkey on t3
5809                ->  Materialize
5810                      ->  Index Scan using t1_pkey on t1
5811                            Index Cond: (id < 10)
5812          ->  Sort
5813                Sort Key: t4.id
5814                ->  Seq Scan on t4
5815    ->  Index Scan using t2_pkey on t2
5816          Index Cond: (id = t1.id)
5817 (14 rows)
5818
5819 /*+Leading(((t1 t2) (t3 t4)))*/
5820 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
5821 LOG:  pg_hint_plan:
5822 used hint:
5823 Leading(((t1 t2) (t3 t4)))
5824 not used hint:
5825 duplication hint:
5826 error hint:
5827
5828                  QUERY PLAN                 
5829 --------------------------------------------
5830  Nested Loop
5831    Join Filter: (t1.val = t3.val)
5832    ->  Hash Join
5833          Hash Cond: (t1.id = t2.id)
5834          ->  Index Scan using t1_pkey on t1
5835                Index Cond: (id < 10)
5836          ->  Hash
5837                ->  Seq Scan on t2
5838    ->  Merge Join
5839          Merge Cond: (t3.id = t4.id)
5840          ->  Index Scan using t3_pkey on t3
5841          ->  Sort
5842                Sort Key: t4.id
5843                ->  Seq Scan on t4
5844 (14 rows)
5845
5846 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < ( SELECT t1_2.id FROM t1 t1_2, t2 t2_2 WHERE t1_2.id = t2_2.id AND t2_2.val > 100 ORDER BY t1_2.id LIMIT 1);
5847                              QUERY PLAN                             
5848 --------------------------------------------------------------------
5849  Hash Join
5850    Hash Cond: (t2.val = t3.val)
5851    InitPlan 1 (returns $1)
5852      ->  Limit
5853            ->  Sort
5854                  Sort Key: t1_2.id
5855                  ->  Nested Loop
5856                        ->  Index Scan using t2_val on t2 t2_2
5857                              Index Cond: (val > 100)
5858                        ->  Index Only Scan using t1_pkey on t1 t1_2
5859                              Index Cond: (id = t2_2.id)
5860    ->  Merge Join
5861          Merge Cond: (t1.id = t2.id)
5862          ->  Index Scan using t1_pkey on t1
5863                Index Cond: (id < $1)
5864          ->  Index Scan using t2_pkey on t2
5865    ->  Hash
5866          ->  Seq Scan on t3
5867 (18 rows)
5868
5869 /*+Leading(((t1 t2) t3)) Leading(((t3 t1) t2))*/
5870 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t1.val = t3.val AND t1.id < ( SELECT t1_2.id FROM t1 t1_2, t2 t2_2 WHERE t1_2.id = t2_2.id AND t2_2.val > 100 ORDER BY t1_2.id LIMIT 1);
5871 INFO:  pg_hint_plan: hint syntax error at or near "Leading(((t1 t2) t3)) Leading(((t3 t1) t2))"
5872 DETAIL:  Conflict leading hint.
5873 LOG:  pg_hint_plan:
5874 used hint:
5875 Leading(((t3 t1) t2))
5876 not used hint:
5877 duplication hint:
5878 Leading(((t1 t2) t3))
5879 error hint:
5880
5881                              QUERY PLAN                             
5882 --------------------------------------------------------------------
5883  Hash Join
5884    Hash Cond: (t1.id = t2.id)
5885    InitPlan 1 (returns $1)
5886      ->  Limit
5887            ->  Sort
5888                  Sort Key: t1_2.id
5889                  ->  Nested Loop
5890                        ->  Index Scan using t2_val on t2 t2_2
5891                              Index Cond: (val > 100)
5892                        ->  Index Only Scan using t1_pkey on t1 t1_2
5893                              Index Cond: (id = t2_2.id)
5894    ->  Hash Join
5895          Hash Cond: (t3.val = t1.val)
5896          ->  Seq Scan on t3
5897          ->  Hash
5898                ->  Index Scan using t1_pkey on t1
5899                      Index Cond: (id < $1)
5900    ->  Hash
5901          ->  Seq Scan on t2
5902 (19 rows)
5903
5904 /*+Leading(((t1 t2) t3)) Leading((t1_2 t2_2))*/
5905 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < ( SELECT t1_2.id FROM t1 t1_2, t2 t2_2 WHERE t1_2.id = t2_2.id AND t2_2.val > 100 ORDER BY t1_2.id LIMIT 1);
5906 LOG:  pg_hint_plan:
5907 used hint:
5908 Leading(((t1 t2) t3))
5909 Leading((t1_2 t2_2))
5910 not used hint:
5911 duplication hint:
5912 error hint:
5913
5914                           QUERY PLAN                          
5915 --------------------------------------------------------------
5916  Hash Join
5917    Hash Cond: (t2.val = t3.val)
5918    InitPlan 1 (returns $0)
5919      ->  Limit
5920            ->  Merge Join
5921                  Merge Cond: (t1_2.id = t2_2.id)
5922                  ->  Index Only Scan using t1_pkey on t1 t1_2
5923                  ->  Sort
5924                        Sort Key: t2_2.id
5925                        ->  Index Scan using t2_val on t2 t2_2
5926                              Index Cond: (val > 100)
5927    ->  Merge Join
5928          Merge Cond: (t1.id = t2.id)
5929          ->  Index Scan using t1_pkey on t1
5930                Index Cond: (id < $0)
5931          ->  Index Scan using t2_pkey on t2
5932    ->  Hash
5933          ->  Seq Scan on t3
5934 (18 rows)
5935
5936 /*+Leading(((((t1 t2) t3) t1_2) t2_2))*/
5937 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < ( SELECT t1_2.id FROM t1 t1_2, t2 t2_2 WHERE t1_2.id = t2_2.id AND t2_2.val > 100 ORDER BY t1_2.id LIMIT 1);
5938 LOG:  pg_hint_plan:
5939 used hint:
5940 not used hint:
5941 Leading(((((t1 t2) t3) t1_2) t2_2))
5942 duplication hint:
5943 error hint:
5944
5945                              QUERY PLAN                             
5946 --------------------------------------------------------------------
5947  Hash Join
5948    Hash Cond: (t2.val = t3.val)
5949    InitPlan 1 (returns $1)
5950      ->  Limit
5951            ->  Sort
5952                  Sort Key: t1_2.id
5953                  ->  Nested Loop
5954                        ->  Index Scan using t2_val on t2 t2_2
5955                              Index Cond: (val > 100)
5956                        ->  Index Only Scan using t1_pkey on t1 t1_2
5957                              Index Cond: (id = t2_2.id)
5958    ->  Merge Join
5959          Merge Cond: (t1.id = t2.id)
5960          ->  Index Scan using t1_pkey on t1
5961                Index Cond: (id < $1)
5962          ->  Index Scan using t2_pkey on t2
5963    ->  Hash
5964          ->  Seq Scan on t3
5965 (18 rows)
5966
5967 -- Specified outer/inner leading hint and join method hint at the same time
5968 /*+Leading(((t1 t2) t3))*/
5969 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5970 LOG:  pg_hint_plan:
5971 used hint:
5972 Leading(((t1 t2) t3))
5973 not used hint:
5974 duplication hint:
5975 error hint:
5976
5977                  QUERY PLAN                 
5978 --------------------------------------------
5979  Nested Loop
5980    Join Filter: (t2.val = t3.val)
5981    ->  Hash Join
5982          Hash Cond: (t1.id = t2.id)
5983          ->  Index Scan using t1_pkey on t1
5984                Index Cond: (id < 10)
5985          ->  Hash
5986                ->  Seq Scan on t2
5987    ->  Seq Scan on t3
5988 (9 rows)
5989
5990 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t2)*/
5991 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5992 LOG:  pg_hint_plan:
5993 used hint:
5994 MergeJoin(t1 t2)
5995 Leading(((t1 t2) t3))
5996 not used hint:
5997 duplication hint:
5998 error hint:
5999
6000                  QUERY PLAN                 
6001 --------------------------------------------
6002  Nested Loop
6003    Join Filter: (t2.val = t3.val)
6004    ->  Merge Join
6005          Merge Cond: (t1.id = t2.id)
6006          ->  Index Scan using t1_pkey on t1
6007                Index Cond: (id < 10)
6008          ->  Index Scan using t2_pkey on t2
6009    ->  Seq Scan on t3
6010 (8 rows)
6011
6012 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t2 t3)*/
6013 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6014 LOG:  pg_hint_plan:
6015 used hint:
6016 MergeJoin(t1 t2 t3)
6017 Leading(((t1 t2) t3))
6018 not used hint:
6019 duplication hint:
6020 error hint:
6021
6022                     QUERY PLAN                    
6023 --------------------------------------------------
6024  Merge Join
6025    Merge Cond: (t2.val = t3.val)
6026    ->  Sort
6027          Sort Key: t2.val
6028          ->  Hash Join
6029                Hash Cond: (t1.id = t2.id)
6030                ->  Index Scan using t1_pkey on t1
6031                      Index Cond: (id < 10)
6032                ->  Hash
6033                      ->  Seq Scan on t2
6034    ->  Sort
6035          Sort Key: t3.val
6036          ->  Seq Scan on t3
6037 (13 rows)
6038
6039 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t3)*/
6040 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6041 LOG:  pg_hint_plan:
6042 used hint:
6043 Leading(((t1 t2) t3))
6044 not used hint:
6045 MergeJoin(t1 t3)
6046 duplication hint:
6047 error hint:
6048
6049                  QUERY PLAN                 
6050 --------------------------------------------
6051  Nested Loop
6052    Join Filter: (t2.val = t3.val)
6053    ->  Hash Join
6054          Hash Cond: (t1.id = t2.id)
6055          ->  Index Scan using t1_pkey on t1
6056                Index Cond: (id < 10)
6057          ->  Hash
6058                ->  Seq Scan on t2
6059    ->  Seq Scan on t3
6060 (9 rows)
6061
6062 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
6063                        QUERY PLAN                       
6064 --------------------------------------------------------
6065  Nested Loop
6066    ->  Merge Join
6067          Merge Cond: (t3.id = t4.id)
6068          ->  Nested Loop
6069                Join Filter: (t1.val = t3.val)
6070                ->  Index Scan using t3_pkey on t3
6071                ->  Materialize
6072                      ->  Index Scan using t1_pkey on t1
6073                            Index Cond: (id < 10)
6074          ->  Sort
6075                Sort Key: t4.id
6076                ->  Seq Scan on t4
6077    ->  Index Scan using t2_pkey on t2
6078          Index Cond: (id = t1.id)
6079 (14 rows)
6080
6081 /*+Leading(((t1 t2) t3)) MergeJoin(t3 t4)*/
6082 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
6083 LOG:  pg_hint_plan:
6084 used hint:
6085 Leading(((t1 t2) t3))
6086 not used hint:
6087 MergeJoin(t3 t4)
6088 duplication hint:
6089 error hint:
6090
6091                     QUERY PLAN                    
6092 --------------------------------------------------
6093  Nested Loop
6094    Join Filter: (t3.id = t4.id)
6095    ->  Nested Loop
6096          Join Filter: (t1.val = t3.val)
6097          ->  Hash Join
6098                Hash Cond: (t1.id = t2.id)
6099                ->  Index Scan using t1_pkey on t1
6100                      Index Cond: (id < 10)
6101                ->  Hash
6102                      ->  Seq Scan on t2
6103          ->  Seq Scan on t3
6104    ->  Seq Scan on t4
6105 (12 rows)
6106
6107 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t2 t3 t4)*/
6108 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t3.id = t4.id AND t1.val = t3.val AND t1.id < 10;
6109 LOG:  pg_hint_plan:
6110 used hint:
6111 MergeJoin(t1 t2 t3 t4)
6112 Leading(((t1 t2) t3))
6113 not used hint:
6114 duplication hint:
6115 error hint:
6116
6117                        QUERY PLAN                       
6118 --------------------------------------------------------
6119  Merge Join
6120    Merge Cond: (t3.id = t4.id)
6121    ->  Sort
6122          Sort Key: t3.id
6123          ->  Nested Loop
6124                Join Filter: (t1.val = t3.val)
6125                ->  Hash Join
6126                      Hash Cond: (t1.id = t2.id)
6127                      ->  Index Scan using t1_pkey on t1
6128                            Index Cond: (id < 10)
6129                      ->  Hash
6130                            ->  Seq Scan on t2
6131                ->  Seq Scan on t3
6132    ->  Sort
6133          Sort Key: t4.id
6134          ->  Seq Scan on t4
6135 (16 rows)
6136
6137 /*+ Leading ( ( t1 ( t2 t3 ) ) ) */
6138 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6139 LOG:  pg_hint_plan:
6140 used hint:
6141 Leading((t1 (t2 t3)))
6142 not used hint:
6143 duplication hint:
6144 error hint:
6145
6146                  QUERY PLAN                 
6147 --------------------------------------------
6148  Hash Join
6149    Hash Cond: (t1.id = t2.id)
6150    ->  Index Scan using t1_pkey on t1
6151          Index Cond: (id < 10)
6152    ->  Hash
6153          ->  Hash Join
6154                Hash Cond: (t2.val = t3.val)
6155                ->  Seq Scan on t2
6156                ->  Hash
6157                      ->  Seq Scan on t3
6158 (10 rows)
6159
6160 /*+Leading((t1(t2 t3)))*/
6161 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6162 LOG:  pg_hint_plan:
6163 used hint:
6164 Leading((t1 (t2 t3)))
6165 not used hint:
6166 duplication hint:
6167 error hint:
6168
6169                  QUERY PLAN                 
6170 --------------------------------------------
6171  Hash Join
6172    Hash Cond: (t1.id = t2.id)
6173    ->  Index Scan using t1_pkey on t1
6174          Index Cond: (id < 10)
6175    ->  Hash
6176          ->  Hash Join
6177                Hash Cond: (t2.val = t3.val)
6178                ->  Seq Scan on t2
6179                ->  Hash
6180                      ->  Seq Scan on t3
6181 (10 rows)
6182
6183 /*+Leading(("t1(t2" "t3)"))*/
6184 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6185 LOG:  pg_hint_plan:
6186 used hint:
6187 not used hint:
6188 Leading(("t1(t2" "t3)"))
6189 duplication hint:
6190 error hint:
6191
6192                        QUERY PLAN                       
6193 --------------------------------------------------------
6194  Hash Join
6195    Hash Cond: (t3.val = t2.val)
6196    ->  Seq Scan on t3
6197    ->  Hash
6198          ->  Hash Join
6199                Hash Cond: (t2.id = t1.id)
6200                ->  Seq Scan on t2
6201                ->  Hash
6202                      ->  Index Scan using t1_pkey on t1
6203                            Index Cond: (id < 10)
6204 (10 rows)
6205
6206 /*+ Leading ( ( ( t1 t2 ) t3 ) ) */
6207 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6208 LOG:  pg_hint_plan:
6209 used hint:
6210 Leading(((t1 t2) t3))
6211 not used hint:
6212 duplication hint:
6213 error hint:
6214
6215                  QUERY PLAN                 
6216 --------------------------------------------
6217  Nested Loop
6218    Join Filter: (t2.val = t3.val)
6219    ->  Hash Join
6220          Hash Cond: (t1.id = t2.id)
6221          ->  Index Scan using t1_pkey on t1
6222                Index Cond: (id < 10)
6223          ->  Hash
6224                ->  Seq Scan on t2
6225    ->  Seq Scan on t3
6226 (9 rows)
6227
6228 /*+Leading(((t1 t2)t3))*/
6229 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6230 LOG:  pg_hint_plan:
6231 used hint:
6232 Leading(((t1 t2) t3))
6233 not used hint:
6234 duplication hint:
6235 error hint:
6236
6237                  QUERY PLAN                 
6238 --------------------------------------------
6239  Nested Loop
6240    Join Filter: (t2.val = t3.val)
6241    ->  Hash Join
6242          Hash Cond: (t1.id = t2.id)
6243          ->  Index Scan using t1_pkey on t1
6244                Index Cond: (id < 10)
6245          ->  Hash
6246                ->  Seq Scan on t2
6247    ->  Seq Scan on t3
6248 (9 rows)
6249
6250 /*+Leading(("(t1" "t2)t3"))*/
6251 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6252 LOG:  pg_hint_plan:
6253 used hint:
6254 not used hint:
6255 Leading(("(t1" "t2)t3"))
6256 duplication hint:
6257 error hint:
6258
6259                        QUERY PLAN                       
6260 --------------------------------------------------------
6261  Hash Join
6262    Hash Cond: (t3.val = t2.val)
6263    ->  Seq Scan on t3
6264    ->  Hash
6265          ->  Hash Join
6266                Hash Cond: (t2.id = t1.id)
6267                ->  Seq Scan on t2
6268                ->  Hash
6269                      ->  Index Scan using t1_pkey on t1
6270                            Index Cond: (id < 10)
6271 (10 rows)
6272
6273 /*+Leading((t1(t2(t3(t4 t5)))))*/
6274 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6275 LOG:  pg_hint_plan:
6276 used hint:
6277 Leading((t1 (t2 (t3 (t4 t5)))))
6278 not used hint:
6279 duplication hint:
6280 error hint:
6281
6282                                                             QUERY PLAN                                                            
6283 ----------------------------------------------------------------------------------------------------------------------------------
6284  Merge Join
6285    Merge Cond: (t1.id = t2.id)
6286    ->  Index Scan using t1_pkey on t1
6287    ->  Materialize
6288          ->  Merge Join
6289                Merge Cond: (t2.id = t3.id)
6290                ->  Index Scan using t2_pkey on t2
6291                ->  Materialize
6292                      ->  Merge Join
6293                            Merge Cond: (t3.id = t4.id)
6294                            ->  Index Scan using t3_pkey on t3
6295                            ->  Materialize
6296                                  ->  Merge Join
6297                                        Merge Cond: (t4.id = t5.id)
6298                                        ->  Index Scan using t4_pkey on t4
6299                                        ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6300 (16 rows)
6301
6302 /*+Leading((t5(t4(t3(t2 t1)))))*/
6303 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6304 LOG:  pg_hint_plan:
6305 used hint:
6306 Leading((t5 (t4 (t3 (t2 t1)))))
6307 not used hint:
6308 duplication hint:
6309 error hint:
6310
6311                                 QUERY PLAN                                
6312 --------------------------------------------------------------------------
6313  Hash Join
6314    Hash Cond: (t5.id = t1.id)
6315    ->  Seq Scan on t5
6316    ->  Hash
6317          ->  Merge Join
6318                Merge Cond: (t4.id = t1.id)
6319                ->  Sort
6320                      Sort Key: t4.id
6321                      ->  Seq Scan on t4
6322                ->  Materialize
6323                      ->  Merge Join
6324                            Merge Cond: (t3.id = t1.id)
6325                            ->  Sort
6326                                  Sort Key: t3.id
6327                                  ->  Seq Scan on t3
6328                            ->  Materialize
6329                                  ->  Merge Join
6330                                        Merge Cond: (t2.id = t1.id)
6331                                        ->  Index Scan using t2_pkey on t2
6332                                        ->  Index Scan using t1_pkey on t1
6333 (20 rows)
6334
6335 /*+Leading(((((t1 t2)t3)t4)t5))*/
6336 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6337 LOG:  pg_hint_plan:
6338 used hint:
6339 Leading(((((t1 t2) t3) t4) t5))
6340 not used hint:
6341 duplication hint:
6342 error hint:
6343
6344                                           QUERY PLAN                                          
6345 ----------------------------------------------------------------------------------------------
6346  Nested Loop
6347    ->  Merge Join
6348          Merge Cond: (t1.id = t4.id)
6349          ->  Merge Join
6350                Merge Cond: (t1.id = t3.id)
6351                ->  Merge Join
6352                      Merge Cond: (t1.id = t2.id)
6353                      ->  Index Scan using t1_pkey on t1
6354                      ->  Index Scan using t2_pkey on t2
6355                ->  Sort
6356                      Sort Key: t3.id
6357                      ->  Seq Scan on t3
6358          ->  Sort
6359                Sort Key: t4.id
6360                ->  Seq Scan on t4
6361    ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6362          Index Cond: (id = t1.id)
6363 (17 rows)
6364
6365 /*+Leading(((((t5 t4)t3)t2)t1))*/
6366 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6367 LOG:  pg_hint_plan:
6368 used hint:
6369 Leading(((((t5 t4) t3) t2) t1))
6370 not used hint:
6371 duplication hint:
6372 error hint:
6373
6374                                                    QUERY PLAN                                                   
6375 ----------------------------------------------------------------------------------------------------------------
6376  Nested Loop
6377    Join Filter: (t2.id = t1.id)
6378    ->  Nested Loop
6379          Join Filter: (t3.id = t2.id)
6380          ->  Merge Join
6381                Merge Cond: (t4.id = t3.id)
6382                ->  Merge Join
6383                      Merge Cond: (t5.id = t4.id)
6384                      ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6385                      ->  Sort
6386                            Sort Key: t4.id
6387                            ->  Seq Scan on t4
6388                ->  Index Scan using t3_pkey on t3
6389          ->  Index Scan using t2_pkey on t2
6390                Index Cond: (id = t5.id)
6391    ->  Index Scan using t1_pkey on t1
6392          Index Cond: (id = t5.id)
6393 (17 rows)
6394
6395 /*+Leading(((t1 t2)(t3(t4 t5))))*/
6396 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6397 LOG:  pg_hint_plan:
6398 used hint:
6399 Leading(((t1 t2) (t3 (t4 t5))))
6400 not used hint:
6401 duplication hint:
6402 error hint:
6403
6404                                                       QUERY PLAN                                                      
6405 ----------------------------------------------------------------------------------------------------------------------
6406  Merge Join
6407    Merge Cond: (t1.id = t3.id)
6408    ->  Merge Join
6409          Merge Cond: (t1.id = t2.id)
6410          ->  Index Scan using t1_pkey on t1
6411          ->  Index Scan using t2_pkey on t2
6412    ->  Materialize
6413          ->  Merge Join
6414                Merge Cond: (t3.id = t4.id)
6415                ->  Index Scan using t3_pkey on t3
6416                ->  Materialize
6417                      ->  Merge Join
6418                            Merge Cond: (t4.id = t5.id)
6419                            ->  Index Scan using t4_pkey on t4
6420                            ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6421 (15 rows)
6422
6423 /*+Leading(((t5 t4)(t3(t2 t1))))*/
6424 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6425 LOG:  pg_hint_plan:
6426 used hint:
6427 Leading(((t5 t4) (t3 (t2 t1))))
6428 not used hint:
6429 duplication hint:
6430 error hint:
6431
6432                                              QUERY PLAN                                             
6433 ----------------------------------------------------------------------------------------------------
6434  Merge Join
6435    Merge Cond: (t4.id = t1.id)
6436    ->  Merge Join
6437          Merge Cond: (t5.id = t4.id)
6438          ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6439          ->  Sort
6440                Sort Key: t4.id
6441                ->  Seq Scan on t4
6442    ->  Materialize
6443          ->  Merge Join
6444                Merge Cond: (t3.id = t1.id)
6445                ->  Sort
6446                      Sort Key: t3.id
6447                      ->  Seq Scan on t3
6448                ->  Materialize
6449                      ->  Merge Join
6450                            Merge Cond: (t2.id = t1.id)
6451                            ->  Index Scan using t2_pkey on t2
6452                            ->  Index Scan using t1_pkey on t1
6453 (19 rows)
6454
6455 /*+Leading((((t1 t2)t3)(t4 t5)))*/
6456 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6457 LOG:  pg_hint_plan:
6458 used hint:
6459 Leading((((t1 t2) t3) (t4 t5)))
6460 not used hint:
6461 duplication hint:
6462 error hint:
6463
6464                                                 QUERY PLAN                                                
6465 ----------------------------------------------------------------------------------------------------------
6466  Merge Join
6467    Merge Cond: (t1.id = t4.id)
6468    ->  Merge Join
6469          Merge Cond: (t1.id = t3.id)
6470          ->  Merge Join
6471                Merge Cond: (t1.id = t2.id)
6472                ->  Index Scan using t1_pkey on t1
6473                ->  Index Scan using t2_pkey on t2
6474          ->  Sort
6475                Sort Key: t3.id
6476                ->  Seq Scan on t3
6477    ->  Materialize
6478          ->  Merge Join
6479                Merge Cond: (t4.id = t5.id)
6480                ->  Index Scan using t4_pkey on t4
6481                ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6482 (16 rows)
6483
6484 /*+Leading((((t5 t4)t3)(t2 t1)))*/
6485 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4, t5 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id AND t1.id = t5.id;
6486 LOG:  pg_hint_plan:
6487 used hint:
6488 Leading((((t5 t4) t3) (t2 t1)))
6489 not used hint:
6490 duplication hint:
6491 error hint:
6492
6493                                                 QUERY PLAN                                                
6494 ----------------------------------------------------------------------------------------------------------
6495  Merge Join
6496    Merge Cond: (t3.id = t1.id)
6497    ->  Merge Join
6498          Merge Cond: (t4.id = t3.id)
6499          ->  Merge Join
6500                Merge Cond: (t5.id = t4.id)
6501                ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6502                ->  Sort
6503                      Sort Key: t4.id
6504                      ->  Seq Scan on t4
6505          ->  Index Scan using t3_pkey on t3
6506    ->  Materialize
6507          ->  Merge Join
6508                Merge Cond: (t2.id = t1.id)
6509                ->  Index Scan using t2_pkey on t2
6510                ->  Index Scan using t1_pkey on t1
6511 (16 rows)
6512
6513 -- inherite table test to specify the index's name
6514 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6515                               QUERY PLAN                               
6516 -----------------------------------------------------------------------
6517  Append
6518    ->  Seq Scan on p2 p2_1
6519          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6520    ->  Seq Scan on p2_c1 p2_2
6521          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6522    ->  Seq Scan on p2_c1_c1 p2_3
6523          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6524    ->  Seq Scan on p2_c1_c2 p2_4
6525          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6526 (9 rows)
6527
6528 /*+IndexScan(p2 p2_pkey)*/
6529 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6530 LOG:  available indexes for IndexScan(p2): p2_pkey
6531 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6532 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6533 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6534 LOG:  pg_hint_plan:
6535 used hint:
6536 IndexScan(p2 p2_pkey)
6537 not used hint:
6538 duplication hint:
6539 error hint:
6540
6541                       QUERY PLAN                       
6542 -------------------------------------------------------
6543  Append
6544    ->  Index Scan using p2_pkey on p2 p2_1
6545          Index Cond: ((id >= 50) AND (id <= 51))
6546          Filter: (ctid = '(1,1)'::tid)
6547    ->  Index Scan using p2_c1_pkey on p2_c1 p2_2
6548          Index Cond: ((id >= 50) AND (id <= 51))
6549          Filter: (ctid = '(1,1)'::tid)
6550    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1 p2_3
6551          Index Cond: ((id >= 50) AND (id <= 51))
6552          Filter: (ctid = '(1,1)'::tid)
6553    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2 p2_4
6554          Index Cond: ((id >= 50) AND (id <= 51))
6555          Filter: (ctid = '(1,1)'::tid)
6556 (13 rows)
6557
6558 /*+IndexScan(p2 p2_id_val_idx)*/
6559 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6560 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
6561 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
6562 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
6563 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
6564 LOG:  pg_hint_plan:
6565 used hint:
6566 IndexScan(p2 p2_id_val_idx)
6567 not used hint:
6568 duplication hint:
6569 error hint:
6570
6571                          QUERY PLAN                          
6572 -------------------------------------------------------------
6573  Append
6574    ->  Index Scan using p2_id_val_idx on p2 p2_1
6575          Index Cond: ((id >= 50) AND (id <= 51))
6576          Filter: (ctid = '(1,1)'::tid)
6577    ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
6578          Index Cond: ((id >= 50) AND (id <= 51))
6579          Filter: (ctid = '(1,1)'::tid)
6580    ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1 p2_3
6581          Index Cond: ((id >= 50) AND (id <= 51))
6582          Filter: (ctid = '(1,1)'::tid)
6583    ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2 p2_4
6584          Index Cond: ((id >= 50) AND (id <= 51))
6585          Filter: (ctid = '(1,1)'::tid)
6586 (13 rows)
6587
6588 /*+IndexScan(p2 p2_val_id_idx)*/
6589 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6590 LOG:  available indexes for IndexScan(p2): p2_val_id_idx
6591 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_id_idx
6592 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_id_idx
6593 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_id_idx
6594 LOG:  pg_hint_plan:
6595 used hint:
6596 IndexScan(p2 p2_val_id_idx)
6597 not used hint:
6598 duplication hint:
6599 error hint:
6600
6601                          QUERY PLAN                          
6602 -------------------------------------------------------------
6603  Append
6604    ->  Index Scan using p2_val_id_idx on p2 p2_1
6605          Index Cond: ((id >= 50) AND (id <= 51))
6606          Filter: (ctid = '(1,1)'::tid)
6607    ->  Index Scan using p2_c1_val_id_idx on p2_c1 p2_2
6608          Index Cond: ((id >= 50) AND (id <= 51))
6609          Filter: (ctid = '(1,1)'::tid)
6610    ->  Index Scan using p2_c1_c1_val_id_idx on p2_c1_c1 p2_3
6611          Index Cond: ((id >= 50) AND (id <= 51))
6612          Filter: (ctid = '(1,1)'::tid)
6613    ->  Index Scan using p2_c1_c2_val_id_idx on p2_c1_c2 p2_4
6614          Index Cond: ((id >= 50) AND (id <= 51))
6615          Filter: (ctid = '(1,1)'::tid)
6616 (13 rows)
6617
6618 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
6619                                        QUERY PLAN                                        
6620 -----------------------------------------------------------------------------------------
6621  Append
6622    ->  Seq Scan on p2 p2_1
6623          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6624    ->  Seq Scan on p2_c1 p2_2
6625          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6626    ->  Seq Scan on p2_c2 p2_3
6627          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6628    ->  Seq Scan on p2_c3 p2_4
6629          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6630    ->  Seq Scan on p2_c4 p2_5
6631          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6632    ->  Seq Scan on p2_c1_c1 p2_6
6633          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6634    ->  Seq Scan on p2_c1_c2 p2_7
6635          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6636    ->  Seq Scan on p2_c3_c1 p2_8
6637          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6638    ->  Seq Scan on p2_c3_c2 p2_9
6639          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6640 (19 rows)
6641
6642 -- Inhibit parallel exection to avoid interfaring the hint
6643 set max_parallel_workers_per_gather to 0;
6644 /*+ IndexScan(p2 p2_val)*/
6645 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
6646 LOG:  available indexes for IndexScan(p2):
6647 LOG:  available indexes for IndexScan(p2_c1):
6648 LOG:  available indexes for IndexScan(p2_c2):
6649 LOG:  available indexes for IndexScan(p2_c3):
6650 LOG:  available indexes for IndexScan(p2_c4):
6651 LOG:  available indexes for IndexScan(p2_c1_c1):
6652 LOG:  available indexes for IndexScan(p2_c1_c2):
6653 LOG:  available indexes for IndexScan(p2_c3_c1):
6654 LOG:  available indexes for IndexScan(p2_c3_c2):
6655 LOG:  pg_hint_plan:
6656 used hint:
6657 IndexScan(p2 p2_val)
6658 not used hint:
6659 duplication hint:
6660 error hint:
6661
6662                                        QUERY PLAN                                        
6663 -----------------------------------------------------------------------------------------
6664  Append
6665    ->  Seq Scan on p2 p2_1
6666          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6667    ->  Seq Scan on p2_c1 p2_2
6668          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6669    ->  Seq Scan on p2_c2 p2_3
6670          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6671    ->  Seq Scan on p2_c3 p2_4
6672          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6673    ->  Seq Scan on p2_c4 p2_5
6674          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6675    ->  Seq Scan on p2_c1_c1 p2_6
6676          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6677    ->  Seq Scan on p2_c1_c2 p2_7
6678          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6679    ->  Seq Scan on p2_c3_c1 p2_8
6680          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6681    ->  Seq Scan on p2_c3_c2 p2_9
6682          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6683 (19 rows)
6684
6685 /*+IndexScan(p2 p2_pkey)*/
6686 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6687 LOG:  available indexes for IndexScan(p2): p2_pkey
6688 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6689 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6690 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6691 LOG:  pg_hint_plan:
6692 used hint:
6693 IndexScan(p2 p2_pkey)
6694 not used hint:
6695 duplication hint:
6696 error hint:
6697
6698                       QUERY PLAN                       
6699 -------------------------------------------------------
6700  Append
6701    ->  Index Scan using p2_pkey on p2 p2_1
6702          Index Cond: ((id >= 50) AND (id <= 51))
6703          Filter: (ctid = '(1,1)'::tid)
6704    ->  Index Scan using p2_c1_pkey on p2_c1 p2_2
6705          Index Cond: ((id >= 50) AND (id <= 51))
6706          Filter: (ctid = '(1,1)'::tid)
6707    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1 p2_3
6708          Index Cond: ((id >= 50) AND (id <= 51))
6709          Filter: (ctid = '(1,1)'::tid)
6710    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2 p2_4
6711          Index Cond: ((id >= 50) AND (id <= 51))
6712          Filter: (ctid = '(1,1)'::tid)
6713 (13 rows)
6714
6715 /*+IndexScan(p2 p2_id2_val)*/
6716 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6717 LOG:  available indexes for IndexScan(p2): p2_id2_val
6718 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id2_val
6719 LOG:  available indexes for IndexScan(p2_c1_c1):
6720 LOG:  available indexes for IndexScan(p2_c1_c2):
6721 LOG:  pg_hint_plan:
6722 used hint:
6723 IndexScan(p2 p2_id2_val)
6724 not used hint:
6725 duplication hint:
6726 error hint:
6727
6728                               QUERY PLAN                               
6729 -----------------------------------------------------------------------
6730  Append
6731    ->  Index Scan using p2_id2_val on p2 p2_1
6732          Index Cond: ((id >= 50) AND (id <= 51))
6733          Filter: (ctid = '(1,1)'::tid)
6734    ->  Index Scan using p2_c1_id2_val on p2_c1 p2_2
6735          Index Cond: ((id >= 50) AND (id <= 51))
6736          Filter: (ctid = '(1,1)'::tid)
6737    ->  Seq Scan on p2_c1_c1 p2_3
6738          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6739    ->  Seq Scan on p2_c1_c2 p2_4
6740          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6741 (11 rows)
6742
6743 /*+IndexScan(p2 p2_val2_id)*/
6744 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6745 LOG:  available indexes for IndexScan(p2): p2_val2_id
6746 LOG:  available indexes for IndexScan(p2_c1):
6747 LOG:  available indexes for IndexScan(p2_c1_c1):
6748 LOG:  available indexes for IndexScan(p2_c1_c2):
6749 LOG:  pg_hint_plan:
6750 used hint:
6751 IndexScan(p2 p2_val2_id)
6752 not used hint:
6753 duplication hint:
6754 error hint:
6755
6756                               QUERY PLAN                               
6757 -----------------------------------------------------------------------
6758  Append
6759    ->  Index Scan using p2_val2_id on p2 p2_1
6760          Index Cond: ((id >= 50) AND (id <= 51))
6761          Filter: (ctid = '(1,1)'::tid)
6762    ->  Seq Scan on p2_c1 p2_2
6763          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6764    ->  Seq Scan on p2_c1_c1 p2_3
6765          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6766    ->  Seq Scan on p2_c1_c2 p2_4
6767          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6768 (10 rows)
6769
6770 /*+IndexScan(p2 p2_pkey)*/
6771 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6772 LOG:  available indexes for IndexScan(p2): p2_pkey
6773 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6774 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6775 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6776 LOG:  pg_hint_plan:
6777 used hint:
6778 IndexScan(p2 p2_pkey)
6779 not used hint:
6780 duplication hint:
6781 error hint:
6782
6783                       QUERY PLAN                       
6784 -------------------------------------------------------
6785  Append
6786    ->  Index Scan using p2_pkey on p2 p2_1
6787          Index Cond: ((id >= 50) AND (id <= 51))
6788          Filter: (ctid = '(1,1)'::tid)
6789    ->  Index Scan using p2_c1_pkey on p2_c1 p2_2
6790          Index Cond: ((id >= 50) AND (id <= 51))
6791          Filter: (ctid = '(1,1)'::tid)
6792    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1 p2_3
6793          Index Cond: ((id >= 50) AND (id <= 51))
6794          Filter: (ctid = '(1,1)'::tid)
6795    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2 p2_4
6796          Index Cond: ((id >= 50) AND (id <= 51))
6797          Filter: (ctid = '(1,1)'::tid)
6798 (13 rows)
6799
6800 /*+IndexScan(p2 p2_c1_id_val_idx)*/
6801 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6802 LOG:  available indexes for IndexScan(p2):
6803 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
6804 LOG:  available indexes for IndexScan(p2_c1_c1):
6805 LOG:  available indexes for IndexScan(p2_c1_c2):
6806 LOG:  pg_hint_plan:
6807 used hint:
6808 IndexScan(p2 p2_c1_id_val_idx)
6809 not used hint:
6810 duplication hint:
6811 error hint:
6812
6813                               QUERY PLAN                               
6814 -----------------------------------------------------------------------
6815  Append
6816    ->  Seq Scan on p2 p2_1
6817          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6818    ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
6819          Index Cond: ((id >= 50) AND (id <= 51))
6820          Filter: (ctid = '(1,1)'::tid)
6821    ->  Seq Scan on p2_c1_c1 p2_3
6822          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6823    ->  Seq Scan on p2_c1_c2 p2_4
6824          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6825 (10 rows)
6826
6827 /*+IndexScan(p2 no_exist)*/
6828 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6829 LOG:  available indexes for IndexScan(p2):
6830 LOG:  available indexes for IndexScan(p2_c1):
6831 LOG:  available indexes for IndexScan(p2_c1_c1):
6832 LOG:  available indexes for IndexScan(p2_c1_c2):
6833 LOG:  pg_hint_plan:
6834 used hint:
6835 IndexScan(p2 no_exist)
6836 not used hint:
6837 duplication hint:
6838 error hint:
6839
6840                               QUERY PLAN                               
6841 -----------------------------------------------------------------------
6842  Append
6843    ->  Seq Scan on p2 p2_1
6844          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6845    ->  Seq Scan on p2_c1 p2_2
6846          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6847    ->  Seq Scan on p2_c1_c1 p2_3
6848          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6849    ->  Seq Scan on p2_c1_c2 p2_4
6850          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6851 (9 rows)
6852
6853 /*+IndexScan(p2 p2_pkey p2_c1_id_val_idx)*/
6854 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6855 LOG:  available indexes for IndexScan(p2): p2_pkey
6856 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx p2_c1_pkey
6857 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6858 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6859 LOG:  pg_hint_plan:
6860 used hint:
6861 IndexScan(p2 p2_pkey p2_c1_id_val_idx)
6862 not used hint:
6863 duplication hint:
6864 error hint:
6865
6866                       QUERY PLAN                       
6867 -------------------------------------------------------
6868  Append
6869    ->  Index Scan using p2_pkey on p2 p2_1
6870          Index Cond: ((id >= 50) AND (id <= 51))
6871          Filter: (ctid = '(1,1)'::tid)
6872    ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
6873          Index Cond: ((id >= 50) AND (id <= 51))
6874          Filter: (ctid = '(1,1)'::tid)
6875    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1 p2_3
6876          Index Cond: ((id >= 50) AND (id <= 51))
6877          Filter: (ctid = '(1,1)'::tid)
6878    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2 p2_4
6879          Index Cond: ((id >= 50) AND (id <= 51))
6880          Filter: (ctid = '(1,1)'::tid)
6881 (13 rows)
6882
6883 /*+IndexScan(p2 p2_pkey no_exist)*/
6884 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6885 LOG:  available indexes for IndexScan(p2): p2_pkey
6886 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6887 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6888 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6889 LOG:  pg_hint_plan:
6890 used hint:
6891 IndexScan(p2 p2_pkey no_exist)
6892 not used hint:
6893 duplication hint:
6894 error hint:
6895
6896                       QUERY PLAN                       
6897 -------------------------------------------------------
6898  Append
6899    ->  Index Scan using p2_pkey on p2 p2_1
6900          Index Cond: ((id >= 50) AND (id <= 51))
6901          Filter: (ctid = '(1,1)'::tid)
6902    ->  Index Scan using p2_c1_pkey on p2_c1 p2_2
6903          Index Cond: ((id >= 50) AND (id <= 51))
6904          Filter: (ctid = '(1,1)'::tid)
6905    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1 p2_3
6906          Index Cond: ((id >= 50) AND (id <= 51))
6907          Filter: (ctid = '(1,1)'::tid)
6908    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2 p2_4
6909          Index Cond: ((id >= 50) AND (id <= 51))
6910          Filter: (ctid = '(1,1)'::tid)
6911 (13 rows)
6912
6913 /*+IndexScan(p2 p2_c1_id_val_idx no_exist)*/
6914 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6915 LOG:  available indexes for IndexScan(p2):
6916 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
6917 LOG:  available indexes for IndexScan(p2_c1_c1):
6918 LOG:  available indexes for IndexScan(p2_c1_c2):
6919 LOG:  pg_hint_plan:
6920 used hint:
6921 IndexScan(p2 p2_c1_id_val_idx no_exist)
6922 not used hint:
6923 duplication hint:
6924 error hint:
6925
6926                               QUERY PLAN                               
6927 -----------------------------------------------------------------------
6928  Append
6929    ->  Seq Scan on p2 p2_1
6930          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6931    ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
6932          Index Cond: ((id >= 50) AND (id <= 51))
6933          Filter: (ctid = '(1,1)'::tid)
6934    ->  Seq Scan on p2_c1_c1 p2_3
6935          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6936    ->  Seq Scan on p2_c1_c2 p2_4
6937          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6938 (10 rows)
6939
6940 /*+IndexScan(p2 p2_pkey p2_c1_id_val_idx no_exist)*/
6941 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6942 LOG:  available indexes for IndexScan(p2): p2_pkey
6943 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx p2_c1_pkey
6944 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6945 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6946 LOG:  pg_hint_plan:
6947 used hint:
6948 IndexScan(p2 p2_pkey p2_c1_id_val_idx no_exist)
6949 not used hint:
6950 duplication hint:
6951 error hint:
6952
6953                       QUERY PLAN                       
6954 -------------------------------------------------------
6955  Append
6956    ->  Index Scan using p2_pkey on p2 p2_1
6957          Index Cond: ((id >= 50) AND (id <= 51))
6958          Filter: (ctid = '(1,1)'::tid)
6959    ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
6960          Index Cond: ((id >= 50) AND (id <= 51))
6961          Filter: (ctid = '(1,1)'::tid)
6962    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1 p2_3
6963          Index Cond: ((id >= 50) AND (id <= 51))
6964          Filter: (ctid = '(1,1)'::tid)
6965    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2 p2_4
6966          Index Cond: ((id >= 50) AND (id <= 51))
6967          Filter: (ctid = '(1,1)'::tid)
6968 (13 rows)
6969
6970 /*+IndexScan(p2 p2_val_idx)*/
6971 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
6972 LOG:  available indexes for IndexScan(p2): p2_val_idx
6973 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_idx
6974 LOG:  available indexes for IndexScan(p2_c2): p2_c2_val_idx
6975 LOG:  available indexes for IndexScan(p2_c3): p2_c3_val_idx
6976 LOG:  available indexes for IndexScan(p2_c4): p2_c4_val_idx
6977 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_idx
6978 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_idx
6979 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_val_idx
6980 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_val_idx
6981 LOG:  pg_hint_plan:
6982 used hint:
6983 IndexScan(p2 p2_val_idx)
6984 not used hint:
6985 duplication hint:
6986 error hint:
6987
6988                             QUERY PLAN                             
6989 -------------------------------------------------------------------
6990  Append
6991    ->  Index Scan using p2_val_idx on p2 p2_1
6992          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
6993          Filter: (ctid = '(1,1)'::tid)
6994    ->  Index Scan using p2_c1_val_idx on p2_c1 p2_2
6995          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
6996          Filter: (ctid = '(1,1)'::tid)
6997    ->  Index Scan using p2_c2_val_idx on p2_c2 p2_3
6998          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
6999          Filter: (ctid = '(1,1)'::tid)
7000    ->  Index Scan using p2_c3_val_idx on p2_c3 p2_4
7001          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7002          Filter: (ctid = '(1,1)'::tid)
7003    ->  Index Scan using p2_c4_val_idx on p2_c4 p2_5
7004          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7005          Filter: (ctid = '(1,1)'::tid)
7006    ->  Index Scan using p2_c1_c1_val_idx on p2_c1_c1 p2_6
7007          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7008          Filter: (ctid = '(1,1)'::tid)
7009    ->  Index Scan using p2_c1_c2_val_idx on p2_c1_c2 p2_7
7010          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7011          Filter: (ctid = '(1,1)'::tid)
7012    ->  Index Scan using p2_c3_c1_val_idx on p2_c3_c1 p2_8
7013          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7014          Filter: (ctid = '(1,1)'::tid)
7015    ->  Index Scan using p2_c3_c2_val_idx on p2_c3_c2 p2_9
7016          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7017          Filter: (ctid = '(1,1)'::tid)
7018 (28 rows)
7019
7020 /*+IndexScan(p2 p2_expr)*/
7021 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
7022 LOG:  available indexes for IndexScan(p2): p2_expr
7023 LOG:  available indexes for IndexScan(p2_c1): p2_c1_expr_idx
7024 LOG:  available indexes for IndexScan(p2_c2): p2_c2_expr_idx
7025 LOG:  available indexes for IndexScan(p2_c3): p2_c3_expr_idx
7026 LOG:  available indexes for IndexScan(p2_c4): p2_c4_expr_idx
7027 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_expr_idx
7028 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_expr_idx
7029 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_expr_idx
7030 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_expr_idx
7031 LOG:  pg_hint_plan:
7032 used hint:
7033 IndexScan(p2 p2_expr)
7034 not used hint:
7035 duplication hint:
7036 error hint:
7037
7038                                        QUERY PLAN                                        
7039 -----------------------------------------------------------------------------------------
7040  Append
7041    ->  Seq Scan on p2 p2_1
7042          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7043    ->  Seq Scan on p2_c1 p2_2
7044          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7045    ->  Seq Scan on p2_c2 p2_3
7046          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7047    ->  Seq Scan on p2_c3 p2_4
7048          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7049    ->  Seq Scan on p2_c4 p2_5
7050          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7051    ->  Seq Scan on p2_c1_c1 p2_6
7052          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7053    ->  Seq Scan on p2_c1_c2 p2_7
7054          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7055    ->  Seq Scan on p2_c3_c1 p2_8
7056          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7057    ->  Seq Scan on p2_c3_c2 p2_9
7058          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7059 (19 rows)
7060
7061 /*+IndexScan(p2 p2_val_idx6)*/
7062 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
7063 LOG:  available indexes for IndexScan(p2): p2_val_idx6
7064 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_idx7
7065 LOG:  available indexes for IndexScan(p2_c2): p2_c2_val_idx7
7066 LOG:  available indexes for IndexScan(p2_c3): p2_c3_val_idx7
7067 LOG:  available indexes for IndexScan(p2_c4): p2_c4_val_idx7
7068 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_idx7
7069 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_idx7
7070 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_val_idx7
7071 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_val_idx7
7072 LOG:  pg_hint_plan:
7073 used hint:
7074 IndexScan(p2 p2_val_idx6)
7075 not used hint:
7076 duplication hint:
7077 error hint:
7078
7079                                        QUERY PLAN                                        
7080 -----------------------------------------------------------------------------------------
7081  Append
7082    ->  Seq Scan on p2 p2_1
7083          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7084    ->  Seq Scan on p2_c1 p2_2
7085          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7086    ->  Seq Scan on p2_c2 p2_3
7087          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7088    ->  Seq Scan on p2_c3 p2_4
7089          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7090    ->  Seq Scan on p2_c4 p2_5
7091          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7092    ->  Seq Scan on p2_c1_c1 p2_6
7093          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7094    ->  Seq Scan on p2_c1_c2 p2_7
7095          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7096    ->  Seq Scan on p2_c3_c1 p2_8
7097          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7098    ->  Seq Scan on p2_c3_c2 p2_9
7099          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7100 (19 rows)
7101
7102 /*+IndexScan(p2 p2_val_idx p2_val_idx6)*/
7103 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
7104 LOG:  available indexes for IndexScan(p2): p2_val_idx6 p2_val_idx
7105 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_idx7 p2_c1_val_idx
7106 LOG:  available indexes for IndexScan(p2_c2): p2_c2_val_idx7 p2_c2_val_idx
7107 LOG:  available indexes for IndexScan(p2_c3): p2_c3_val_idx7 p2_c3_val_idx
7108 LOG:  available indexes for IndexScan(p2_c4): p2_c4_val_idx7 p2_c4_val_idx
7109 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_idx7 p2_c1_c1_val_idx
7110 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_idx7 p2_c1_c2_val_idx
7111 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_val_idx7 p2_c3_c1_val_idx
7112 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_val_idx7 p2_c3_c2_val_idx
7113 LOG:  pg_hint_plan:
7114 used hint:
7115 IndexScan(p2 p2_val_idx p2_val_idx6)
7116 not used hint:
7117 duplication hint:
7118 error hint:
7119
7120                             QUERY PLAN                             
7121 -------------------------------------------------------------------
7122  Append
7123    ->  Index Scan using p2_val_idx on p2 p2_1
7124          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7125          Filter: (ctid = '(1,1)'::tid)
7126    ->  Index Scan using p2_c1_val_idx on p2_c1 p2_2
7127          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7128          Filter: (ctid = '(1,1)'::tid)
7129    ->  Index Scan using p2_c2_val_idx on p2_c2 p2_3
7130          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7131          Filter: (ctid = '(1,1)'::tid)
7132    ->  Index Scan using p2_c3_val_idx on p2_c3 p2_4
7133          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7134          Filter: (ctid = '(1,1)'::tid)
7135    ->  Index Scan using p2_c4_val_idx on p2_c4 p2_5
7136          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7137          Filter: (ctid = '(1,1)'::tid)
7138    ->  Index Scan using p2_c1_c1_val_idx on p2_c1_c1 p2_6
7139          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7140          Filter: (ctid = '(1,1)'::tid)
7141    ->  Index Scan using p2_c1_c2_val_idx on p2_c1_c2 p2_7
7142          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7143          Filter: (ctid = '(1,1)'::tid)
7144    ->  Index Scan using p2_c3_c1_val_idx on p2_c3_c1 p2_8
7145          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7146          Filter: (ctid = '(1,1)'::tid)
7147    ->  Index Scan using p2_c3_c2_val_idx on p2_c3_c2 p2_9
7148          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7149          Filter: (ctid = '(1,1)'::tid)
7150 (28 rows)
7151
7152 -- regular expression
7153 -- ordinary table
7154 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7155                                          QUERY PLAN                                          
7156 ---------------------------------------------------------------------------------------------
7157  Index Only Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
7158    Index Cond: (id = 1)
7159 (2 rows)
7160
7161 /*+ IndexScanRegexp(t5 t5_[^i].*)*/
7162 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7163 LOG:  available indexes for IndexScanRegexp(t5): t5_val t5_pkey
7164 LOG:  pg_hint_plan:
7165 used hint:
7166 IndexScanRegexp(t5 t5_[^i].*)
7167 not used hint:
7168 duplication hint:
7169 error hint:
7170
7171            QUERY PLAN           
7172 --------------------------------
7173  Index Scan using t5_pkey on t5
7174    Index Cond: (id = 1)
7175 (2 rows)
7176
7177 /*+ IndexScanRegexp(t5 t5_id[0-9].*)*/
7178 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7179 LOG:  available indexes for IndexScanRegexp(t5): t5_id3 t5_id2 t5_id1
7180 LOG:  pg_hint_plan:
7181 used hint:
7182 IndexScanRegexp(t5 t5_id[0-9].*)
7183 not used hint:
7184 duplication hint:
7185 error hint:
7186
7187           QUERY PLAN           
7188 -------------------------------
7189  Index Scan using t5_id3 on t5
7190    Index Cond: (id = 1)
7191 (2 rows)
7192
7193 /*+ IndexScanRegexp(t5 t5[^_].*)*/
7194 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7195 LOG:  available indexes for IndexScanRegexp(t5):
7196 LOG:  pg_hint_plan:
7197 used hint:
7198 IndexScanRegexp(t5 t5[^_].*)
7199 not used hint:
7200 duplication hint:
7201 error hint:
7202
7203      QUERY PLAN     
7204 --------------------
7205  Seq Scan on t5
7206    Filter: (id = 1)
7207 (2 rows)
7208
7209 /*+ IndexScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)*/
7210 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7211 LOG:  available indexes for IndexScanRegexp(t5):
7212 LOG:  pg_hint_plan:
7213 used hint:
7214 IndexScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)
7215 not used hint:
7216 duplication hint:
7217 error hint:
7218
7219      QUERY PLAN     
7220 --------------------
7221  Seq Scan on t5
7222    Filter: (id = 1)
7223 (2 rows)
7224
7225 /*+ IndexScan(t5 t5_id[0-9].*)*/
7226 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7227 LOG:  available indexes for IndexScan(t5):
7228 LOG:  pg_hint_plan:
7229 used hint:
7230 IndexScan(t5 t5_id[0-9].*)
7231 not used hint:
7232 duplication hint:
7233 error hint:
7234
7235      QUERY PLAN     
7236 --------------------
7237  Seq Scan on t5
7238    Filter: (id = 1)
7239 (2 rows)
7240
7241 /*+ IndexOnlyScanRegexp(t5 t5_[^i].*)*/
7242 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7243 LOG:  available indexes for IndexOnlyScanRegexp(t5): t5_val t5_pkey
7244 LOG:  pg_hint_plan:
7245 used hint:
7246 IndexOnlyScanRegexp(t5 t5_[^i].*)
7247 not used hint:
7248 duplication hint:
7249 error hint:
7250
7251              QUERY PLAN              
7252 -------------------------------------
7253  Index Only Scan using t5_pkey on t5
7254    Index Cond: (id = 1)
7255 (2 rows)
7256
7257 /*+ IndexOnlyScanRegexp(t5 t5_id[0-9].*)*/
7258 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7259 LOG:  available indexes for IndexOnlyScanRegexp(t5): t5_id3 t5_id2 t5_id1
7260 LOG:  pg_hint_plan:
7261 used hint:
7262 IndexOnlyScanRegexp(t5 t5_id[0-9].*)
7263 not used hint:
7264 duplication hint:
7265 error hint:
7266
7267              QUERY PLAN             
7268 ------------------------------------
7269  Index Only Scan using t5_id3 on t5
7270    Index Cond: (id = 1)
7271 (2 rows)
7272
7273 /*+ IndexOnlyScanRegexp(t5 t5[^_].*)*/
7274 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7275 LOG:  available indexes for IndexOnlyScanRegexp(t5):
7276 LOG:  pg_hint_plan:
7277 used hint:
7278 IndexOnlyScanRegexp(t5 t5[^_].*)
7279 not used hint:
7280 duplication hint:
7281 error hint:
7282
7283      QUERY PLAN     
7284 --------------------
7285  Seq Scan on t5
7286    Filter: (id = 1)
7287 (2 rows)
7288
7289 /*+ IndexOnlyScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)*/
7290 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7291 LOG:  available indexes for IndexOnlyScanRegexp(t5):
7292 LOG:  pg_hint_plan:
7293 used hint:
7294 IndexOnlyScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)
7295 not used hint:
7296 duplication hint:
7297 error hint:
7298
7299      QUERY PLAN     
7300 --------------------
7301  Seq Scan on t5
7302    Filter: (id = 1)
7303 (2 rows)
7304
7305 /*+ IndexOnlyScan(t5 t5_id[0-9].*)*/
7306 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7307 LOG:  available indexes for IndexOnlyScan(t5):
7308 LOG:  pg_hint_plan:
7309 used hint:
7310 IndexOnlyScan(t5 t5_id[0-9].*)
7311 not used hint:
7312 duplication hint:
7313 error hint:
7314
7315      QUERY PLAN     
7316 --------------------
7317  Seq Scan on t5
7318    Filter: (id = 1)
7319 (2 rows)
7320
7321 /*+ BitmapScanRegexp(t5 t5_[^i].*)*/
7322 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7323 LOG:  available indexes for BitmapScanRegexp(t5): t5_val t5_pkey
7324 LOG:  pg_hint_plan:
7325 used hint:
7326 BitmapScanRegexp(t5 t5_[^i].*)
7327 not used hint:
7328 duplication hint:
7329 error hint:
7330
7331              QUERY PLAN             
7332 ------------------------------------
7333  Bitmap Heap Scan on t5
7334    Recheck Cond: (id = 1)
7335    ->  Bitmap Index Scan on t5_pkey
7336          Index Cond: (id = 1)
7337 (4 rows)
7338
7339 /*+ BitmapScanRegexp(t5 t5_id[0-9].*)*/
7340 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7341 LOG:  available indexes for BitmapScanRegexp(t5): t5_id3 t5_id2 t5_id1
7342 LOG:  pg_hint_plan:
7343 used hint:
7344 BitmapScanRegexp(t5 t5_id[0-9].*)
7345 not used hint:
7346 duplication hint:
7347 error hint:
7348
7349             QUERY PLAN             
7350 -----------------------------------
7351  Bitmap Heap Scan on t5
7352    Recheck Cond: (id = 1)
7353    ->  Bitmap Index Scan on t5_id3
7354          Index Cond: (id = 1)
7355 (4 rows)
7356
7357 /*+ BitmapScanRegexp(t5 t5[^_].*)*/
7358 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7359 LOG:  available indexes for BitmapScanRegexp(t5):
7360 LOG:  pg_hint_plan:
7361 used hint:
7362 BitmapScanRegexp(t5 t5[^_].*)
7363 not used hint:
7364 duplication hint:
7365 error hint:
7366
7367      QUERY PLAN     
7368 --------------------
7369  Seq Scan on t5
7370    Filter: (id = 1)
7371 (2 rows)
7372
7373 /*+ BitmapScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)*/
7374 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7375 LOG:  available indexes for BitmapScanRegexp(t5):
7376 LOG:  pg_hint_plan:
7377 used hint:
7378 BitmapScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)
7379 not used hint:
7380 duplication hint:
7381 error hint:
7382
7383      QUERY PLAN     
7384 --------------------
7385  Seq Scan on t5
7386    Filter: (id = 1)
7387 (2 rows)
7388
7389 /*+ BitmapScan(t5 t5_id[0-9].*)*/
7390 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7391 LOG:  available indexes for BitmapScan(t5):
7392 LOG:  pg_hint_plan:
7393 used hint:
7394 BitmapScan(t5 t5_id[0-9].*)
7395 not used hint:
7396 duplication hint:
7397 error hint:
7398
7399      QUERY PLAN     
7400 --------------------
7401  Seq Scan on t5
7402    Filter: (id = 1)
7403 (2 rows)
7404
7405 -- Inheritance
7406 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7407            QUERY PLAN            
7408 ---------------------------------
7409  Append
7410    ->  Seq Scan on p1 p1_1
7411          Filter: (val = 1)
7412    ->  Seq Scan on p1_c1 p1_2
7413          Filter: (val = 1)
7414    ->  Seq Scan on p1_c2 p1_3
7415          Filter: (val = 1)
7416    ->  Seq Scan on p1_c3 p1_4
7417          Filter: (val = 1)
7418    ->  Seq Scan on p1_c4 p1_5
7419          Filter: (val = 1)
7420    ->  Seq Scan on p1_c1_c1 p1_6
7421          Filter: (val = 1)
7422    ->  Seq Scan on p1_c1_c2 p1_7
7423          Filter: (val = 1)
7424    ->  Seq Scan on p1_c3_c1 p1_8
7425          Filter: (val = 1)
7426    ->  Seq Scan on p1_c3_c2 p1_9
7427          Filter: (val = 1)
7428 (19 rows)
7429
7430 /*+ IndexScanRegexp(p1 p1_.*[^0-9]$)*/
7431 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7432 LOG:  available indexes for IndexScanRegexp(p1): p1_pkey
7433 LOG:  available indexes for IndexScanRegexp(p1_c1): p1_c1_pkey
7434 LOG:  available indexes for IndexScanRegexp(p1_c2): p1_c2_pkey
7435 LOG:  available indexes for IndexScanRegexp(p1_c3): p1_c3_pkey
7436 LOG:  available indexes for IndexScanRegexp(p1_c4): p1_c4_pkey
7437 LOG:  available indexes for IndexScanRegexp(p1_c1_c1): p1_c1_c1_pkey
7438 LOG:  available indexes for IndexScanRegexp(p1_c1_c2): p1_c1_c2_pkey
7439 LOG:  available indexes for IndexScanRegexp(p1_c3_c1): p1_c3_c1_pkey
7440 LOG:  available indexes for IndexScanRegexp(p1_c3_c2): p1_c3_c2_pkey
7441 LOG:  pg_hint_plan:
7442 used hint:
7443 IndexScanRegexp(p1 p1_.*[^0-9]$)
7444 not used hint:
7445 duplication hint:
7446 error hint:
7447
7448            QUERY PLAN            
7449 ---------------------------------
7450  Append
7451    ->  Seq Scan on p1 p1_1
7452          Filter: (val = 1)
7453    ->  Seq Scan on p1_c1 p1_2
7454          Filter: (val = 1)
7455    ->  Seq Scan on p1_c2 p1_3
7456          Filter: (val = 1)
7457    ->  Seq Scan on p1_c3 p1_4
7458          Filter: (val = 1)
7459    ->  Seq Scan on p1_c4 p1_5
7460          Filter: (val = 1)
7461    ->  Seq Scan on p1_c1_c1 p1_6
7462          Filter: (val = 1)
7463    ->  Seq Scan on p1_c1_c2 p1_7
7464          Filter: (val = 1)
7465    ->  Seq Scan on p1_c3_c1 p1_8
7466          Filter: (val = 1)
7467    ->  Seq Scan on p1_c3_c2 p1_9
7468          Filter: (val = 1)
7469 (19 rows)
7470
7471 /*+ IndexScanRegexp(p1 p1_.*val2.*)*/
7472 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7473 LOG:  available indexes for IndexScanRegexp(p1): p1_val2
7474 LOG:  available indexes for IndexScanRegexp(p1_c1): p1_c1_val2
7475 LOG:  available indexes for IndexScanRegexp(p1_c2): p1_c2_val2
7476 LOG:  available indexes for IndexScanRegexp(p1_c3): p1_c3_val2
7477 LOG:  available indexes for IndexScanRegexp(p1_c4): p1_c4_val2
7478 LOG:  available indexes for IndexScanRegexp(p1_c1_c1): p1_c1_c1_val2
7479 LOG:  available indexes for IndexScanRegexp(p1_c1_c2): p1_c1_c2_val2
7480 LOG:  available indexes for IndexScanRegexp(p1_c3_c1): p1_c3_c1_val2
7481 LOG:  available indexes for IndexScanRegexp(p1_c3_c2): p1_c3_c2_val2
7482 LOG:  pg_hint_plan:
7483 used hint:
7484 IndexScanRegexp(p1 p1_.*val2.*)
7485 not used hint:
7486 duplication hint:
7487 error hint:
7488
7489                       QUERY PLAN                       
7490 -------------------------------------------------------
7491  Append
7492    ->  Index Scan using p1_val2 on p1 p1_1
7493          Index Cond: (val = 1)
7494    ->  Index Scan using p1_c1_val2 on p1_c1 p1_2
7495          Index Cond: (val = 1)
7496    ->  Index Scan using p1_c2_val2 on p1_c2 p1_3
7497          Index Cond: (val = 1)
7498    ->  Index Scan using p1_c3_val2 on p1_c3 p1_4
7499          Index Cond: (val = 1)
7500    ->  Index Scan using p1_c4_val2 on p1_c4 p1_5
7501          Index Cond: (val = 1)
7502    ->  Index Scan using p1_c1_c1_val2 on p1_c1_c1 p1_6
7503          Index Cond: (val = 1)
7504    ->  Index Scan using p1_c1_c2_val2 on p1_c1_c2 p1_7
7505          Index Cond: (val = 1)
7506    ->  Index Scan using p1_c3_c1_val2 on p1_c3_c1 p1_8
7507          Index Cond: (val = 1)
7508    ->  Index Scan using p1_c3_c2_val2 on p1_c3_c2 p1_9
7509          Index Cond: (val = 1)
7510 (19 rows)
7511
7512 /*+ IndexScanRegexp(p1 p1[^_].*)*/
7513 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7514 LOG:  available indexes for IndexScanRegexp(p1):
7515 LOG:  available indexes for IndexScanRegexp(p1_c1):
7516 LOG:  available indexes for IndexScanRegexp(p1_c2):
7517 LOG:  available indexes for IndexScanRegexp(p1_c3):
7518 LOG:  available indexes for IndexScanRegexp(p1_c4):
7519 LOG:  available indexes for IndexScanRegexp(p1_c1_c1):
7520 LOG:  available indexes for IndexScanRegexp(p1_c1_c2):
7521 LOG:  available indexes for IndexScanRegexp(p1_c3_c1):
7522 LOG:  available indexes for IndexScanRegexp(p1_c3_c2):
7523 LOG:  pg_hint_plan:
7524 used hint:
7525 IndexScanRegexp(p1 p1[^_].*)
7526 not used hint:
7527 duplication hint:
7528 error hint:
7529
7530            QUERY PLAN            
7531 ---------------------------------
7532  Append
7533    ->  Seq Scan on p1 p1_1
7534          Filter: (val = 1)
7535    ->  Seq Scan on p1_c1 p1_2
7536          Filter: (val = 1)
7537    ->  Seq Scan on p1_c2 p1_3
7538          Filter: (val = 1)
7539    ->  Seq Scan on p1_c3 p1_4
7540          Filter: (val = 1)
7541    ->  Seq Scan on p1_c4 p1_5
7542          Filter: (val = 1)
7543    ->  Seq Scan on p1_c1_c1 p1_6
7544          Filter: (val = 1)
7545    ->  Seq Scan on p1_c1_c2 p1_7
7546          Filter: (val = 1)
7547    ->  Seq Scan on p1_c3_c1 p1_8
7548          Filter: (val = 1)
7549    ->  Seq Scan on p1_c3_c2 p1_9
7550          Filter: (val = 1)
7551 (19 rows)
7552
7553 /*+ IndexScan(p1 p1_.*val2.*)*/
7554 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7555 LOG:  available indexes for IndexScan(p1):
7556 LOG:  available indexes for IndexScan(p1_c1):
7557 LOG:  available indexes for IndexScan(p1_c2):
7558 LOG:  available indexes for IndexScan(p1_c3):
7559 LOG:  available indexes for IndexScan(p1_c4):
7560 LOG:  available indexes for IndexScan(p1_c1_c1):
7561 LOG:  available indexes for IndexScan(p1_c1_c2):
7562 LOG:  available indexes for IndexScan(p1_c3_c1):
7563 LOG:  available indexes for IndexScan(p1_c3_c2):
7564 LOG:  pg_hint_plan:
7565 used hint:
7566 IndexScan(p1 p1_.*val2.*)
7567 not used hint:
7568 duplication hint:
7569 error hint:
7570
7571            QUERY PLAN            
7572 ---------------------------------
7573  Append
7574    ->  Seq Scan on p1 p1_1
7575          Filter: (val = 1)
7576    ->  Seq Scan on p1_c1 p1_2
7577          Filter: (val = 1)
7578    ->  Seq Scan on p1_c2 p1_3
7579          Filter: (val = 1)
7580    ->  Seq Scan on p1_c3 p1_4
7581          Filter: (val = 1)
7582    ->  Seq Scan on p1_c4 p1_5
7583          Filter: (val = 1)
7584    ->  Seq Scan on p1_c1_c1 p1_6
7585          Filter: (val = 1)
7586    ->  Seq Scan on p1_c1_c2 p1_7
7587          Filter: (val = 1)
7588    ->  Seq Scan on p1_c3_c1 p1_8
7589          Filter: (val = 1)
7590    ->  Seq Scan on p1_c3_c2 p1_9
7591          Filter: (val = 1)
7592 (19 rows)
7593
7594 /*+ IndexOnlyScanRegexp(p1 p1_.*[^0-9]$)*/
7595 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7596 LOG:  available indexes for IndexOnlyScanRegexp(p1): p1_pkey
7597 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1): p1_c1_pkey
7598 LOG:  available indexes for IndexOnlyScanRegexp(p1_c2): p1_c2_pkey
7599 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3): p1_c3_pkey
7600 LOG:  available indexes for IndexOnlyScanRegexp(p1_c4): p1_c4_pkey
7601 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c1): p1_c1_c1_pkey
7602 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c2): p1_c1_c2_pkey
7603 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c1): p1_c3_c1_pkey
7604 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c2): p1_c3_c2_pkey
7605 LOG:  pg_hint_plan:
7606 used hint:
7607 IndexOnlyScanRegexp(p1 p1_.*[^0-9]$)
7608 not used hint:
7609 duplication hint:
7610 error hint:
7611
7612            QUERY PLAN            
7613 ---------------------------------
7614  Append
7615    ->  Seq Scan on p1 p1_1
7616          Filter: (val = 1)
7617    ->  Seq Scan on p1_c1 p1_2
7618          Filter: (val = 1)
7619    ->  Seq Scan on p1_c2 p1_3
7620          Filter: (val = 1)
7621    ->  Seq Scan on p1_c3 p1_4
7622          Filter: (val = 1)
7623    ->  Seq Scan on p1_c4 p1_5
7624          Filter: (val = 1)
7625    ->  Seq Scan on p1_c1_c1 p1_6
7626          Filter: (val = 1)
7627    ->  Seq Scan on p1_c1_c2 p1_7
7628          Filter: (val = 1)
7629    ->  Seq Scan on p1_c3_c1 p1_8
7630          Filter: (val = 1)
7631    ->  Seq Scan on p1_c3_c2 p1_9
7632          Filter: (val = 1)
7633 (19 rows)
7634
7635 /*+ IndexOnlyScanRegexp(p1 p1_.*val2.*)*/
7636 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7637 LOG:  available indexes for IndexOnlyScanRegexp(p1): p1_val2
7638 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1): p1_c1_val2
7639 LOG:  available indexes for IndexOnlyScanRegexp(p1_c2): p1_c2_val2
7640 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3): p1_c3_val2
7641 LOG:  available indexes for IndexOnlyScanRegexp(p1_c4): p1_c4_val2
7642 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c1): p1_c1_c1_val2
7643 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c2): p1_c1_c2_val2
7644 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c1): p1_c3_c1_val2
7645 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c2): p1_c3_c2_val2
7646 LOG:  pg_hint_plan:
7647 used hint:
7648 IndexOnlyScanRegexp(p1 p1_.*val2.*)
7649 not used hint:
7650 duplication hint:
7651 error hint:
7652
7653                          QUERY PLAN                         
7654 ------------------------------------------------------------
7655  Append
7656    ->  Index Only Scan using p1_val2 on p1 p1_1
7657          Index Cond: (val = 1)
7658    ->  Index Only Scan using p1_c1_val2 on p1_c1 p1_2
7659          Index Cond: (val = 1)
7660    ->  Index Only Scan using p1_c2_val2 on p1_c2 p1_3
7661          Index Cond: (val = 1)
7662    ->  Index Only Scan using p1_c3_val2 on p1_c3 p1_4
7663          Index Cond: (val = 1)
7664    ->  Index Only Scan using p1_c4_val2 on p1_c4 p1_5
7665          Index Cond: (val = 1)
7666    ->  Index Only Scan using p1_c1_c1_val2 on p1_c1_c1 p1_6
7667          Index Cond: (val = 1)
7668    ->  Index Only Scan using p1_c1_c2_val2 on p1_c1_c2 p1_7
7669          Index Cond: (val = 1)
7670    ->  Index Only Scan using p1_c3_c1_val2 on p1_c3_c1 p1_8
7671          Index Cond: (val = 1)
7672    ->  Index Only Scan using p1_c3_c2_val2 on p1_c3_c2 p1_9
7673          Index Cond: (val = 1)
7674 (19 rows)
7675
7676 /*+ IndexOnlyScanRegexp(p1 p1[^_].*)*/
7677 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7678 LOG:  available indexes for IndexOnlyScanRegexp(p1):
7679 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1):
7680 LOG:  available indexes for IndexOnlyScanRegexp(p1_c2):
7681 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3):
7682 LOG:  available indexes for IndexOnlyScanRegexp(p1_c4):
7683 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c1):
7684 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c2):
7685 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c1):
7686 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c2):
7687 LOG:  pg_hint_plan:
7688 used hint:
7689 IndexOnlyScanRegexp(p1 p1[^_].*)
7690 not used hint:
7691 duplication hint:
7692 error hint:
7693
7694            QUERY PLAN            
7695 ---------------------------------
7696  Append
7697    ->  Seq Scan on p1 p1_1
7698          Filter: (val = 1)
7699    ->  Seq Scan on p1_c1 p1_2
7700          Filter: (val = 1)
7701    ->  Seq Scan on p1_c2 p1_3
7702          Filter: (val = 1)
7703    ->  Seq Scan on p1_c3 p1_4
7704          Filter: (val = 1)
7705    ->  Seq Scan on p1_c4 p1_5
7706          Filter: (val = 1)
7707    ->  Seq Scan on p1_c1_c1 p1_6
7708          Filter: (val = 1)
7709    ->  Seq Scan on p1_c1_c2 p1_7
7710          Filter: (val = 1)
7711    ->  Seq Scan on p1_c3_c1 p1_8
7712          Filter: (val = 1)
7713    ->  Seq Scan on p1_c3_c2 p1_9
7714          Filter: (val = 1)
7715 (19 rows)
7716
7717 /*+ IndexOnlyScan(p1 p1_.*val2.*)*/
7718 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7719 LOG:  available indexes for IndexOnlyScan(p1):
7720 LOG:  available indexes for IndexOnlyScan(p1_c1):
7721 LOG:  available indexes for IndexOnlyScan(p1_c2):
7722 LOG:  available indexes for IndexOnlyScan(p1_c3):
7723 LOG:  available indexes for IndexOnlyScan(p1_c4):
7724 LOG:  available indexes for IndexOnlyScan(p1_c1_c1):
7725 LOG:  available indexes for IndexOnlyScan(p1_c1_c2):
7726 LOG:  available indexes for IndexOnlyScan(p1_c3_c1):
7727 LOG:  available indexes for IndexOnlyScan(p1_c3_c2):
7728 LOG:  pg_hint_plan:
7729 used hint:
7730 IndexOnlyScan(p1 p1_.*val2.*)
7731 not used hint:
7732 duplication hint:
7733 error hint:
7734
7735            QUERY PLAN            
7736 ---------------------------------
7737  Append
7738    ->  Seq Scan on p1 p1_1
7739          Filter: (val = 1)
7740    ->  Seq Scan on p1_c1 p1_2
7741          Filter: (val = 1)
7742    ->  Seq Scan on p1_c2 p1_3
7743          Filter: (val = 1)
7744    ->  Seq Scan on p1_c3 p1_4
7745          Filter: (val = 1)
7746    ->  Seq Scan on p1_c4 p1_5
7747          Filter: (val = 1)
7748    ->  Seq Scan on p1_c1_c1 p1_6
7749          Filter: (val = 1)
7750    ->  Seq Scan on p1_c1_c2 p1_7
7751          Filter: (val = 1)
7752    ->  Seq Scan on p1_c3_c1 p1_8
7753          Filter: (val = 1)
7754    ->  Seq Scan on p1_c3_c2 p1_9
7755          Filter: (val = 1)
7756 (19 rows)
7757
7758 /*+ BitmapScanRegexp(p1 p1_.*[^0-9]$)*/
7759 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7760 LOG:  available indexes for BitmapScanRegexp(p1): p1_pkey
7761 LOG:  available indexes for BitmapScanRegexp(p1_c1): p1_c1_pkey
7762 LOG:  available indexes for BitmapScanRegexp(p1_c2): p1_c2_pkey
7763 LOG:  available indexes for BitmapScanRegexp(p1_c3): p1_c3_pkey
7764 LOG:  available indexes for BitmapScanRegexp(p1_c4): p1_c4_pkey
7765 LOG:  available indexes for BitmapScanRegexp(p1_c1_c1): p1_c1_c1_pkey
7766 LOG:  available indexes for BitmapScanRegexp(p1_c1_c2): p1_c1_c2_pkey
7767 LOG:  available indexes for BitmapScanRegexp(p1_c3_c1): p1_c3_c1_pkey
7768 LOG:  available indexes for BitmapScanRegexp(p1_c3_c2): p1_c3_c2_pkey
7769 LOG:  pg_hint_plan:
7770 used hint:
7771 BitmapScanRegexp(p1 p1_.*[^0-9]$)
7772 not used hint:
7773 duplication hint:
7774 error hint:
7775
7776            QUERY PLAN            
7777 ---------------------------------
7778  Append
7779    ->  Seq Scan on p1 p1_1
7780          Filter: (val = 1)
7781    ->  Seq Scan on p1_c1 p1_2
7782          Filter: (val = 1)
7783    ->  Seq Scan on p1_c2 p1_3
7784          Filter: (val = 1)
7785    ->  Seq Scan on p1_c3 p1_4
7786          Filter: (val = 1)
7787    ->  Seq Scan on p1_c4 p1_5
7788          Filter: (val = 1)
7789    ->  Seq Scan on p1_c1_c1 p1_6
7790          Filter: (val = 1)
7791    ->  Seq Scan on p1_c1_c2 p1_7
7792          Filter: (val = 1)
7793    ->  Seq Scan on p1_c3_c1 p1_8
7794          Filter: (val = 1)
7795    ->  Seq Scan on p1_c3_c2 p1_9
7796          Filter: (val = 1)
7797 (19 rows)
7798
7799 /*+ BitmapScanRegexp(p1 p1_.*val2.*)*/
7800 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7801 LOG:  available indexes for BitmapScanRegexp(p1): p1_val2
7802 LOG:  available indexes for BitmapScanRegexp(p1_c1): p1_c1_val2
7803 LOG:  available indexes for BitmapScanRegexp(p1_c2): p1_c2_val2
7804 LOG:  available indexes for BitmapScanRegexp(p1_c3): p1_c3_val2
7805 LOG:  available indexes for BitmapScanRegexp(p1_c4): p1_c4_val2
7806 LOG:  available indexes for BitmapScanRegexp(p1_c1_c1): p1_c1_c1_val2
7807 LOG:  available indexes for BitmapScanRegexp(p1_c1_c2): p1_c1_c2_val2
7808 LOG:  available indexes for BitmapScanRegexp(p1_c3_c1): p1_c3_c1_val2
7809 LOG:  available indexes for BitmapScanRegexp(p1_c3_c2): p1_c3_c2_val2
7810 LOG:  pg_hint_plan:
7811 used hint:
7812 BitmapScanRegexp(p1 p1_.*val2.*)
7813 not used hint:
7814 duplication hint:
7815 error hint:
7816
7817                    QUERY PLAN                   
7818 ------------------------------------------------
7819  Append
7820    ->  Bitmap Heap Scan on p1 p1_1
7821          Recheck Cond: (val = 1)
7822          ->  Bitmap Index Scan on p1_val2
7823                Index Cond: (val = 1)
7824    ->  Bitmap Heap Scan on p1_c1 p1_2
7825          Recheck Cond: (val = 1)
7826          ->  Bitmap Index Scan on p1_c1_val2
7827                Index Cond: (val = 1)
7828    ->  Bitmap Heap Scan on p1_c2 p1_3
7829          Recheck Cond: (val = 1)
7830          ->  Bitmap Index Scan on p1_c2_val2
7831                Index Cond: (val = 1)
7832    ->  Bitmap Heap Scan on p1_c3 p1_4
7833          Recheck Cond: (val = 1)
7834          ->  Bitmap Index Scan on p1_c3_val2
7835                Index Cond: (val = 1)
7836    ->  Bitmap Heap Scan on p1_c4 p1_5
7837          Recheck Cond: (val = 1)
7838          ->  Bitmap Index Scan on p1_c4_val2
7839                Index Cond: (val = 1)
7840    ->  Bitmap Heap Scan on p1_c1_c1 p1_6
7841          Recheck Cond: (val = 1)
7842          ->  Bitmap Index Scan on p1_c1_c1_val2
7843                Index Cond: (val = 1)
7844    ->  Bitmap Heap Scan on p1_c1_c2 p1_7
7845          Recheck Cond: (val = 1)
7846          ->  Bitmap Index Scan on p1_c1_c2_val2
7847                Index Cond: (val = 1)
7848    ->  Bitmap Heap Scan on p1_c3_c1 p1_8
7849          Recheck Cond: (val = 1)
7850          ->  Bitmap Index Scan on p1_c3_c1_val2
7851                Index Cond: (val = 1)
7852    ->  Bitmap Heap Scan on p1_c3_c2 p1_9
7853          Recheck Cond: (val = 1)
7854          ->  Bitmap Index Scan on p1_c3_c2_val2
7855                Index Cond: (val = 1)
7856 (37 rows)
7857
7858 /*+ BitmapScanRegexp(p1 p1[^_].*)*/
7859 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7860 LOG:  available indexes for BitmapScanRegexp(p1):
7861 LOG:  available indexes for BitmapScanRegexp(p1_c1):
7862 LOG:  available indexes for BitmapScanRegexp(p1_c2):
7863 LOG:  available indexes for BitmapScanRegexp(p1_c3):
7864 LOG:  available indexes for BitmapScanRegexp(p1_c4):
7865 LOG:  available indexes for BitmapScanRegexp(p1_c1_c1):
7866 LOG:  available indexes for BitmapScanRegexp(p1_c1_c2):
7867 LOG:  available indexes for BitmapScanRegexp(p1_c3_c1):
7868 LOG:  available indexes for BitmapScanRegexp(p1_c3_c2):
7869 LOG:  pg_hint_plan:
7870 used hint:
7871 BitmapScanRegexp(p1 p1[^_].*)
7872 not used hint:
7873 duplication hint:
7874 error hint:
7875
7876            QUERY PLAN            
7877 ---------------------------------
7878  Append
7879    ->  Seq Scan on p1 p1_1
7880          Filter: (val = 1)
7881    ->  Seq Scan on p1_c1 p1_2
7882          Filter: (val = 1)
7883    ->  Seq Scan on p1_c2 p1_3
7884          Filter: (val = 1)
7885    ->  Seq Scan on p1_c3 p1_4
7886          Filter: (val = 1)
7887    ->  Seq Scan on p1_c4 p1_5
7888          Filter: (val = 1)
7889    ->  Seq Scan on p1_c1_c1 p1_6
7890          Filter: (val = 1)
7891    ->  Seq Scan on p1_c1_c2 p1_7
7892          Filter: (val = 1)
7893    ->  Seq Scan on p1_c3_c1 p1_8
7894          Filter: (val = 1)
7895    ->  Seq Scan on p1_c3_c2 p1_9
7896          Filter: (val = 1)
7897 (19 rows)
7898
7899 /*+ BitmapScan(p1 p1_.*val2.*)*/
7900 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7901 LOG:  available indexes for BitmapScan(p1):
7902 LOG:  available indexes for BitmapScan(p1_c1):
7903 LOG:  available indexes for BitmapScan(p1_c2):
7904 LOG:  available indexes for BitmapScan(p1_c3):
7905 LOG:  available indexes for BitmapScan(p1_c4):
7906 LOG:  available indexes for BitmapScan(p1_c1_c1):
7907 LOG:  available indexes for BitmapScan(p1_c1_c2):
7908 LOG:  available indexes for BitmapScan(p1_c3_c1):
7909 LOG:  available indexes for BitmapScan(p1_c3_c2):
7910 LOG:  pg_hint_plan:
7911 used hint:
7912 BitmapScan(p1 p1_.*val2.*)
7913 not used hint:
7914 duplication hint:
7915 error hint:
7916
7917            QUERY PLAN            
7918 ---------------------------------
7919  Append
7920    ->  Seq Scan on p1 p1_1
7921          Filter: (val = 1)
7922    ->  Seq Scan on p1_c1 p1_2
7923          Filter: (val = 1)
7924    ->  Seq Scan on p1_c2 p1_3
7925          Filter: (val = 1)
7926    ->  Seq Scan on p1_c3 p1_4
7927          Filter: (val = 1)
7928    ->  Seq Scan on p1_c4 p1_5
7929          Filter: (val = 1)
7930    ->  Seq Scan on p1_c1_c1 p1_6
7931          Filter: (val = 1)
7932    ->  Seq Scan on p1_c1_c2 p1_7
7933          Filter: (val = 1)
7934    ->  Seq Scan on p1_c3_c1 p1_8
7935          Filter: (val = 1)
7936    ->  Seq Scan on p1_c3_c2 p1_9
7937          Filter: (val = 1)
7938 (19 rows)
7939
7940 -- search from hint table
7941 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints) VALUES ('EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;', '', 'SeqScan(t1)');
7942 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints) VALUES ('EXPLAIN (COSTS false) SELECT id FROM t1 WHERE t1.id = ?;', '', 'IndexScan(t1)');
7943 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints) VALUES ('EXPLAIN SELECT * FROM t1 WHERE t1.id = ?;', '', 'BitmapScan(t1)');
7944 SELECT * FROM hint_plan.hints ORDER BY id;
7945  id |                    norm_query_string                     | application_name |     hints      
7946 ----+----------------------------------------------------------+------------------+----------------
7947   1 | EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;  |                  | SeqScan(t1)
7948   2 | EXPLAIN (COSTS false) SELECT id FROM t1 WHERE t1.id = ?; |                  | IndexScan(t1)
7949   3 | EXPLAIN SELECT * FROM t1 WHERE t1.id = ?;                |                  | BitmapScan(t1)
7950 (3 rows)
7951
7952 SET pg_hint_plan.enable_hint_table = on;
7953 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1;
7954 LOG:  pg_hint_plan:
7955 used hint:
7956 SeqScan(t1)
7957 not used hint:
7958 duplication hint:
7959 error hint:
7960
7961      QUERY PLAN     
7962 --------------------
7963  Seq Scan on t1
7964    Filter: (id = 1)
7965 (2 rows)
7966
7967 SET pg_hint_plan.enable_hint_table = off;
7968 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1;
7969            QUERY PLAN           
7970 --------------------------------
7971  Index Scan using t1_pkey on t1
7972    Index Cond: (id = 1)
7973 (2 rows)
7974
7975 TRUNCATE hint_plan.hints;
7976 VACUUM ANALYZE hint_plan.hints;
7977 -- plpgsql test
7978 EXPLAIN (COSTS false) SELECT id FROM t1 WHERE t1.id = 1;
7979              QUERY PLAN              
7980 -------------------------------------
7981  Index Only Scan using t1_pkey on t1
7982    Index Cond: (id = 1)
7983 (2 rows)
7984
7985 -- static function
7986 CREATE FUNCTION testfunc() RETURNS RECORD AS $$
7987 DECLARE
7988   ret record;
7989 BEGIN
7990   SELECT /*+ SeqScan(t1) */ * INTO ret FROM t1 LIMIT 1;
7991   RETURN ret;
7992 END;
7993 $$ LANGUAGE plpgsql;
7994 SELECT testfunc();
7995 LOG:  pg_hint_plan:
7996 used hint:
7997 SeqScan(t1)
7998 not used hint:
7999 duplication hint:
8000 error hint:
8001
8002 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ *          FROM t1 LIMIT 1"
8003 PL/pgSQL function testfunc() line 5 at SQL statement
8004  testfunc 
8005 ----------
8006  (1,1)
8007 (1 row)
8008
8009 -- dynamic function
8010 DROP FUNCTION testfunc();
8011 CREATE FUNCTION testfunc() RETURNS void AS $$
8012 BEGIN
8013   EXECUTE format('/*+ SeqScan(t1) */ SELECT * FROM t1');
8014 END;
8015 $$ LANGUAGE plpgsql;
8016 SELECT testfunc();
8017 LOG:  pg_hint_plan:
8018 used hint:
8019 SeqScan(t1)
8020 not used hint:
8021 duplication hint:
8022 error hint:
8023
8024 CONTEXT:  SQL statement "/*+ SeqScan(t1) */ SELECT * FROM t1"
8025 PL/pgSQL function testfunc() line 3 at EXECUTE
8026  testfunc 
8027 ----------
8028  
8029 (1 row)
8030
8031 -- This should not use SeqScan(t1)
8032 /*+ IndexScan(t1) */ SELECT * from t1 LIMIT 1;
8033 LOG:  pg_hint_plan:
8034 used hint:
8035 IndexScan(t1)
8036 not used hint:
8037 duplication hint:
8038 error hint:
8039
8040  id | val 
8041 ----+-----
8042   1 |   1
8043 (1 row)
8044
8045 -- Perform
8046 DROP FUNCTION testfunc();
8047 CREATE FUNCTION testfunc() RETURNS void AS $$
8048 BEGIN
8049   PERFORM  1, /*+ SeqScan(t1) */ * from t1;
8050 END;
8051 $$ LANGUAGE plpgsql;
8052 SELECT testfunc();
8053 LOG:  pg_hint_plan:
8054 used hint:
8055 SeqScan(t1)
8056 not used hint:
8057 duplication hint:
8058 error hint:
8059
8060 CONTEXT:  SQL statement "SELECT 1, /*+ SeqScan(t1) */ * from t1"
8061 PL/pgSQL function testfunc() line 3 at PERFORM
8062  testfunc 
8063 ----------
8064  
8065 (1 row)
8066
8067 -- FOR loop
8068 DROP FUNCTION testfunc();
8069 CREATE FUNCTION testfunc() RETURNS int AS $$
8070 DECLARE
8071   sum int;
8072   v int;
8073 BEGIN
8074   sum := 0;
8075   FOR v IN SELECT /*+ SeqScan(t1) */ v FROM t1 ORDER BY id LOOP
8076     sum := sum + v;
8077   END LOOP;
8078   RETURN v;
8079 END;
8080 $$ LANGUAGE plpgsql;
8081 SELECT testfunc();
8082 LOG:  pg_hint_plan:
8083 used hint:
8084 SeqScan(t1)
8085 not used hint:
8086 duplication hint:
8087 error hint:
8088
8089 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ v FROM t1 ORDER BY id"
8090 PL/pgSQL function testfunc() line 7 at FOR over SELECT rows
8091  testfunc 
8092 ----------
8093          
8094 (1 row)
8095
8096 -- Dynamic FOR loop
8097 DROP FUNCTION testfunc();
8098 CREATE FUNCTION testfunc() RETURNS int AS $$
8099 DECLARE
8100   sum int;
8101   v int;
8102   i   int;
8103 BEGIN
8104   sum := 0;
8105   FOR v IN EXECUTE 'SELECT /*+ SeqScan(t1) */ val FROM t1 ORDER BY id' LOOP
8106     sum := sum + v;
8107   END LOOP;
8108   RETURN v;
8109 END;
8110 $$ LANGUAGE plpgsql;
8111 SELECT testfunc();
8112 LOG:  pg_hint_plan:
8113 used hint:
8114 SeqScan(t1)
8115 not used hint:
8116 duplication hint:
8117 error hint:
8118
8119 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ val FROM t1 ORDER BY id"
8120 PL/pgSQL function testfunc() line 8 at FOR over EXECUTE statement
8121  testfunc 
8122 ----------
8123         0
8124 (1 row)
8125
8126 -- Cursor FOR loop
8127 DROP FUNCTION testfunc();
8128 CREATE FUNCTION testfunc() RETURNS int AS $$
8129 DECLARE
8130   ref CURSOR FOR SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id;
8131   rec record;
8132   sum int := 0;
8133 BEGIN
8134   FOR rec IN ref LOOP
8135     sum := sum + rec.val;
8136   END LOOP;
8137   RETURN sum;
8138 END;
8139 $$ LANGUAGE plpgsql;
8140 SELECT testfunc();
8141 LOG:  pg_hint_plan:
8142 used hint:
8143 SeqScan(t1)
8144 not used hint:
8145 duplication hint:
8146 error hint:
8147
8148 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id"
8149 PL/pgSQL function testfunc() line 7 at FOR over cursor
8150  testfunc 
8151 ----------
8152    495000
8153 (1 row)
8154
8155 -- RETURN QUERY
8156 DROP FUNCTION testfunc();
8157 CREATE FUNCTION testfunc() RETURNS SETOF t1 AS $$
8158 BEGIN
8159   RETURN QUERY SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id;
8160 END;
8161 $$ LANGUAGE plpgsql;
8162 SELECT * FROM testfunc() LIMIT 1;
8163 LOG:  pg_hint_plan:
8164 used hint:
8165 SeqScan(t1)
8166 not used hint:
8167 duplication hint:
8168 error hint:
8169
8170 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id"
8171 PL/pgSQL function testfunc() line 3 at RETURN QUERY
8172  id | val 
8173 ----+-----
8174   1 |   1
8175 (1 row)
8176
8177 -- Test for error exit from inner SQL statement.
8178 DROP FUNCTION testfunc();
8179 CREATE FUNCTION testfunc() RETURNS SETOF t1 AS $$
8180 BEGIN
8181   RETURN QUERY SELECT /*+ SeqScan(t1) */ * FROM ttx ORDER BY id;
8182 END;
8183 $$ LANGUAGE plpgsql;
8184 SELECT * FROM testfunc() LIMIT 1;
8185 ERROR:  relation "ttx" does not exist
8186 LINE 1: SELECT /*+ SeqScan(t1) */ * FROM ttx ORDER BY id
8187                                          ^
8188 QUERY:  SELECT /*+ SeqScan(t1) */ * FROM ttx ORDER BY id
8189 CONTEXT:  PL/pgSQL function testfunc() line 3 at RETURN QUERY
8190 -- this should not use SeqScan(t1) hint.
8191 /*+ IndexScan(t1) */ SELECT * from t1 LIMIT 1;
8192 LOG:  pg_hint_plan:
8193 used hint:
8194 IndexScan(t1)
8195 not used hint:
8196 duplication hint:
8197 error hint:
8198
8199  id | val 
8200 ----+-----
8201   1 |   1
8202 (1 row)
8203
8204 DROP FUNCTION testfunc();
8205 DROP EXTENSION pg_hint_plan;
8206 CREATE FUNCTION reset_stats_and_wait() RETURNS void AS $$
8207 DECLARE
8208   rows int;
8209 BEGIN
8210   rows = 1;
8211   while rows > 0 LOOP
8212    PERFORM pg_stat_reset();
8213    PERFORM pg_sleep(0.5);
8214    SELECT sum(seq_scan + idx_scan) from pg_stat_user_tables into rows;
8215   END LOOP;
8216 END;
8217 $$ LANGUAGE plpgsql;
8218 -- Dynamic query in pl/pgsql
8219 CREATE OR REPLACE FUNCTION dynsql1(x int) RETURNS int AS $$
8220 DECLARE c int;
8221 BEGIN
8222   EXECUTE '/*+ IndexScan(t1) */ SELECT count(*) FROM t1 WHERE id < $1'
8223         INTO c USING x;
8224   RETURN c;
8225 END;
8226 $$ VOLATILE LANGUAGE plpgsql;
8227 vacuum analyze t1;
8228 SET pg_hint_plan.enable_hint = false;
8229 SELECT pg_sleep(1);
8230  pg_sleep 
8231 ----------
8232  
8233 (1 row)
8234
8235 SELECT reset_stats_and_wait();
8236  reset_stats_and_wait 
8237 ----------------------
8238  
8239 (1 row)
8240
8241 SELECT dynsql1(9000);
8242  dynsql1 
8243 ---------
8244     8999
8245 (1 row)
8246
8247 SELECT pg_sleep(1);
8248  pg_sleep 
8249 ----------
8250  
8251 (1 row)
8252
8253 SELECT relname, seq_scan > 0 as seq_scan, idx_scan > 0 as idx_scan FROM pg_stat_user_tables WHERE schemaname = 'public' AND relname = 't1';
8254  relname | seq_scan | idx_scan 
8255 ---------+----------+----------
8256  t1      | t        | f
8257 (1 row)
8258
8259 SET pg_hint_plan.enable_hint = true;
8260 SELECT reset_stats_and_wait();
8261  reset_stats_and_wait 
8262 ----------------------
8263  
8264 (1 row)
8265
8266 SELECT dynsql1(9000);
8267 LOG:  pg_hint_plan:
8268 used hint:
8269 IndexScan(t1)
8270 not used hint:
8271 duplication hint:
8272 error hint:
8273
8274 CONTEXT:  SQL statement "/*+ IndexScan(t1) */ SELECT count(*) FROM t1 WHERE id < $1"
8275 PL/pgSQL function dynsql1(integer) line 4 at EXECUTE
8276  dynsql1 
8277 ---------
8278     8999
8279 (1 row)
8280
8281 SELECT pg_sleep(1);
8282  pg_sleep 
8283 ----------
8284  
8285 (1 row)
8286
8287 SELECT relname, seq_scan > 0 as seq_scan, idx_scan > 0 as idx_scan FROM pg_stat_user_tables WHERE schemaname = 'public' AND relname = 't1';
8288  relname | seq_scan | idx_scan 
8289 ---------+----------+----------
8290  t1      | f        | t
8291 (1 row)
8292
8293 -- Looped dynamic query in pl/pgsql
8294 CREATE OR REPLACE FUNCTION dynsql2(x int, OUT r int) AS $$
8295 DECLARE
8296   c text;
8297   s int;
8298 BEGIN
8299   r := 0;
8300   FOR c IN SELECT f.f FROM (VALUES ('p1_c1'), ('p1_c2')) f(f) LOOP
8301     FOR s IN EXECUTE '/*+ IndexScan(' || c || ' ' || c || '_pkey) */ SELECT sum(val) FROM ' || c || ' WHERE id < ' || x LOOP
8302       r := r + s;
8303     END LOOP;
8304   END LOOP;
8305 END;
8306 $$ VOLATILE LANGUAGE plpgsql;
8307 SET pg_hint_plan.enable_hint = false;
8308 SELECT reset_stats_and_wait();
8309  reset_stats_and_wait 
8310 ----------------------
8311  
8312 (1 row)
8313
8314 SELECT dynsql2(9000);
8315  dynsql2 
8316 ---------
8317     9900
8318 (1 row)
8319
8320 SELECT pg_sleep(1);
8321  pg_sleep 
8322 ----------
8323  
8324 (1 row)
8325
8326 -- one of the index scans happened while planning.
8327 SELECT relname, seq_scan, idx_scan FROM pg_stat_user_tables WHERE schemaname = 'public' AND (relname = 'p1_c1' OR relname = 'p1_c2');
8328  relname | seq_scan | idx_scan 
8329 ---------+----------+----------
8330  p1_c1   |        1 |        0
8331  p1_c2   |        1 |        1
8332 (2 rows)
8333
8334 SET pg_hint_plan.enable_hint = true;
8335 SELECT reset_stats_and_wait();
8336  reset_stats_and_wait 
8337 ----------------------
8338  
8339 (1 row)
8340
8341 SELECT dynsql2(9000);
8342 LOG:  available indexes for IndexScan(p1_c1): p1_c1_pkey
8343 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8344 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8345 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_pkey
8346 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8347 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8348 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_pkey
8349 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8350 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8351 LOG:  pg_hint_plan:
8352 used hint:
8353 IndexScan(p1_c1 p1_c1_pkey)
8354 not used hint:
8355 duplication hint:
8356 error hint:
8357
8358 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8359 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8360 LOG:  available indexes for IndexScan(p1_c2): p1_c2_pkey
8361 CONTEXT:  SQL statement "/*+ IndexScan(p1_c2 p1_c2_pkey) */ SELECT sum(val) FROM p1_c2 WHERE id < 9000"
8362 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8363 LOG:  pg_hint_plan:
8364 used hint:
8365 IndexScan(p1_c2 p1_c2_pkey)
8366 not used hint:
8367 duplication hint:
8368 error hint:
8369
8370 CONTEXT:  SQL statement "/*+ IndexScan(p1_c2 p1_c2_pkey) */ SELECT sum(val) FROM p1_c2 WHERE id < 9000"
8371 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8372  dynsql2 
8373 ---------
8374     9900
8375 (1 row)
8376
8377 SELECT pg_sleep(1);
8378  pg_sleep 
8379 ----------
8380  
8381 (1 row)
8382
8383 -- the index scan happened while planning.
8384 SELECT relname, seq_scan, idx_scan FROM pg_stat_user_tables WHERE schemaname = 'public' AND (relname = 'p1_c1' OR relname = 'p1_c2');
8385  relname | seq_scan | idx_scan 
8386 ---------+----------+----------
8387  p1_c1   |        0 |        1
8388  p1_c2   |        0 |        2
8389 (2 rows)
8390
8391 -- Subqueries on inheritance tables under UNION
8392 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8393 UNION ALL
8394 SELECT val::int FROM p2 WHERE id < 1000;
8395                  QUERY PLAN                  
8396 ---------------------------------------------
8397  Append
8398    ->  Append
8399          ->  Seq Scan on p1 p1_1
8400                Filter: (val < 1000)
8401          ->  Seq Scan on p1_c1 p1_2
8402                Filter: (val < 1000)
8403          ->  Seq Scan on p1_c2 p1_3
8404                Filter: (val < 1000)
8405          ->  Seq Scan on p1_c3 p1_4
8406                Filter: (val < 1000)
8407          ->  Seq Scan on p1_c4 p1_5
8408                Filter: (val < 1000)
8409          ->  Seq Scan on p1_c1_c1 p1_6
8410                Filter: (val < 1000)
8411          ->  Seq Scan on p1_c1_c2 p1_7
8412                Filter: (val < 1000)
8413          ->  Seq Scan on p1_c3_c1 p1_8
8414                Filter: (val < 1000)
8415          ->  Seq Scan on p1_c3_c2 p1_9
8416                Filter: (val < 1000)
8417    ->  Result
8418          ->  Append
8419                ->  Seq Scan on p2 p2_1
8420                      Filter: (id < 1000)
8421                ->  Seq Scan on p2_c1 p2_2
8422                      Filter: (id < 1000)
8423                ->  Seq Scan on p2_c2 p2_3
8424                      Filter: (id < 1000)
8425                ->  Seq Scan on p2_c3 p2_4
8426                      Filter: (id < 1000)
8427                ->  Seq Scan on p2_c4 p2_5
8428                      Filter: (id < 1000)
8429                ->  Seq Scan on p2_c1_c1 p2_6
8430                      Filter: (id < 1000)
8431                ->  Seq Scan on p2_c1_c2 p2_7
8432                      Filter: (id < 1000)
8433                ->  Seq Scan on p2_c3_c1 p2_8
8434                      Filter: (id < 1000)
8435                ->  Seq Scan on p2_c3_c2 p2_9
8436                      Filter: (id < 1000)
8437 (40 rows)
8438
8439 /*+ IndexScan(p1 p1_val2) */
8440 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8441 UNION ALL
8442 SELECT val::int FROM p2 WHERE id < 1000;
8443 LOG:  available indexes for IndexScan(p1): p1_val3 p1_val2 p1_val1
8444 LOG:  available indexes for IndexScan(p1_c1): p1_c1_val3 p1_c1_val2 p1_c1_val1
8445 LOG:  available indexes for IndexScan(p1_c2): p1_c2_val3 p1_c2_val2 p1_c2_val1
8446 LOG:  available indexes for IndexScan(p1_c3): p1_c3_val3 p1_c3_val2 p1_c3_val1
8447 LOG:  available indexes for IndexScan(p1_c4): p1_c4_val3 p1_c4_val2 p1_c4_val1
8448 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_val3 p1_c1_c1_val2 p1_c1_c1_val1
8449 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_val3 p1_c1_c2_val2 p1_c1_c2_val1
8450 LOG:  available indexes for IndexScan(p1_c3_c1): p1_c3_c1_val3 p1_c3_c1_val2 p1_c3_c1_val1
8451 LOG:  available indexes for IndexScan(p1_c3_c2): p1_c3_c2_val3 p1_c3_c2_val2 p1_c3_c2_val1
8452 LOG:  pg_hint_plan:
8453 used hint:
8454 IndexScan(p1 p1_val2)
8455 not used hint:
8456 duplication hint:
8457 error hint:
8458
8459                          QUERY PLAN                          
8460 -------------------------------------------------------------
8461  Append
8462    ->  Append
8463          ->  Index Scan using p1_val3 on p1 p1_1
8464                Index Cond: (val < 1000)
8465          ->  Index Scan using p1_c1_val3 on p1_c1 p1_2
8466                Index Cond: (val < 1000)
8467          ->  Index Scan using p1_c2_val3 on p1_c2 p1_3
8468                Index Cond: (val < 1000)
8469          ->  Index Scan using p1_c3_val3 on p1_c3 p1_4
8470                Index Cond: (val < 1000)
8471          ->  Index Scan using p1_c4_val3 on p1_c4 p1_5
8472                Index Cond: (val < 1000)
8473          ->  Index Scan using p1_c1_c1_val3 on p1_c1_c1 p1_6
8474                Index Cond: (val < 1000)
8475          ->  Index Scan using p1_c1_c2_val3 on p1_c1_c2 p1_7
8476                Index Cond: (val < 1000)
8477          ->  Index Scan using p1_c3_c1_val3 on p1_c3_c1 p1_8
8478                Index Cond: (val < 1000)
8479          ->  Index Scan using p1_c3_c2_val3 on p1_c3_c2 p1_9
8480                Index Cond: (val < 1000)
8481    ->  Result
8482          ->  Append
8483                ->  Seq Scan on p2 p2_1
8484                      Filter: (id < 1000)
8485                ->  Seq Scan on p2_c1 p2_2
8486                      Filter: (id < 1000)
8487                ->  Seq Scan on p2_c2 p2_3
8488                      Filter: (id < 1000)
8489                ->  Seq Scan on p2_c3 p2_4
8490                      Filter: (id < 1000)
8491                ->  Seq Scan on p2_c4 p2_5
8492                      Filter: (id < 1000)
8493                ->  Seq Scan on p2_c1_c1 p2_6
8494                      Filter: (id < 1000)
8495                ->  Seq Scan on p2_c1_c2 p2_7
8496                      Filter: (id < 1000)
8497                ->  Seq Scan on p2_c3_c1 p2_8
8498                      Filter: (id < 1000)
8499                ->  Seq Scan on p2_c3_c2 p2_9
8500                      Filter: (id < 1000)
8501 (40 rows)
8502
8503 /*+ IndexScan(p1 p1_val2) IndexScan(p2 p2_id_val_idx) */
8504 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8505 UNION ALL
8506 SELECT val::int FROM p2 WHERE id < 1000;
8507 LOG:  available indexes for IndexScan(p1): p1_val3 p1_val2 p1_val1
8508 LOG:  available indexes for IndexScan(p1_c1): p1_c1_val3 p1_c1_val2 p1_c1_val1
8509 LOG:  available indexes for IndexScan(p1_c2): p1_c2_val3 p1_c2_val2 p1_c2_val1
8510 LOG:  available indexes for IndexScan(p1_c3): p1_c3_val3 p1_c3_val2 p1_c3_val1
8511 LOG:  available indexes for IndexScan(p1_c4): p1_c4_val3 p1_c4_val2 p1_c4_val1
8512 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_val3 p1_c1_c1_val2 p1_c1_c1_val1
8513 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_val3 p1_c1_c2_val2 p1_c1_c2_val1
8514 LOG:  available indexes for IndexScan(p1_c3_c1): p1_c3_c1_val3 p1_c3_c1_val2 p1_c3_c1_val1
8515 LOG:  available indexes for IndexScan(p1_c3_c2): p1_c3_c2_val3 p1_c3_c2_val2 p1_c3_c2_val1
8516 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
8517 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
8518 LOG:  available indexes for IndexScan(p2_c2): p2_c2_id_val_idx
8519 LOG:  available indexes for IndexScan(p2_c3): p2_c3_id_val_idx
8520 LOG:  available indexes for IndexScan(p2_c4): p2_c4_id_val_idx
8521 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
8522 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
8523 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_id_val_idx
8524 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_id_val_idx
8525 LOG:  pg_hint_plan:
8526 used hint:
8527 IndexScan(p1 p1_val2)
8528 IndexScan(p2 p2_id_val_idx)
8529 not used hint:
8530 duplication hint:
8531 error hint:
8532
8533                                QUERY PLAN                                
8534 -------------------------------------------------------------------------
8535  Append
8536    ->  Append
8537          ->  Index Scan using p1_val3 on p1 p1_1
8538                Index Cond: (val < 1000)
8539          ->  Index Scan using p1_c1_val3 on p1_c1 p1_2
8540                Index Cond: (val < 1000)
8541          ->  Index Scan using p1_c2_val3 on p1_c2 p1_3
8542                Index Cond: (val < 1000)
8543          ->  Index Scan using p1_c3_val3 on p1_c3 p1_4
8544                Index Cond: (val < 1000)
8545          ->  Index Scan using p1_c4_val3 on p1_c4 p1_5
8546                Index Cond: (val < 1000)
8547          ->  Index Scan using p1_c1_c1_val3 on p1_c1_c1 p1_6
8548                Index Cond: (val < 1000)
8549          ->  Index Scan using p1_c1_c2_val3 on p1_c1_c2 p1_7
8550                Index Cond: (val < 1000)
8551          ->  Index Scan using p1_c3_c1_val3 on p1_c3_c1 p1_8
8552                Index Cond: (val < 1000)
8553          ->  Index Scan using p1_c3_c2_val3 on p1_c3_c2 p1_9
8554                Index Cond: (val < 1000)
8555    ->  Result
8556          ->  Append
8557                ->  Index Scan using p2_id_val_idx on p2 p2_1
8558                      Index Cond: (id < 1000)
8559                ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
8560                      Index Cond: (id < 1000)
8561                ->  Index Scan using p2_c2_id_val_idx on p2_c2 p2_3
8562                      Index Cond: (id < 1000)
8563                ->  Index Scan using p2_c3_id_val_idx on p2_c3 p2_4
8564                      Index Cond: (id < 1000)
8565                ->  Index Scan using p2_c4_id_val_idx on p2_c4 p2_5
8566                      Index Cond: (id < 1000)
8567                ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1 p2_6
8568                      Index Cond: (id < 1000)
8569                ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2 p2_7
8570                      Index Cond: (id < 1000)
8571                ->  Index Scan using p2_c3_c1_id_val_idx on p2_c3_c1 p2_8
8572                      Index Cond: (id < 1000)
8573                ->  Index Scan using p2_c3_c2_id_val_idx on p2_c3_c2 p2_9
8574                      Index Cond: (id < 1000)
8575 (40 rows)
8576
8577 -- union all case
8578 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8579 UNION
8580 SELECT val::int FROM p2 WHERE id < 1000;
8581                     QUERY PLAN                     
8582 ---------------------------------------------------
8583  HashAggregate
8584    Group Key: p1.val
8585    ->  Append
8586          ->  Append
8587                ->  Seq Scan on p1 p1_1
8588                      Filter: (val < 1000)
8589                ->  Seq Scan on p1_c1 p1_2
8590                      Filter: (val < 1000)
8591                ->  Seq Scan on p1_c2 p1_3
8592                      Filter: (val < 1000)
8593                ->  Seq Scan on p1_c3 p1_4
8594                      Filter: (val < 1000)
8595                ->  Seq Scan on p1_c4 p1_5
8596                      Filter: (val < 1000)
8597                ->  Seq Scan on p1_c1_c1 p1_6
8598                      Filter: (val < 1000)
8599                ->  Seq Scan on p1_c1_c2 p1_7
8600                      Filter: (val < 1000)
8601                ->  Seq Scan on p1_c3_c1 p1_8
8602                      Filter: (val < 1000)
8603                ->  Seq Scan on p1_c3_c2 p1_9
8604                      Filter: (val < 1000)
8605          ->  Result
8606                ->  Append
8607                      ->  Seq Scan on p2 p2_1
8608                            Filter: (id < 1000)
8609                      ->  Seq Scan on p2_c1 p2_2
8610                            Filter: (id < 1000)
8611                      ->  Seq Scan on p2_c2 p2_3
8612                            Filter: (id < 1000)
8613                      ->  Seq Scan on p2_c3 p2_4
8614                            Filter: (id < 1000)
8615                      ->  Seq Scan on p2_c4 p2_5
8616                            Filter: (id < 1000)
8617                      ->  Seq Scan on p2_c1_c1 p2_6
8618                            Filter: (id < 1000)
8619                      ->  Seq Scan on p2_c1_c2 p2_7
8620                            Filter: (id < 1000)
8621                      ->  Seq Scan on p2_c3_c1 p2_8
8622                            Filter: (id < 1000)
8623                      ->  Seq Scan on p2_c3_c2 p2_9
8624                            Filter: (id < 1000)
8625 (42 rows)
8626
8627 /*+ IndexScan(p2 p2_id_val_idx) */
8628 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8629 UNION
8630 SELECT val::int FROM p2 WHERE id < 1000;
8631 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
8632 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
8633 LOG:  available indexes for IndexScan(p2_c2): p2_c2_id_val_idx
8634 LOG:  available indexes for IndexScan(p2_c3): p2_c3_id_val_idx
8635 LOG:  available indexes for IndexScan(p2_c4): p2_c4_id_val_idx
8636 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
8637 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
8638 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_id_val_idx
8639 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_id_val_idx
8640 LOG:  pg_hint_plan:
8641 used hint:
8642 IndexScan(p2 p2_id_val_idx)
8643 not used hint:
8644 duplication hint:
8645 error hint:
8646
8647                                   QUERY PLAN                                   
8648 -------------------------------------------------------------------------------
8649  HashAggregate
8650    Group Key: p1.val
8651    ->  Append
8652          ->  Append
8653                ->  Seq Scan on p1 p1_1
8654                      Filter: (val < 1000)
8655                ->  Seq Scan on p1_c1 p1_2
8656                      Filter: (val < 1000)
8657                ->  Seq Scan on p1_c2 p1_3
8658                      Filter: (val < 1000)
8659                ->  Seq Scan on p1_c3 p1_4
8660                      Filter: (val < 1000)
8661                ->  Seq Scan on p1_c4 p1_5
8662                      Filter: (val < 1000)
8663                ->  Seq Scan on p1_c1_c1 p1_6
8664                      Filter: (val < 1000)
8665                ->  Seq Scan on p1_c1_c2 p1_7
8666                      Filter: (val < 1000)
8667                ->  Seq Scan on p1_c3_c1 p1_8
8668                      Filter: (val < 1000)
8669                ->  Seq Scan on p1_c3_c2 p1_9
8670                      Filter: (val < 1000)
8671          ->  Result
8672                ->  Append
8673                      ->  Index Scan using p2_id_val_idx on p2 p2_1
8674                            Index Cond: (id < 1000)
8675                      ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
8676                            Index Cond: (id < 1000)
8677                      ->  Index Scan using p2_c2_id_val_idx on p2_c2 p2_3
8678                            Index Cond: (id < 1000)
8679                      ->  Index Scan using p2_c3_id_val_idx on p2_c3 p2_4
8680                            Index Cond: (id < 1000)
8681                      ->  Index Scan using p2_c4_id_val_idx on p2_c4 p2_5
8682                            Index Cond: (id < 1000)
8683                      ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1 p2_6
8684                            Index Cond: (id < 1000)
8685                      ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2 p2_7
8686                            Index Cond: (id < 1000)
8687                      ->  Index Scan using p2_c3_c1_id_val_idx on p2_c3_c1 p2_8
8688                            Index Cond: (id < 1000)
8689                      ->  Index Scan using p2_c3_c2_id_val_idx on p2_c3_c2 p2_9
8690                            Index Cond: (id < 1000)
8691 (42 rows)
8692
8693 /*+ IndexScan(p1 p1_val2) IndexScan(p2 p2_id_val_idx) */
8694 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8695 UNION
8696 SELECT val::int FROM p2 WHERE id < 1000;
8697 LOG:  available indexes for IndexScan(p1): p1_val3 p1_val2 p1_val1
8698 LOG:  available indexes for IndexScan(p1_c1): p1_c1_val3 p1_c1_val2 p1_c1_val1
8699 LOG:  available indexes for IndexScan(p1_c2): p1_c2_val3 p1_c2_val2 p1_c2_val1
8700 LOG:  available indexes for IndexScan(p1_c3): p1_c3_val3 p1_c3_val2 p1_c3_val1
8701 LOG:  available indexes for IndexScan(p1_c4): p1_c4_val3 p1_c4_val2 p1_c4_val1
8702 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_val3 p1_c1_c1_val2 p1_c1_c1_val1
8703 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_val3 p1_c1_c2_val2 p1_c1_c2_val1
8704 LOG:  available indexes for IndexScan(p1_c3_c1): p1_c3_c1_val3 p1_c3_c1_val2 p1_c3_c1_val1
8705 LOG:  available indexes for IndexScan(p1_c3_c2): p1_c3_c2_val3 p1_c3_c2_val2 p1_c3_c2_val1
8706 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
8707 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
8708 LOG:  available indexes for IndexScan(p2_c2): p2_c2_id_val_idx
8709 LOG:  available indexes for IndexScan(p2_c3): p2_c3_id_val_idx
8710 LOG:  available indexes for IndexScan(p2_c4): p2_c4_id_val_idx
8711 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
8712 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
8713 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_id_val_idx
8714 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_id_val_idx
8715 LOG:  pg_hint_plan:
8716 used hint:
8717 IndexScan(p1 p1_val2)
8718 IndexScan(p2 p2_id_val_idx)
8719 not used hint:
8720 duplication hint:
8721 error hint:
8722
8723                                   QUERY PLAN                                   
8724 -------------------------------------------------------------------------------
8725  HashAggregate
8726    Group Key: p1.val
8727    ->  Append
8728          ->  Append
8729                ->  Index Scan using p1_val3 on p1 p1_1
8730                      Index Cond: (val < 1000)
8731                ->  Index Scan using p1_c1_val3 on p1_c1 p1_2
8732                      Index Cond: (val < 1000)
8733                ->  Index Scan using p1_c2_val3 on p1_c2 p1_3
8734                      Index Cond: (val < 1000)
8735                ->  Index Scan using p1_c3_val3 on p1_c3 p1_4
8736                      Index Cond: (val < 1000)
8737                ->  Index Scan using p1_c4_val3 on p1_c4 p1_5
8738                      Index Cond: (val < 1000)
8739                ->  Index Scan using p1_c1_c1_val3 on p1_c1_c1 p1_6
8740                      Index Cond: (val < 1000)
8741                ->  Index Scan using p1_c1_c2_val3 on p1_c1_c2 p1_7
8742                      Index Cond: (val < 1000)
8743                ->  Index Scan using p1_c3_c1_val3 on p1_c3_c1 p1_8
8744                      Index Cond: (val < 1000)
8745                ->  Index Scan using p1_c3_c2_val3 on p1_c3_c2 p1_9
8746                      Index Cond: (val < 1000)
8747          ->  Result
8748                ->  Append
8749                      ->  Index Scan using p2_id_val_idx on p2 p2_1
8750                            Index Cond: (id < 1000)
8751                      ->  Index Scan using p2_c1_id_val_idx on p2_c1 p2_2
8752                            Index Cond: (id < 1000)
8753                      ->  Index Scan using p2_c2_id_val_idx on p2_c2 p2_3
8754                            Index Cond: (id < 1000)
8755                      ->  Index Scan using p2_c3_id_val_idx on p2_c3 p2_4
8756                            Index Cond: (id < 1000)
8757                      ->  Index Scan using p2_c4_id_val_idx on p2_c4 p2_5
8758                            Index Cond: (id < 1000)
8759                      ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1 p2_6
8760                            Index Cond: (id < 1000)
8761                      ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2 p2_7
8762                            Index Cond: (id < 1000)
8763                      ->  Index Scan using p2_c3_c1_id_val_idx on p2_c3_c1 p2_8
8764                            Index Cond: (id < 1000)
8765                      ->  Index Scan using p2_c3_c2_id_val_idx on p2_c3_c2 p2_9
8766                            Index Cond: (id < 1000)
8767 (42 rows)
8768
8769 --
8770 -- Rows hint tests
8771 --
8772 -- Explain result includes "Planning time" if COSTS is enabled, but
8773 -- this test needs it enabled for get rows count. So do tests via psql
8774 -- and grep -v the mutable line.
8775 -- Parse error check
8776 /*+ Rows() */ SELECT 1;
8777 INFO:  pg_hint_plan: hint syntax error at or near " "
8778 DETAIL:  Rows hint needs at least one relation followed by one correction term.
8779 LOG:  pg_hint_plan:
8780 used hint:
8781 not used hint:
8782 duplication hint:
8783 error hint:
8784 Rows()
8785
8786  ?column? 
8787 ----------
8788         1
8789 (1 row)
8790
8791 /*+ Rows(x) */ SELECT 1;
8792 INFO:  pg_hint_plan: hint syntax error at or near " "
8793 DETAIL:  Rows hint needs at least one relation followed by one correction term.
8794 LOG:  pg_hint_plan:
8795 used hint:
8796 not used hint:
8797 duplication hint:
8798 error hint:
8799 Rows()
8800
8801  ?column? 
8802 ----------
8803         1
8804 (1 row)
8805
8806 -- value types
8807 \o results/pg_hint_plan.tmpout
8808 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8809 \o
8810 \! sql/maskout.sh results/pg_hint_plan.tmpout
8811   QUERY PLAN
8812 ----------------
8813  Merge Join  (cost=xxx..xxx rows=1000 width=xxx)
8814    Merge Cond: (t1.id = t2.id)
8815    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8816    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8817
8818 \o results/pg_hint_plan.tmpout
8819 /*+ Rows(t1 t2 #99) */
8820 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8821 LOG:  pg_hint_plan:
8822 used hint:
8823 Rows(t1 t2 #99)
8824 not used hint:
8825 duplication hint:
8826 error hint:
8827
8828 \o
8829 \! sql/maskout.sh results/pg_hint_plan.tmpout
8830   QUERY PLAN
8831 ----------------
8832  Merge Join  (cost=xxx..xxx rows=99 width=xxx)
8833    Merge Cond: (t1.id = t2.id)
8834    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8835    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8836
8837 \o results/pg_hint_plan.tmpout
8838 /*+ Rows(t1 t2 +99) */
8839 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8840 LOG:  pg_hint_plan:
8841 used hint:
8842 Rows(t1 t2 +99)
8843 not used hint:
8844 duplication hint:
8845 error hint:
8846
8847 \o
8848 \! sql/maskout.sh results/pg_hint_plan.tmpout
8849   QUERY PLAN
8850 ----------------
8851  Merge Join  (cost=xxx..xxx rows=1099 width=xxx)
8852    Merge Cond: (t1.id = t2.id)
8853    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8854    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8855
8856 \o results/pg_hint_plan.tmpout
8857 /*+ Rows(t1 t2 -99) */
8858 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8859 LOG:  pg_hint_plan:
8860 used hint:
8861 Rows(t1 t2 -99)
8862 not used hint:
8863 duplication hint:
8864 error hint:
8865
8866 \o
8867 \! sql/maskout.sh results/pg_hint_plan.tmpout
8868   QUERY PLAN
8869 ----------------
8870  Merge Join  (cost=xxx..xxx rows=901 width=xxx)
8871    Merge Cond: (t1.id = t2.id)
8872    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8873    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8874
8875 \o results/pg_hint_plan.tmpout
8876 /*+ Rows(t1 t2 *99) */
8877 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8878 LOG:  pg_hint_plan:
8879 used hint:
8880 Rows(t1 t2 *99)
8881 not used hint:
8882 duplication hint:
8883 error hint:
8884
8885 \o
8886 \! sql/maskout.sh results/pg_hint_plan.tmpout
8887   QUERY PLAN
8888 ----------------
8889  Merge Join  (cost=xxx..xxx rows=99000 width=xxx)
8890    Merge Cond: (t1.id = t2.id)
8891    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8892    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8893
8894 \o results/pg_hint_plan.tmpout
8895 /*+ Rows(t1 t2 *0.01) */
8896 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8897 LOG:  pg_hint_plan:
8898 used hint:
8899 Rows(t1 t2 *0.01)
8900 not used hint:
8901 duplication hint:
8902 error hint:
8903
8904 \o
8905 \! sql/maskout.sh results/pg_hint_plan.tmpout
8906   QUERY PLAN
8907 ----------------
8908  Merge Join  (cost=xxx..xxx rows=10 width=xxx)
8909    Merge Cond: (t1.id = t2.id)
8910    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8911    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8912
8913 \o results/pg_hint_plan.tmpout
8914 /*+ Rows(t1 t2 #aa) */
8915 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
8916 INFO:  pg_hint_plan: hint syntax error at or near "aa"
8917 DETAIL:  Rows hint requires valid number as rows estimation.
8918 LOG:  pg_hint_plan:
8919 used hint:
8920 not used hint:
8921 duplication hint:
8922 error hint:
8923 Rows(t1 t2 #aa)
8924
8925 \o
8926 \! sql/maskout.sh results/pg_hint_plan.tmpout
8927   QUERY PLAN
8928 ----------------
8929  Merge Join  (cost=xxx..xxx rows=1000 width=xxx)
8930    Merge Cond: (t1.id = t2.id)
8931    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8932    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8933
8934 \o results/pg_hint_plan.tmpout
8935 /*+ Rows(t1 t2 /99) */
8936 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
8937 INFO:  pg_hint_plan: hint syntax error at or near "/99"
8938 DETAIL:  Unrecognized rows value type notation.
8939 LOG:  pg_hint_plan:
8940 used hint:
8941 not used hint:
8942 duplication hint:
8943 error hint:
8944 Rows(t1 t2 /99)
8945
8946 \o
8947 \! sql/maskout.sh results/pg_hint_plan.tmpout
8948   QUERY PLAN
8949 ----------------
8950  Merge Join  (cost=xxx..xxx rows=1000 width=xxx)
8951    Merge Cond: (t1.id = t2.id)
8952    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8953    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8954
8955 -- round up to 1
8956 \o results/pg_hint_plan.tmpout
8957 /*+ Rows(t1 t2 -99999) */
8958 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8959 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 -99999) 
8960 LOG:  pg_hint_plan:
8961 used hint:
8962 Rows(t1 t2 -99999)
8963 not used hint:
8964 duplication hint:
8965 error hint:
8966
8967 \o
8968 \! sql/maskout.sh results/pg_hint_plan.tmpout
8969   QUERY PLAN
8970 ----------------
8971  Merge Join  (cost=xxx..xxx rows=1 width=xxx)
8972    Merge Cond: (t1.id = t2.id)
8973    ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8974    ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8975
8976 -- complex join tree
8977 \o results/pg_hint_plan.tmpout
8978 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
8979 \o
8980 \! sql/maskout.sh results/pg_hint_plan.tmpout
8981   QUERY PLAN
8982 ----------------
8983  Merge Join  (cost=xxx..xxx rows=10 width=xxx)
8984    Merge Cond: (t1.id = t3.id)
8985    ->  Merge Join  (cost=xxx..xxx rows=1000 width=xxx)
8986          Merge Cond: (t1.id = t2.id)
8987          ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
8988          ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
8989    ->  Sort  (cost=xxx..xxx rows=100 width=xxx)
8990          Sort Key: t3.id
8991          ->  Seq Scan on t3  (cost=xxx..xxx rows=100 width=xxx)
8992
8993 \o results/pg_hint_plan.tmpout
8994 /*+ Rows(t1 t2 #22) */
8995 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
8996 LOG:  pg_hint_plan:
8997 used hint:
8998 Rows(t1 t2 #22)
8999 not used hint:
9000 duplication hint:
9001 error hint:
9002
9003 \o
9004 \! sql/maskout.sh results/pg_hint_plan.tmpout
9005   QUERY PLAN
9006 ----------------
9007  Merge Join  (cost=xxx..xxx rows=1 width=xxx)
9008    Merge Cond: (t1.id = t3.id)
9009    ->  Merge Join  (cost=xxx..xxx rows=22 width=xxx)
9010          Merge Cond: (t1.id = t2.id)
9011          ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
9012          ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
9013    ->  Sort  (cost=xxx..xxx rows=100 width=xxx)
9014          Sort Key: t3.id
9015          ->  Seq Scan on t3  (cost=xxx..xxx rows=100 width=xxx)
9016
9017 \o results/pg_hint_plan.tmpout
9018 /*+ Rows(t1 t3 *10) */
9019 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
9020 LOG:  pg_hint_plan:
9021 used hint:
9022 Rows(t1 t3 *10)
9023 not used hint:
9024 duplication hint:
9025 error hint:
9026
9027 \o
9028 set max_parallel_workers_per_gather to DEFAULT;
9029 \! sql/maskout.sh results/pg_hint_plan.tmpout
9030   QUERY PLAN
9031 ----------------
9032  Merge Join  (cost=xxx..xxx rows=100 width=xxx)
9033    Merge Cond: (t1.id = t3.id)
9034    ->  Merge Join  (cost=xxx..xxx rows=1000 width=xxx)
9035          Merge Cond: (t1.id = t2.id)
9036          ->  Index Scan using t1_pkey on t1  (cost=xxx..xxx rows=10000 width=xxx)
9037          ->  Index Scan using t2_pkey on t2  (cost=xxx..xxx rows=1000 width=xxx)
9038    ->  Sort  (cost=xxx..xxx rows=100 width=xxx)
9039          Sort Key: t3.id
9040          ->  Seq Scan on t3  (cost=xxx..xxx rows=100 width=xxx)
9041
9042 \! rm results/pg_hint_plan.tmpout
9043 -- hint error level
9044 set client_min_messages to 'DEBUG1';
9045 set pg_hint_plan.debug_level to 'verbose';
9046 /*+ SeqScan( */ SELECT 1;
9047 INFO:  pg_hint_plan: hint syntax error at or near ""
9048 DETAIL:  Closing parenthesis is necessary.
9049  ?column? 
9050 ----------
9051         1
9052 (1 row)
9053
9054 /*+ SeqScan(t1) */ SELECT * FROM t1 LIMIT 0;
9055 LOG:  pg_hint_plan:
9056 used hint:
9057 SeqScan(t1)
9058 not used hint:
9059 duplication hint:
9060 error hint:
9061
9062  id | val 
9063 ----+-----
9064 (0 rows)
9065
9066 set pg_hint_plan.message_level to 'DEBUG1';
9067 set pg_hint_plan.parse_messages to 'NOTICE';
9068 /*+ SeqScan( */ SELECT 1;
9069 NOTICE:  pg_hint_plan: hint syntax error at or near ""
9070 DETAIL:  Closing parenthesis is necessary.
9071  ?column? 
9072 ----------
9073         1
9074 (1 row)
9075
9076 /*+ SeqScan(t1) */ SELECT * FROM t1 LIMIT 0;
9077 DEBUG:  pg_hint_plan:
9078 used hint:
9079 SeqScan(t1)
9080 not used hint:
9081 duplication hint:
9082 error hint:
9083
9084  id | val 
9085 ----+-----
9086 (0 rows)
9087
9088 -- all hint types together
9089 /*+ SeqScan(t1) MergeJoin(t1 t2) Leading(t1 t2) Rows(t1 t2 +10) Parallel(t1 8 hard) Set(random_page_cost 2.0)*/
9090 EXPLAIN (costs off) SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
9091 DEBUG:  adjusted rows 1000 to 1010
9092 DEBUG:  pg_hint_plan:
9093 used hint:
9094 SeqScan(t1)
9095 MergeJoin(t1 t2)
9096 Leading(t1 t2)
9097 Set(random_page_cost 2.0)
9098 Rows(t1 t2 +10)
9099 Parallel(t1 8 hard)
9100 not used hint:
9101 duplication hint:
9102 error hint:
9103
9104                    QUERY PLAN                    
9105 -------------------------------------------------
9106  Nested Loop
9107    ->  Merge Join
9108          Merge Cond: (t2.id = t1.id)
9109          ->  Index Scan using t2_pkey on t2
9110          ->  Sort
9111                Sort Key: t1.id
9112                ->  Gather
9113                      Workers Planned: 8
9114                      ->  Parallel Seq Scan on t1
9115    ->  Index Scan using t3_pkey on t3
9116          Index Cond: (id = t1.id)
9117 (11 rows)
9118