OSDN Git Service

9f52f9820c4cbb9b2f5b14953d55a6dc9a7ef05e
[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
3073          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3074    ->  Seq Scan on p1_c1
3075          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3076    ->  Seq Scan on p1_c2
3077          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3078    ->  Seq Scan on p1_c3
3079          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3080    ->  Seq Scan on p1_c4
3081          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3082    ->  Seq Scan on p1_c1_c1
3083          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3084    ->  Seq Scan on p1_c1_c2
3085          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3086    ->  Seq Scan on p1_c3_c1
3087          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3088    ->  Seq Scan on p1_c3_c2
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
3098          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3099    ->  Seq Scan on p1_c1
3100          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3101    ->  Seq Scan on p1_c1_c1
3102          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3103    ->  Seq Scan on p1_c1_c2
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
3121          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3122    ->  Seq Scan on p1_c1
3123          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3124    ->  Seq Scan on p1_c2
3125          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3126    ->  Seq Scan on p1_c3
3127          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3128    ->  Seq Scan on p1_c4
3129          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3130    ->  Seq Scan on p1_c1_c1
3131          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3132    ->  Seq Scan on p1_c1_c2
3133          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3134    ->  Seq Scan on p1_c3_c1
3135          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3136    ->  Seq Scan on p1_c3_c2
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
3153          Index Cond: ((id >= 50) AND (id <= 51))
3154          Filter: (ctid = '(1,1)'::tid)
3155    ->  Index Scan using p1_c1_pkey on p1_c1
3156          Index Cond: ((id >= 50) AND (id <= 51))
3157          Filter: (ctid = '(1,1)'::tid)
3158    ->  Index Scan using p1_c2_pkey on p1_c2
3159          Index Cond: ((id >= 50) AND (id <= 51))
3160          Filter: (ctid = '(1,1)'::tid)
3161    ->  Index Scan using p1_c3_pkey on p1_c3
3162          Index Cond: ((id >= 50) AND (id <= 51))
3163          Filter: (ctid = '(1,1)'::tid)
3164    ->  Index Scan using p1_c4_pkey on p1_c4
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
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
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
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
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
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
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
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
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
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
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
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
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
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
3253          TID Cond: (ctid = '(1,1)'::tid)
3254          Filter: ((id >= 50) AND (id <= 51))
3255    ->  Tid Scan on p1_c1
3256          TID Cond: (ctid = '(1,1)'::tid)
3257          Filter: ((id >= 50) AND (id <= 51))
3258    ->  Tid Scan on p1_c2
3259          TID Cond: (ctid = '(1,1)'::tid)
3260          Filter: ((id >= 50) AND (id <= 51))
3261    ->  Tid Scan on p1_c3
3262          TID Cond: (ctid = '(1,1)'::tid)
3263          Filter: ((id >= 50) AND (id <= 51))
3264    ->  Tid Scan on p1_c4
3265          TID Cond: (ctid = '(1,1)'::tid)
3266          Filter: ((id >= 50) AND (id <= 51))
3267    ->  Tid Scan on p1_c1_c1
3268          TID Cond: (ctid = '(1,1)'::tid)
3269          Filter: ((id >= 50) AND (id <= 51))
3270    ->  Tid Scan on p1_c1_c2
3271          TID Cond: (ctid = '(1,1)'::tid)
3272          Filter: ((id >= 50) AND (id <= 51))
3273    ->  Tid Scan on p1_c3_c1
3274          TID Cond: (ctid = '(1,1)'::tid)
3275          Filter: ((id >= 50) AND (id <= 51))
3276    ->  Tid Scan on p1_c3_c2
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
3295          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3296    ->  Seq Scan on p1_c1
3297          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3298    ->  Seq Scan on p1_c1_c1
3299          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3300    ->  Seq Scan on p1_c1_c2
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
3317          Index Cond: ((id >= 50) AND (id <= 51))
3318          Filter: (ctid = '(1,1)'::tid)
3319    ->  Index Scan using p1_c1_pkey on p1_c1
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
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
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
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
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
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
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
3377          TID Cond: (ctid = '(1,1)'::tid)
3378          Filter: ((id >= 50) AND (id <= 51))
3379    ->  Tid Scan on p1_c1
3380          TID Cond: (ctid = '(1,1)'::tid)
3381          Filter: ((id >= 50) AND (id <= 51))
3382    ->  Tid Scan on p1_c1_c1
3383          TID Cond: (ctid = '(1,1)'::tid)
3384          Filter: ((id >= 50) AND (id <= 51))
3385    ->  Tid Scan on p1_c1_c2
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
3400                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3401                ->  Seq Scan on p1_c1
3402                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3403                ->  Seq Scan on p1_c2
3404                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3405                ->  Seq Scan on p1_c3
3406                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3407                ->  Seq Scan on p1_c4
3408                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3409                ->  Seq Scan on p1_c1_c1
3410                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3411                ->  Seq Scan on p1_c1_c2
3412                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3413                ->  Seq Scan on p1_c3_c1
3414                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3415                ->  Seq Scan on p1_c3_c2
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
3431                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3432                ->  Seq Scan on p1_c1
3433                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3434                ->  Seq Scan on p1_c1_c1
3435                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3436                ->  Seq Scan on p1_c1_c2
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
3460                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3461                ->  Seq Scan on p1_c1
3462                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3463                ->  Seq Scan on p1_c2
3464                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3465                ->  Seq Scan on p1_c3
3466                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3467                ->  Seq Scan on p1_c4
3468                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3469                ->  Seq Scan on p1_c1_c1
3470                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3471                ->  Seq Scan on p1_c1_c2
3472                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3473                ->  Seq Scan on p1_c3_c1
3474                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3475                ->  Seq Scan on p1_c3_c2
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
3497                Index Cond: ((id >= 50) AND (id <= 51))
3498                Filter: (ctid = '(1,1)'::tid)
3499          ->  Index Scan using p1_c1_pkey on p1_c1
3500                Index Cond: ((id >= 50) AND (id <= 51))
3501                Filter: (ctid = '(1,1)'::tid)
3502          ->  Index Scan using p1_c2_pkey on p1_c2
3503                Index Cond: ((id >= 50) AND (id <= 51))
3504                Filter: (ctid = '(1,1)'::tid)
3505          ->  Index Scan using p1_c3_pkey on p1_c3
3506                Index Cond: ((id >= 50) AND (id <= 51))
3507                Filter: (ctid = '(1,1)'::tid)
3508          ->  Index Scan using p1_c4_pkey on p1_c4
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
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
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
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
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
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
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
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
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
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
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
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
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
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
3609                      TID Cond: (ctid = '(1,1)'::tid)
3610                      Filter: ((id >= 50) AND (id <= 51))
3611                ->  Tid Scan on p1_c1
3612                      TID Cond: (ctid = '(1,1)'::tid)
3613                      Filter: ((id >= 50) AND (id <= 51))
3614                ->  Tid Scan on p1_c2
3615                      TID Cond: (ctid = '(1,1)'::tid)
3616                      Filter: ((id >= 50) AND (id <= 51))
3617                ->  Tid Scan on p1_c3
3618                      TID Cond: (ctid = '(1,1)'::tid)
3619                      Filter: ((id >= 50) AND (id <= 51))
3620                ->  Tid Scan on p1_c4
3621                      TID Cond: (ctid = '(1,1)'::tid)
3622                      Filter: ((id >= 50) AND (id <= 51))
3623                ->  Tid Scan on p1_c1_c1
3624                      TID Cond: (ctid = '(1,1)'::tid)
3625                      Filter: ((id >= 50) AND (id <= 51))
3626                ->  Tid Scan on p1_c1_c2
3627                      TID Cond: (ctid = '(1,1)'::tid)
3628                      Filter: ((id >= 50) AND (id <= 51))
3629                ->  Tid Scan on p1_c3_c1
3630                      TID Cond: (ctid = '(1,1)'::tid)
3631                      Filter: ((id >= 50) AND (id <= 51))
3632                ->  Tid Scan on p1_c3_c2
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
3654                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3655          ->  Seq Scan on p1_c1
3656                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3657          ->  Seq Scan on p1_c2
3658                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3659          ->  Seq Scan on p1_c3
3660                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3661          ->  Seq Scan on p1_c4
3662                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3663          ->  Seq Scan on p1_c1_c1
3664                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3665          ->  Seq Scan on p1_c1_c2
3666                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3667          ->  Seq Scan on p1_c3_c1
3668                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3669          ->  Seq Scan on p1_c3_c2
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
3693                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3694                ->  Seq Scan on p1_c1
3695                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3696                ->  Seq Scan on p1_c2
3697                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3698                ->  Seq Scan on p1_c3
3699                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3700                ->  Seq Scan on p1_c4
3701                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3702                ->  Seq Scan on p1_c1_c1
3703                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3704                ->  Seq Scan on p1_c1_c2
3705                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3706                ->  Seq Scan on p1_c3_c1
3707                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3708                ->  Seq Scan on p1_c3_c2
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
3729                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3730          ->  Seq Scan on p1_c1
3731                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3732          ->  Seq Scan on p1_c2
3733                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3734          ->  Seq Scan on p1_c3
3735                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3736          ->  Seq Scan on p1_c4
3737                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3738          ->  Seq Scan on p1_c1_c1
3739                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3740          ->  Seq Scan on p1_c1_c2
3741                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3742          ->  Seq Scan on p1_c3_c1
3743                Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3744          ->  Seq Scan on p1_c3_c2
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
3769                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3770                ->  Seq Scan on p1_c1
3771                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3772                ->  Seq Scan on p1_c1_c1
3773                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3774                ->  Seq Scan on p1_c1_c2
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
3796                Index Cond: ((id >= 50) AND (id <= 51))
3797                Filter: (ctid = '(1,1)'::tid)
3798          ->  Index Scan using p1_c1_pkey on p1_c1
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
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
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
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
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
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
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
3868                      TID Cond: (ctid = '(1,1)'::tid)
3869                      Filter: ((id >= 50) AND (id <= 51))
3870                ->  Tid Scan on p1_c1
3871                      TID Cond: (ctid = '(1,1)'::tid)
3872                      Filter: ((id >= 50) AND (id <= 51))
3873                ->  Tid Scan on p1_c1_c1
3874                      TID Cond: (ctid = '(1,1)'::tid)
3875                      Filter: ((id >= 50) AND (id <= 51))
3876                ->  Tid Scan on p1_c1_c2
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
3901                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3902                ->  Seq Scan on p1_c1
3903                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3904                ->  Seq Scan on p1_c1_c1
3905                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3906                ->  Seq Scan on p1_c1_c2
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
3927                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3928                ->  Seq Scan on p1_c1
3929                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3930                ->  Seq Scan on p1_c1_c1
3931                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3932                ->  Seq Scan on p1_c1_c2
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
3956                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3957                ->  Seq Scan on p1_c1
3958                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3959                ->  Seq Scan on p1_c1_c1
3960                      Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
3961                ->  Seq Scan on p1_c1_c2
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    CTE c1_1
4525      ->  Aggregate
4526            ->  Merge Join
4527                  Merge Cond: (t1_5.id = t3_5.id)
4528                  ->  Merge Join
4529                        Merge Cond: (t1_5.id = t2_5.id)
4530                        ->  Index Only Scan using t1_pkey on t1 t1_5
4531                        ->  Index Only Scan using t2_pkey on t2 t2_5
4532                  ->  Sort
4533                        Sort Key: t3_5.id
4534                        ->  Seq Scan on t3 t3_5
4535    InitPlan 2 (returns $1)
4536      ->  Aggregate
4537            ->  Merge Join
4538                  Merge Cond: (t1_2.id = t3_2.id)
4539                  ->  Merge Join
4540                        Merge Cond: (t1_2.id = t2_2.id)
4541                        ->  Index Only Scan using t1_pkey on t1 t1_2
4542                        ->  Index Only Scan using t2_pkey on t2 t2_2
4543                  ->  Sort
4544                        Sort Key: t3_2.id
4545                        ->  Seq Scan on t3 t3_2
4546    InitPlan 3 (returns $2)
4547      ->  Aggregate
4548            ->  Merge Join
4549                  Merge Cond: (t1_4.id = t3_4.id)
4550                  ->  Merge Join
4551                        Merge Cond: (t1_4.id = t2_4.id)
4552                        ->  Index Only Scan using t1_pkey on t1 t1_4
4553                        ->  Index Only Scan using t2_pkey on t2 t2_4
4554                  ->  Sort
4555                        Sort Key: t3_4.id
4556                        ->  Seq Scan on t3 t3_4
4557    ->  Nested Loop
4558          ->  Nested Loop
4559                ->  Nested Loop
4560                      ->  Nested Loop
4561                            ->  Nested Loop
4562                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4563                                        Index Cond: (id = $2)
4564                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4565                                        Index Cond: (id = $2)
4566                            ->  Seq Scan on t3 t3_1
4567                                  Filter: (id = $2)
4568                      ->  Index Only Scan using t1_pkey on t1 t1_3
4569                            Index Cond: (id = $2)
4570                ->  Index Only Scan using t2_pkey on t2 t2_3
4571                      Index Cond: (id = $2)
4572          ->  Seq Scan on t3 t3_3
4573                Filter: (id = $2)
4574    ->  CTE Scan on c1_1
4575          Filter: (id = $2)
4576 (53 rows)
4577
4578 /*+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)*/
4579 EXPLAIN (COSTS false)
4580 WITH c1_1(id) AS (
4581 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
4582 )
4583 SELECT t1_1.id, (
4584 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
4585 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4586 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
4587 ) 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 = (
4588 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 
4589 );
4590 LOG:  pg_hint_plan:
4591 used hint:
4592 HashJoin(t1_1 t3_1)
4593 NestLoop(t1_2 t2_2)
4594 MergeJoin(t1_3 t3_3)
4595 NestLoop(t1_4 t2_4)
4596 NestLoop(t1_5 t2_5)
4597 not used hint:
4598 duplication hint:
4599 error hint:
4600
4601                                   QUERY PLAN                                  
4602 ------------------------------------------------------------------------------
4603  Nested Loop
4604    CTE c1_1
4605      ->  Aggregate
4606            ->  Merge Join
4607                  Merge Cond: (t1_5.id = t3_5.id)
4608                  ->  Nested Loop
4609                        ->  Index Only Scan using t2_pkey on t2 t2_5
4610                        ->  Index Only Scan using t1_pkey on t1 t1_5
4611                              Index Cond: (id = t2_5.id)
4612                  ->  Sort
4613                        Sort Key: t3_5.id
4614                        ->  Seq Scan on t3 t3_5
4615    InitPlan 2 (returns $3)
4616      ->  Aggregate
4617            ->  Merge Join
4618                  Merge Cond: (t1_2.id = t3_2.id)
4619                  ->  Nested Loop
4620                        ->  Index Only Scan using t2_pkey on t2 t2_2
4621                        ->  Index Only Scan using t1_pkey on t1 t1_2
4622                              Index Cond: (id = t2_2.id)
4623                  ->  Sort
4624                        Sort Key: t3_2.id
4625                        ->  Seq Scan on t3 t3_2
4626    InitPlan 3 (returns $5)
4627      ->  Aggregate
4628            ->  Merge Join
4629                  Merge Cond: (t1_4.id = t3_4.id)
4630                  ->  Nested Loop
4631                        ->  Index Only Scan using t2_pkey on t2 t2_4
4632                        ->  Index Only Scan using t1_pkey on t1 t1_4
4633                              Index Cond: (id = t2_4.id)
4634                  ->  Sort
4635                        Sort Key: t3_4.id
4636                        ->  Seq Scan on t3 t3_4
4637    ->  Nested Loop
4638          ->  Nested Loop
4639                ->  Nested Loop
4640                      ->  Nested Loop
4641                            ->  Nested Loop
4642                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4643                                        Index Cond: (id = $5)
4644                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4645                                        Index Cond: (id = $5)
4646                            ->  Seq Scan on t3 t3_1
4647                                  Filter: (id = $5)
4648                      ->  Index Only Scan using t1_pkey on t1 t1_3
4649                            Index Cond: (id = $5)
4650                ->  Index Only Scan using t2_pkey on t2 t2_3
4651                      Index Cond: (id = $5)
4652          ->  Seq Scan on t3 t3_3
4653                Filter: (id = $5)
4654    ->  CTE Scan on c1_1
4655          Filter: (id = $5)
4656 (53 rows)
4657
4658 /*+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)*/
4659 EXPLAIN (COSTS false)
4660 WITH c1_1(id) AS (
4661 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
4662 )
4663 SELECT t1_1.id, (
4664 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
4665 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4666 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
4667 ) 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 = (
4668 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 
4669 );
4670 LOG:  pg_hint_plan:
4671 used hint:
4672 HashJoin(t1_1 t3_1)
4673 NestLoop(t1_2 t2_2)
4674 MergeJoin(t1_3 t3_3)
4675 NestLoop(t1_4 t2_4)
4676 NestLoop(t1_5 t2_5)
4677 not used hint:
4678 Leading(a t1_1 t1_2 t1_4 t1_5)
4679 duplication hint:
4680 error hint:
4681
4682                                   QUERY PLAN                                  
4683 ------------------------------------------------------------------------------
4684  Nested Loop
4685    CTE c1_1
4686      ->  Aggregate
4687            ->  Merge Join
4688                  Merge Cond: (t1_5.id = t3_5.id)
4689                  ->  Nested Loop
4690                        ->  Index Only Scan using t2_pkey on t2 t2_5
4691                        ->  Index Only Scan using t1_pkey on t1 t1_5
4692                              Index Cond: (id = t2_5.id)
4693                  ->  Sort
4694                        Sort Key: t3_5.id
4695                        ->  Seq Scan on t3 t3_5
4696    InitPlan 2 (returns $3)
4697      ->  Aggregate
4698            ->  Merge Join
4699                  Merge Cond: (t1_2.id = t3_2.id)
4700                  ->  Nested Loop
4701                        ->  Index Only Scan using t2_pkey on t2 t2_2
4702                        ->  Index Only Scan using t1_pkey on t1 t1_2
4703                              Index Cond: (id = t2_2.id)
4704                  ->  Sort
4705                        Sort Key: t3_2.id
4706                        ->  Seq Scan on t3 t3_2
4707    InitPlan 3 (returns $5)
4708      ->  Aggregate
4709            ->  Merge Join
4710                  Merge Cond: (t1_4.id = t3_4.id)
4711                  ->  Nested Loop
4712                        ->  Index Only Scan using t2_pkey on t2 t2_4
4713                        ->  Index Only Scan using t1_pkey on t1 t1_4
4714                              Index Cond: (id = t2_4.id)
4715                  ->  Sort
4716                        Sort Key: t3_4.id
4717                        ->  Seq Scan on t3 t3_4
4718    ->  Nested Loop
4719          ->  Nested Loop
4720                ->  Nested Loop
4721                      ->  Nested Loop
4722                            ->  Nested Loop
4723                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4724                                        Index Cond: (id = $5)
4725                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4726                                        Index Cond: (id = $5)
4727                            ->  Seq Scan on t3 t3_1
4728                                  Filter: (id = $5)
4729                      ->  Index Only Scan using t1_pkey on t1 t1_3
4730                            Index Cond: (id = $5)
4731                ->  Index Only Scan using t2_pkey on t2 t2_3
4732                      Index Cond: (id = $5)
4733          ->  Seq Scan on t3 t3_3
4734                Filter: (id = $5)
4735    ->  CTE Scan on c1_1
4736          Filter: (id = $5)
4737 (53 rows)
4738
4739 /*+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)*/
4740 EXPLAIN (COSTS false)
4741 WITH c1_1(id) AS (
4742 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
4743 )
4744 SELECT t1_1.id, (
4745 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
4746 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4747 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
4748 ) 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 = (
4749 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 
4750 );
4751 LOG:  pg_hint_plan:
4752 used hint:
4753 HashJoin(t1_1 t3_1)
4754 NestLoop(t1_2 t2_2)
4755 MergeJoin(t1_3 t3_3)
4756 NestLoop(t1_4 t2_4)
4757 NestLoop(t1_5 t2_5)
4758 not used hint:
4759 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)
4760 duplication hint:
4761 error hint:
4762
4763                                   QUERY PLAN                                  
4764 ------------------------------------------------------------------------------
4765  Nested Loop
4766    CTE c1_1
4767      ->  Aggregate
4768            ->  Merge Join
4769                  Merge Cond: (t1_5.id = t3_5.id)
4770                  ->  Nested Loop
4771                        ->  Index Only Scan using t2_pkey on t2 t2_5
4772                        ->  Index Only Scan using t1_pkey on t1 t1_5
4773                              Index Cond: (id = t2_5.id)
4774                  ->  Sort
4775                        Sort Key: t3_5.id
4776                        ->  Seq Scan on t3 t3_5
4777    InitPlan 2 (returns $3)
4778      ->  Aggregate
4779            ->  Merge Join
4780                  Merge Cond: (t1_2.id = t3_2.id)
4781                  ->  Nested Loop
4782                        ->  Index Only Scan using t2_pkey on t2 t2_2
4783                        ->  Index Only Scan using t1_pkey on t1 t1_2
4784                              Index Cond: (id = t2_2.id)
4785                  ->  Sort
4786                        Sort Key: t3_2.id
4787                        ->  Seq Scan on t3 t3_2
4788    InitPlan 3 (returns $5)
4789      ->  Aggregate
4790            ->  Merge Join
4791                  Merge Cond: (t1_4.id = t3_4.id)
4792                  ->  Nested Loop
4793                        ->  Index Only Scan using t2_pkey on t2 t2_4
4794                        ->  Index Only Scan using t1_pkey on t1 t1_4
4795                              Index Cond: (id = t2_4.id)
4796                  ->  Sort
4797                        Sort Key: t3_4.id
4798                        ->  Seq Scan on t3 t3_4
4799    ->  Nested Loop
4800          ->  Nested Loop
4801                ->  Nested Loop
4802                      ->  Nested Loop
4803                            ->  Nested Loop
4804                                  ->  Index Only Scan using t1_pkey on t1 t1_1
4805                                        Index Cond: (id = $5)
4806                                  ->  Index Only Scan using t2_pkey on t2 t2_1
4807                                        Index Cond: (id = $5)
4808                            ->  Seq Scan on t3 t3_1
4809                                  Filter: (id = $5)
4810                      ->  Index Only Scan using t1_pkey on t1 t1_3
4811                            Index Cond: (id = $5)
4812                ->  Index Only Scan using t2_pkey on t2 t2_3
4813                      Index Cond: (id = $5)
4814          ->  Seq Scan on t3 t3_3
4815                Filter: (id = $5)
4816    ->  CTE Scan on c1_1
4817          Filter: (id = $5)
4818 (53 rows)
4819
4820 /*+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)*/
4821 EXPLAIN (COSTS false)
4822 WITH c1_1(id) AS (
4823 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
4824 )
4825 SELECT t1_1.id, (
4826 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
4827 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4828 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
4829 ) 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 = (
4830 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 
4831 );
4832 LOG:  pg_hint_plan:
4833 used hint:
4834 Leading(t3_5 t2_5 t1_5)
4835 Leading(t3_2 t2_2 t1_2)
4836 Leading(t3_4 t2_4 t1_4)
4837 Leading(c1_1 t3_3 t2_3 t1_3 t3_1 t2_1 t1_1)
4838 not used hint:
4839 HashJoin(t1_1 t3_1)
4840 NestLoop(t1_2 t2_2)
4841 MergeJoin(t1_3 t3_3)
4842 NestLoop(t1_4 t2_4)
4843 NestLoop(t1_5 t2_5)
4844 duplication hint:
4845 error hint:
4846
4847                                QUERY PLAN                               
4848 ------------------------------------------------------------------------
4849  Nested Loop
4850    CTE c1_1
4851      ->  Aggregate
4852            ->  Merge Join
4853                  Merge Cond: (t2_5.id = t1_5.id)
4854                  ->  Merge Join
4855                        Merge Cond: (t2_5.id = t3_5.id)
4856                        ->  Index Only Scan using t2_pkey on t2 t2_5
4857                        ->  Sort
4858                              Sort Key: t3_5.id
4859                              ->  Seq Scan on t3 t3_5
4860                  ->  Index Only Scan using t1_pkey on t1 t1_5
4861    InitPlan 2 (returns $1)
4862      ->  Aggregate
4863            ->  Merge Join
4864                  Merge Cond: (t2_2.id = t1_2.id)
4865                  ->  Merge Join
4866                        Merge Cond: (t2_2.id = t3_2.id)
4867                        ->  Index Only Scan using t2_pkey on t2 t2_2
4868                        ->  Sort
4869                              Sort Key: t3_2.id
4870                              ->  Seq Scan on t3 t3_2
4871                  ->  Index Only Scan using t1_pkey on t1 t1_2
4872    InitPlan 3 (returns $2)
4873      ->  Aggregate
4874            ->  Merge Join
4875                  Merge Cond: (t2_4.id = t1_4.id)
4876                  ->  Merge Join
4877                        Merge Cond: (t2_4.id = t3_4.id)
4878                        ->  Index Only Scan using t2_pkey on t2 t2_4
4879                        ->  Sort
4880                              Sort Key: t3_4.id
4881                              ->  Seq Scan on t3 t3_4
4882                  ->  Index Only Scan using t1_pkey on t1 t1_4
4883    ->  Nested Loop
4884          ->  Nested Loop
4885                ->  Nested Loop
4886                      ->  Nested Loop
4887                            ->  Nested Loop
4888                                  ->  Seq Scan on t3 t3_3
4889                                        Filter: (id = $2)
4890                                  ->  CTE Scan on c1_1
4891                                        Filter: (id = $2)
4892                            ->  Index Only Scan using t2_pkey on t2 t2_3
4893                                  Index Cond: (id = $2)
4894                      ->  Index Only Scan using t1_pkey on t1 t1_3
4895                            Index Cond: (id = $2)
4896                ->  Seq Scan on t3 t3_1
4897                      Filter: (id = $2)
4898          ->  Index Only Scan using t2_pkey on t2 t2_1
4899                Index Cond: (id = $2)
4900    ->  Index Only Scan using t1_pkey on t1 t1_1
4901          Index Cond: (id = $2)
4902 (53 rows)
4903
4904 SET from_collapse_limit TO 1;
4905 EXPLAIN (COSTS false)
4906 WITH c1_1(id) AS (
4907 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
4908 )
4909 SELECT t1_1.id, (
4910 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
4911 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4912 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
4913 ) 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 = (
4914 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 
4915 );
4916                              QUERY PLAN                             
4917 --------------------------------------------------------------------
4918  Nested Loop
4919    CTE c1_1
4920      ->  Aggregate
4921            ->  Merge Join
4922                  Merge Cond: (t1_5.id = t3_5.id)
4923                  ->  Merge Join
4924                        Merge Cond: (t1_5.id = t2_5.id)
4925                        ->  Index Only Scan using t1_pkey on t1 t1_5
4926                        ->  Index Only Scan using t2_pkey on t2 t2_5
4927                  ->  Sort
4928                        Sort Key: t3_5.id
4929                        ->  Seq Scan on t3 t3_5
4930    InitPlan 2 (returns $1)
4931      ->  Aggregate
4932            ->  Merge Join
4933                  Merge Cond: (t1_2.id = t3_2.id)
4934                  ->  Merge Join
4935                        Merge Cond: (t1_2.id = t2_2.id)
4936                        ->  Index Only Scan using t1_pkey on t1 t1_2
4937                        ->  Index Only Scan using t2_pkey on t2 t2_2
4938                  ->  Sort
4939                        Sort Key: t3_2.id
4940                        ->  Seq Scan on t3 t3_2
4941    InitPlan 3 (returns $2)
4942      ->  Aggregate
4943            ->  Merge Join
4944                  Merge Cond: (t1_4.id = t3_4.id)
4945                  ->  Merge Join
4946                        Merge Cond: (t1_4.id = t2_4.id)
4947                        ->  Index Only Scan using t1_pkey on t1 t1_4
4948                        ->  Index Only Scan using t2_pkey on t2 t2_4
4949                  ->  Sort
4950                        Sort Key: t3_4.id
4951                        ->  Seq Scan on t3 t3_4
4952    ->  Nested Loop
4953          ->  Nested Loop
4954                ->  Nested Loop
4955                      ->  Index Only Scan using t1_pkey on t1 t1_1
4956                            Index Cond: (id = $2)
4957                      ->  Index Only Scan using t2_pkey on t2 t2_1
4958                            Index Cond: (id = $2)
4959                ->  Seq Scan on t3 t3_1
4960                      Filter: (id = $2)
4961          ->  Nested Loop
4962                ->  Nested Loop
4963                      ->  Index Only Scan using t1_pkey on t1 t1_3
4964                            Index Cond: (id = $2)
4965                      ->  Index Only Scan using t2_pkey on t2 t2_3
4966                            Index Cond: (id = $2)
4967                ->  Seq Scan on t3 t3_3
4968                      Filter: (id = $2)
4969    ->  CTE Scan on c1_1
4970          Filter: (id = $2)
4971 (53 rows)
4972
4973 /*+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)*/
4974 EXPLAIN (COSTS false)
4975 WITH c1_1(id) AS (
4976 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
4977 )
4978 SELECT t1_1.id, (
4979 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
4980 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
4981 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
4982 ) 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 = (
4983 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 
4984 );
4985 LOG:  pg_hint_plan:
4986 used hint:
4987 HashJoin(t1_1 t3_1)
4988 NestLoop(t1_2 t2_2)
4989 MergeJoin(t1_3 t3_3)
4990 NestLoop(t1_4 t2_4)
4991 NestLoop(t1_5 t2_5)
4992 not used hint:
4993 duplication hint:
4994 error hint:
4995
4996                              QUERY PLAN                             
4997 --------------------------------------------------------------------
4998  Nested Loop
4999    CTE c1_1
5000      ->  Aggregate
5001            ->  Merge Join
5002                  Merge Cond: (t1_5.id = t3_5.id)
5003                  ->  Nested Loop
5004                        ->  Index Only Scan using t2_pkey on t2 t2_5
5005                        ->  Index Only Scan using t1_pkey on t1 t1_5
5006                              Index Cond: (id = t2_5.id)
5007                  ->  Sort
5008                        Sort Key: t3_5.id
5009                        ->  Seq Scan on t3 t3_5
5010    InitPlan 2 (returns $3)
5011      ->  Aggregate
5012            ->  Merge Join
5013                  Merge Cond: (t1_2.id = t3_2.id)
5014                  ->  Nested Loop
5015                        ->  Index Only Scan using t2_pkey on t2 t2_2
5016                        ->  Index Only Scan using t1_pkey on t1 t1_2
5017                              Index Cond: (id = t2_2.id)
5018                  ->  Sort
5019                        Sort Key: t3_2.id
5020                        ->  Seq Scan on t3 t3_2
5021    InitPlan 3 (returns $5)
5022      ->  Aggregate
5023            ->  Merge Join
5024                  Merge Cond: (t1_4.id = t3_4.id)
5025                  ->  Nested Loop
5026                        ->  Index Only Scan using t2_pkey on t2 t2_4
5027                        ->  Index Only Scan using t1_pkey on t1 t1_4
5028                              Index Cond: (id = t2_4.id)
5029                  ->  Sort
5030                        Sort Key: t3_4.id
5031                        ->  Seq Scan on t3 t3_4
5032    ->  Nested Loop
5033          ->  Nested Loop
5034                ->  Nested Loop
5035                      ->  Index Only Scan using t1_pkey on t1 t1_1
5036                            Index Cond: (id = $5)
5037                      ->  Index Only Scan using t2_pkey on t2 t2_1
5038                            Index Cond: (id = $5)
5039                ->  Seq Scan on t3 t3_1
5040                      Filter: (id = $5)
5041          ->  Nested Loop
5042                ->  Nested Loop
5043                      ->  Index Only Scan using t1_pkey on t1 t1_3
5044                            Index Cond: (id = $5)
5045                      ->  Index Only Scan using t2_pkey on t2 t2_3
5046                            Index Cond: (id = $5)
5047                ->  Seq Scan on t3 t3_3
5048                      Filter: (id = $5)
5049    ->  CTE Scan on c1_1
5050          Filter: (id = $5)
5051 (53 rows)
5052
5053 /*+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)*/
5054 EXPLAIN (COSTS false)
5055 WITH c1_1(id) AS (
5056 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
5057 )
5058 SELECT t1_1.id, (
5059 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
5060 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
5061 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
5062 ) 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 = (
5063 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 
5064 );
5065 LOG:  pg_hint_plan:
5066 used hint:
5067 HashJoin(t1_1 t3_1)
5068 NestLoop(t1_2 t2_2)
5069 MergeJoin(t1_3 t3_3)
5070 NestLoop(t1_4 t2_4)
5071 NestLoop(t1_5 t2_5)
5072 not used hint:
5073 Leading(a t1_1 t1_2 t1_4 t1_5)
5074 duplication hint:
5075 error hint:
5076
5077                              QUERY PLAN                             
5078 --------------------------------------------------------------------
5079  Nested Loop
5080    CTE c1_1
5081      ->  Aggregate
5082            ->  Merge Join
5083                  Merge Cond: (t1_5.id = t3_5.id)
5084                  ->  Nested Loop
5085                        ->  Index Only Scan using t2_pkey on t2 t2_5
5086                        ->  Index Only Scan using t1_pkey on t1 t1_5
5087                              Index Cond: (id = t2_5.id)
5088                  ->  Sort
5089                        Sort Key: t3_5.id
5090                        ->  Seq Scan on t3 t3_5
5091    InitPlan 2 (returns $3)
5092      ->  Aggregate
5093            ->  Merge Join
5094                  Merge Cond: (t1_2.id = t3_2.id)
5095                  ->  Nested Loop
5096                        ->  Index Only Scan using t2_pkey on t2 t2_2
5097                        ->  Index Only Scan using t1_pkey on t1 t1_2
5098                              Index Cond: (id = t2_2.id)
5099                  ->  Sort
5100                        Sort Key: t3_2.id
5101                        ->  Seq Scan on t3 t3_2
5102    InitPlan 3 (returns $5)
5103      ->  Aggregate
5104            ->  Merge Join
5105                  Merge Cond: (t1_4.id = t3_4.id)
5106                  ->  Nested Loop
5107                        ->  Index Only Scan using t2_pkey on t2 t2_4
5108                        ->  Index Only Scan using t1_pkey on t1 t1_4
5109                              Index Cond: (id = t2_4.id)
5110                  ->  Sort
5111                        Sort Key: t3_4.id
5112                        ->  Seq Scan on t3 t3_4
5113    ->  Nested Loop
5114          ->  Nested Loop
5115                ->  Nested Loop
5116                      ->  Index Only Scan using t1_pkey on t1 t1_1
5117                            Index Cond: (id = $5)
5118                      ->  Index Only Scan using t2_pkey on t2 t2_1
5119                            Index Cond: (id = $5)
5120                ->  Seq Scan on t3 t3_1
5121                      Filter: (id = $5)
5122          ->  Nested Loop
5123                ->  Nested Loop
5124                      ->  Index Only Scan using t1_pkey on t1 t1_3
5125                            Index Cond: (id = $5)
5126                      ->  Index Only Scan using t2_pkey on t2 t2_3
5127                            Index Cond: (id = $5)
5128                ->  Seq Scan on t3 t3_3
5129                      Filter: (id = $5)
5130    ->  CTE Scan on c1_1
5131          Filter: (id = $5)
5132 (53 rows)
5133
5134 /*+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)*/
5135 EXPLAIN (COSTS false)
5136 WITH c1_1(id) AS (
5137 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
5138 )
5139 SELECT t1_1.id, (
5140 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
5141 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
5142 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
5143 ) 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 = (
5144 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 
5145 );
5146 LOG:  pg_hint_plan:
5147 used hint:
5148 HashJoin(t1_1 t3_1)
5149 NestLoop(t1_2 t2_2)
5150 MergeJoin(t1_3 t3_3)
5151 NestLoop(t1_4 t2_4)
5152 NestLoop(t1_5 t2_5)
5153 not used hint:
5154 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)
5155 duplication hint:
5156 error hint:
5157
5158                              QUERY PLAN                             
5159 --------------------------------------------------------------------
5160  Nested Loop
5161    CTE c1_1
5162      ->  Aggregate
5163            ->  Merge Join
5164                  Merge Cond: (t1_5.id = t3_5.id)
5165                  ->  Nested Loop
5166                        ->  Index Only Scan using t2_pkey on t2 t2_5
5167                        ->  Index Only Scan using t1_pkey on t1 t1_5
5168                              Index Cond: (id = t2_5.id)
5169                  ->  Sort
5170                        Sort Key: t3_5.id
5171                        ->  Seq Scan on t3 t3_5
5172    InitPlan 2 (returns $3)
5173      ->  Aggregate
5174            ->  Merge Join
5175                  Merge Cond: (t1_2.id = t3_2.id)
5176                  ->  Nested Loop
5177                        ->  Index Only Scan using t2_pkey on t2 t2_2
5178                        ->  Index Only Scan using t1_pkey on t1 t1_2
5179                              Index Cond: (id = t2_2.id)
5180                  ->  Sort
5181                        Sort Key: t3_2.id
5182                        ->  Seq Scan on t3 t3_2
5183    InitPlan 3 (returns $5)
5184      ->  Aggregate
5185            ->  Merge Join
5186                  Merge Cond: (t1_4.id = t3_4.id)
5187                  ->  Nested Loop
5188                        ->  Index Only Scan using t2_pkey on t2 t2_4
5189                        ->  Index Only Scan using t1_pkey on t1 t1_4
5190                              Index Cond: (id = t2_4.id)
5191                  ->  Sort
5192                        Sort Key: t3_4.id
5193                        ->  Seq Scan on t3 t3_4
5194    ->  Nested Loop
5195          ->  Nested Loop
5196                ->  Nested Loop
5197                      ->  Index Only Scan using t1_pkey on t1 t1_1
5198                            Index Cond: (id = $5)
5199                      ->  Index Only Scan using t2_pkey on t2 t2_1
5200                            Index Cond: (id = $5)
5201                ->  Seq Scan on t3 t3_1
5202                      Filter: (id = $5)
5203          ->  Nested Loop
5204                ->  Nested Loop
5205                      ->  Index Only Scan using t1_pkey on t1 t1_3
5206                            Index Cond: (id = $5)
5207                      ->  Index Only Scan using t2_pkey on t2 t2_3
5208                            Index Cond: (id = $5)
5209                ->  Seq Scan on t3 t3_3
5210                      Filter: (id = $5)
5211    ->  CTE Scan on c1_1
5212          Filter: (id = $5)
5213 (53 rows)
5214
5215 /*+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)*/
5216 EXPLAIN (COSTS false)
5217 WITH c1_1(id) AS (
5218 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
5219 )
5220 SELECT t1_1.id, (
5221 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
5222 ) FROM t1 t1_1, t2 t2_1, t3 t3_1, (
5223 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
5224 ) 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 = (
5225 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 
5226 );
5227 LOG:  pg_hint_plan:
5228 used hint:
5229 MergeJoin(t1_3 t3_3)
5230 Leading(t3_5 t2_5 t1_5)
5231 Leading(t3_2 t2_2 t1_2)
5232 Leading(t3_4 t2_4 t1_4)
5233 Leading(c1_1 t3_3 t2_3 t1_3 t3_1 t2_1 t1_1)
5234 not used hint:
5235 HashJoin(t1_1 t3_1)
5236 NestLoop(t1_2 t2_2)
5237 NestLoop(t1_4 t2_4)
5238 NestLoop(t1_5 t2_5)
5239 duplication hint:
5240 error hint:
5241
5242                                   QUERY PLAN                                  
5243 ------------------------------------------------------------------------------
5244  Nested Loop
5245    CTE c1_1
5246      ->  Aggregate
5247            ->  Merge Join
5248                  Merge Cond: (t2_5.id = t1_5.id)
5249                  ->  Merge Join
5250                        Merge Cond: (t2_5.id = t3_5.id)
5251                        ->  Index Only Scan using t2_pkey on t2 t2_5
5252                        ->  Sort
5253                              Sort Key: t3_5.id
5254                              ->  Seq Scan on t3 t3_5
5255                  ->  Index Only Scan using t1_pkey on t1 t1_5
5256    InitPlan 2 (returns $1)
5257      ->  Aggregate
5258            ->  Merge Join
5259                  Merge Cond: (t2_2.id = t1_2.id)
5260                  ->  Merge Join
5261                        Merge Cond: (t2_2.id = t3_2.id)
5262                        ->  Index Only Scan using t2_pkey on t2 t2_2
5263                        ->  Sort
5264                              Sort Key: t3_2.id
5265                              ->  Seq Scan on t3 t3_2
5266                  ->  Index Only Scan using t1_pkey on t1 t1_2
5267    InitPlan 3 (returns $2)
5268      ->  Aggregate
5269            ->  Merge Join
5270                  Merge Cond: (t2_4.id = t1_4.id)
5271                  ->  Merge Join
5272                        Merge Cond: (t2_4.id = t3_4.id)
5273                        ->  Index Only Scan using t2_pkey on t2 t2_4
5274                        ->  Sort
5275                              Sort Key: t3_4.id
5276                              ->  Seq Scan on t3 t3_4
5277                  ->  Index Only Scan using t1_pkey on t1 t1_4
5278    ->  Nested Loop
5279          ->  Nested Loop
5280                ->  Nested Loop
5281                      ->  Nested Loop
5282                            ->  Nested Loop
5283                                  ->  Index Only Scan using t1_pkey on t1 t1_3
5284                                        Index Cond: (id = $2)
5285                                  ->  Index Only Scan using t2_pkey on t2 t2_3
5286                                        Index Cond: (id = $2)
5287                            ->  Seq Scan on t3 t3_3
5288                                  Filter: (id = $2)
5289                      ->  CTE Scan on c1_1
5290                            Filter: (id = $2)
5291                ->  Seq Scan on t3 t3_1
5292                      Filter: (id = $2)
5293          ->  Index Only Scan using t2_pkey on t2 t2_1
5294                Index Cond: (id = $2)
5295    ->  Index Only Scan using t1_pkey on t1 t1_1
5296          Index Cond: (id = $2)
5297 (53 rows)
5298
5299 -- ambigous error
5300 EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
5301                    QUERY PLAN                    
5302 -------------------------------------------------
5303  Merge Join
5304    Merge Cond: (t1.id = t2.id)
5305    ->  Merge Join
5306          Merge Cond: (t1.id = t1_1.id)
5307          ->  Index Scan using t1_pkey on t1
5308          ->  Index Scan using t1_pkey on t1 t1_1
5309    ->  Index Scan using t2_pkey on t2
5310 (7 rows)
5311
5312 /*+NestLoop(t1 t2)*/
5313 EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
5314 INFO:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t2)"
5315 DETAIL:  Relation name "t1" is ambiguous.
5316 LOG:  pg_hint_plan:
5317 used hint:
5318 not used hint:
5319 duplication hint:
5320 error hint:
5321 NestLoop(t1 t2)
5322
5323                    QUERY PLAN                    
5324 -------------------------------------------------
5325  Merge Join
5326    Merge Cond: (t1.id = t2.id)
5327    ->  Merge Join
5328          Merge Cond: (t1.id = t1_1.id)
5329          ->  Index Scan using t1_pkey on t1
5330          ->  Index Scan using t1_pkey on t1 t1_1
5331    ->  Index Scan using t2_pkey on t2
5332 (7 rows)
5333
5334 /*+Leading(t1 t2 t1)*/
5335 EXPLAIN (COSTS false) SELECT * FROM t1, s0.t1, t2 WHERE public.t1.id = s0.t1.id AND public.t1.id = t2.id;
5336 INFO:  pg_hint_plan: hint syntax error at or near "Leading(t1 t2 t1)"
5337 DETAIL:  Relation name "t1" is ambiguous.
5338 LOG:  pg_hint_plan:
5339 used hint:
5340 not used hint:
5341 duplication hint:
5342 error hint:
5343 Leading(t1 t2 t1)
5344
5345                    QUERY PLAN                    
5346 -------------------------------------------------
5347  Merge Join
5348    Merge Cond: (t1.id = t2.id)
5349    ->  Merge Join
5350          Merge Cond: (t1.id = t1_1.id)
5351          ->  Index Scan using t1_pkey on t1
5352          ->  Index Scan using t1_pkey on t1 t1_1
5353    ->  Index Scan using t2_pkey on t2
5354 (7 rows)
5355
5356 -- identifier length test
5357 EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
5358                                                   QUERY PLAN                                                  
5359 --------------------------------------------------------------------------------------------------------------
5360  Merge Join
5361    Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
5362    ->  Merge Join
5363          Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id)
5364          ->  Index Scan using t1_pkey on t1 "123456789012345678901234567890123456789012345678901234567890123"
5365          ->  Index Scan using t2_pkey on t2
5366    ->  Sort
5367          Sort Key: t3.id
5368          ->  Seq Scan on t3
5369 (9 rows)
5370
5371 /*+
5372 Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
5373 SeqScan(123456789012345678901234567890123456789012345678901234567890123)
5374 MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
5375 Set(123456789012345678901234567890123456789012345678901234567890123 1)
5376 */
5377 EXPLAIN (COSTS false) SELECT * FROM t1 "123456789012345678901234567890123456789012345678901234567890123" JOIN t2 ON ("123456789012345678901234567890123456789012345678901234567890123".id = t2.id) JOIN t3 ON (t2.id = t3.id);
5378 INFO:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5379 LOG:  pg_hint_plan:
5380 used hint:
5381 SeqScan(123456789012345678901234567890123456789012345678901234567890123)
5382 MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
5383 Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
5384 not used hint:
5385 duplication hint:
5386 error hint:
5387 Set(123456789012345678901234567890123456789012345678901234567890123 1)
5388
5389                                              QUERY PLAN                                             
5390 ----------------------------------------------------------------------------------------------------
5391  Merge Join
5392    Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
5393    ->  Merge Join
5394          Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
5395          ->  Index Scan using t2_pkey on t2
5396          ->  Sort
5397                Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
5398                ->  Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
5399    ->  Sort
5400          Sort Key: t3.id
5401          ->  Seq Scan on t3
5402 (11 rows)
5403
5404 /*+
5405 Leading(1234567890123456789012345678901234567890123456789012345678901234 t2 t3)
5406 SeqScan(1234567890123456789012345678901234567890123456789012345678901234)
5407 MergeJoin(1234567890123456789012345678901234567890123456789012345678901234 t2)
5408 Set(1234567890123456789012345678901234567890123456789012345678901234 1)
5409 Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
5410 */
5411 EXPLAIN (COSTS false) SELECT * FROM t1 "1234567890123456789012345678901234567890123456789012345678901234" JOIN t2 ON ("1234567890123456789012345678901234567890123456789012345678901234".id = t2.id) JOIN t3 ON (t2.id = t3.id);
5412 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5413 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5414 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5415 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5416 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5417 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5418 INFO:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5419 LOG:  pg_hint_plan:
5420 used hint:
5421 SeqScan(123456789012345678901234567890123456789012345678901234567890123)
5422 MergeJoin(123456789012345678901234567890123456789012345678901234567890123 t2)
5423 Leading(123456789012345678901234567890123456789012345678901234567890123 t2 t3)
5424 Set(cursor_tuple_fraction 0.1234567890123456789012345678901234567890123456789012345678901234)
5425 not used hint:
5426 duplication hint:
5427 error hint:
5428 Set(123456789012345678901234567890123456789012345678901234567890123 1)
5429
5430                                              QUERY PLAN                                             
5431 ----------------------------------------------------------------------------------------------------
5432  Merge Join
5433    Merge Cond: ("123456789012345678901234567890123456789012345678901234567890123".id = t3.id)
5434    ->  Merge Join
5435          Merge Cond: (t2.id = "123456789012345678901234567890123456789012345678901234567890123".id)
5436          ->  Index Scan using t2_pkey on t2
5437          ->  Sort
5438                Sort Key: "123456789012345678901234567890123456789012345678901234567890123".id
5439                ->  Seq Scan on t1 "123456789012345678901234567890123456789012345678901234567890123"
5440    ->  Sort
5441          Sort Key: t3.id
5442          ->  Seq Scan on t3
5443 (11 rows)
5444
5445 SET "123456789012345678901234567890123456789012345678901234567890123" TO 1;
5446 ERROR:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5447 SET "1234567890123456789012345678901234567890123456789012345678901234" TO 1;
5448 NOTICE:  identifier "1234567890123456789012345678901234567890123456789012345678901234" will be truncated to "123456789012345678901234567890123456789012345678901234567890123"
5449 ERROR:  unrecognized configuration parameter "123456789012345678901234567890123456789012345678901234567890123"
5450 SET cursor_tuple_fraction TO 1234567890123456789012345678901234567890123456789012345678901234;
5451 ERROR:  1.23457e+63 is outside the valid range for parameter "cursor_tuple_fraction" (0 .. 1)
5452 -- multi error
5453 /*+ Set(enable_seqscan 100)Set(seq_page_cost on)*/
5454 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
5455 INFO:  parameter "enable_seqscan" requires a Boolean value
5456 INFO:  parameter "seq_page_cost" requires a numeric value
5457 LOG:  pg_hint_plan:
5458 used hint:
5459 not used hint:
5460 duplication hint:
5461 error hint:
5462 Set(enable_seqscan 100)
5463 Set(seq_page_cost on)
5464
5465               QUERY PLAN              
5466 --------------------------------------
5467  Merge Join
5468    Merge Cond: (t1.id = t2.id)
5469    ->  Index Scan using t1_pkey on t1
5470    ->  Index Scan using t2_pkey on t2
5471 (4 rows)
5472
5473 -- debug log of candidate index to use IndexScan
5474 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5475                                        QUERY PLAN                                       
5476 ----------------------------------------------------------------------------------------
5477  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
5478    Index Cond: (id = 1)
5479 (2 rows)
5480
5481 /*+IndexScan(t5 t5_id2)*/
5482 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5483 LOG:  available indexes for IndexScan(t5): t5_id2
5484 LOG:  pg_hint_plan:
5485 used hint:
5486 IndexScan(t5 t5_id2)
5487 not used hint:
5488 duplication hint:
5489 error hint:
5490
5491           QUERY PLAN           
5492 -------------------------------
5493  Index Scan using t5_id2 on t5
5494    Index Cond: (id = 1)
5495 (2 rows)
5496
5497 /*+IndexScan(t5 no_exist)*/
5498 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5499 LOG:  available indexes for IndexScan(t5):
5500 LOG:  pg_hint_plan:
5501 used hint:
5502 IndexScan(t5 no_exist)
5503 not used hint:
5504 duplication hint:
5505 error hint:
5506
5507      QUERY PLAN     
5508 --------------------
5509  Seq Scan on t5
5510    Filter: (id = 1)
5511 (2 rows)
5512
5513 /*+IndexScan(t5 t5_id1 t5_id2)*/
5514 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5515 LOG:  available indexes for IndexScan(t5): t5_id2 t5_id1
5516 LOG:  pg_hint_plan:
5517 used hint:
5518 IndexScan(t5 t5_id1 t5_id2)
5519 not used hint:
5520 duplication hint:
5521 error hint:
5522
5523           QUERY PLAN           
5524 -------------------------------
5525  Index Scan using t5_id2 on t5
5526    Index Cond: (id = 1)
5527 (2 rows)
5528
5529 /*+IndexScan(t5 no_exist t5_id2)*/
5530 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5531 LOG:  available indexes for IndexScan(t5): t5_id2
5532 LOG:  pg_hint_plan:
5533 used hint:
5534 IndexScan(t5 no_exist t5_id2)
5535 not used hint:
5536 duplication hint:
5537 error hint:
5538
5539           QUERY PLAN           
5540 -------------------------------
5541  Index Scan using t5_id2 on t5
5542    Index Cond: (id = 1)
5543 (2 rows)
5544
5545 /*+IndexScan(t5 no_exist5 no_exist2)*/
5546 EXPLAIN (COSTS false) SELECT * FROM t5 WHERE t5.id = 1;
5547 LOG:  available indexes for IndexScan(t5):
5548 LOG:  pg_hint_plan:
5549 used hint:
5550 IndexScan(t5 no_exist5 no_exist2)
5551 not used hint:
5552 duplication hint:
5553 error hint:
5554
5555      QUERY PLAN     
5556 --------------------
5557  Seq Scan on t5
5558    Filter: (id = 1)
5559 (2 rows)
5560
5561 -- outer inner
5562 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5563                        QUERY PLAN                       
5564 --------------------------------------------------------
5565  Hash Join
5566    Hash Cond: (t3.val = t2.val)
5567    ->  Seq Scan on t3
5568    ->  Hash
5569          ->  Hash Join
5570                Hash Cond: (t2.id = t1.id)
5571                ->  Seq Scan on t2
5572                ->  Hash
5573                      ->  Index Scan using t1_pkey on t1
5574                            Index Cond: (id < 10)
5575 (10 rows)
5576
5577 /*+Leading((t1))*/
5578 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5579 INFO:  pg_hint_plan: hint syntax error at or near "Leading((t1))"
5580 DETAIL:  Leading hint requires two sets of relations when parentheses nests.
5581 LOG:  pg_hint_plan:
5582 used hint:
5583 not used hint:
5584 duplication hint:
5585 error hint:
5586 Leading((t1))
5587
5588                        QUERY PLAN                       
5589 --------------------------------------------------------
5590  Hash Join
5591    Hash Cond: (t3.val = t2.val)
5592    ->  Seq Scan on t3
5593    ->  Hash
5594          ->  Hash Join
5595                Hash Cond: (t2.id = t1.id)
5596                ->  Seq Scan on t2
5597                ->  Hash
5598                      ->  Index Scan using t1_pkey on t1
5599                            Index Cond: (id < 10)
5600 (10 rows)
5601
5602 /*+Leading((t1 t2))*/
5603 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5604 LOG:  pg_hint_plan:
5605 used hint:
5606 Leading((t1 t2))
5607 not used hint:
5608 duplication hint:
5609 error hint:
5610
5611                  QUERY PLAN                 
5612 --------------------------------------------
5613  Nested Loop
5614    Join Filter: (t2.val = t3.val)
5615    ->  Hash Join
5616          Hash Cond: (t1.id = t2.id)
5617          ->  Index Scan using t1_pkey on t1
5618                Index Cond: (id < 10)
5619          ->  Hash
5620                ->  Seq Scan on t2
5621    ->  Seq Scan on t3
5622 (9 rows)
5623
5624 /*+Leading((t1 t2 t3))*/
5625 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5626 INFO:  pg_hint_plan: hint syntax error at or near "Leading((t1 t2 t3))"
5627 DETAIL:  Leading hint requires two sets of relations when parentheses nests.
5628 LOG:  pg_hint_plan:
5629 used hint:
5630 not used hint:
5631 duplication hint:
5632 error hint:
5633 Leading((t1 t2 t3))
5634
5635                        QUERY PLAN                       
5636 --------------------------------------------------------
5637  Hash Join
5638    Hash Cond: (t3.val = t2.val)
5639    ->  Seq Scan on t3
5640    ->  Hash
5641          ->  Hash Join
5642                Hash Cond: (t2.id = t1.id)
5643                ->  Seq Scan on t2
5644                ->  Hash
5645                      ->  Index Scan using t1_pkey on t1
5646                            Index Cond: (id < 10)
5647 (10 rows)
5648
5649 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.id < 10;
5650                  QUERY PLAN                 
5651 --------------------------------------------
5652  Hash Join
5653    Hash Cond: (t2.id = t1.id)
5654    ->  Seq Scan on t2
5655    ->  Hash
5656          ->  Index Scan using t1_pkey on t1
5657                Index Cond: (id < 10)
5658 (6 rows)
5659
5660 /*+Leading((t1 t2))*/
5661 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.id < 10;
5662 LOG:  pg_hint_plan:
5663 used hint:
5664 Leading((t1 t2))
5665 not used hint:
5666 duplication hint:
5667 error hint:
5668
5669               QUERY PLAN              
5670 --------------------------------------
5671  Hash Join
5672    Hash Cond: (t1.id = t2.id)
5673    ->  Index Scan using t1_pkey on t1
5674          Index Cond: (id < 10)
5675    ->  Hash
5676          ->  Seq Scan on t2
5677 (6 rows)
5678
5679 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5680                        QUERY PLAN                       
5681 --------------------------------------------------------
5682  Hash Join
5683    Hash Cond: (t3.val = t2.val)
5684    ->  Seq Scan on t3
5685    ->  Hash
5686          ->  Hash Join
5687                Hash Cond: (t2.id = t1.id)
5688                ->  Seq Scan on t2
5689                ->  Hash
5690                      ->  Index Scan using t1_pkey on t1
5691                            Index Cond: (id < 10)
5692 (10 rows)
5693
5694 /*+Leading(((t1 t2) t3))*/
5695 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5696 LOG:  pg_hint_plan:
5697 used hint:
5698 Leading(((t1 t2) t3))
5699 not used hint:
5700 duplication hint:
5701 error hint:
5702
5703                  QUERY PLAN                 
5704 --------------------------------------------
5705  Nested Loop
5706    Join Filter: (t2.val = t3.val)
5707    ->  Hash Join
5708          Hash Cond: (t1.id = t2.id)
5709          ->  Index Scan using t1_pkey on t1
5710                Index Cond: (id < 10)
5711          ->  Hash
5712                ->  Seq Scan on t2
5713    ->  Seq Scan on t3
5714 (9 rows)
5715
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                        QUERY PLAN                       
5718 --------------------------------------------------------
5719  Nested Loop
5720    ->  Merge Join
5721          Merge Cond: (t3.id = t4.id)
5722          ->  Nested Loop
5723                Join Filter: (t1.val = t3.val)
5724                ->  Index Scan using t3_pkey on t3
5725                ->  Materialize
5726                      ->  Index Scan using t1_pkey on t1
5727                            Index Cond: (id < 10)
5728          ->  Sort
5729                Sort Key: t4.id
5730                ->  Seq Scan on t4
5731    ->  Index Scan using t2_pkey on t2
5732          Index Cond: (id = t1.id)
5733 (14 rows)
5734
5735 /*+Leading((((t1 t2) t3) t4))*/
5736 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;
5737 LOG:  pg_hint_plan:
5738 used hint:
5739 Leading((((t1 t2) t3) t4))
5740 not used hint:
5741 duplication hint:
5742 error hint:
5743
5744                     QUERY PLAN                    
5745 --------------------------------------------------
5746  Nested Loop
5747    ->  Nested Loop
5748          Join Filter: (t1.val = t3.val)
5749          ->  Hash Join
5750                Hash Cond: (t1.id = t2.id)
5751                ->  Index Scan using t1_pkey on t1
5752                      Index Cond: (id < 10)
5753                ->  Hash
5754                      ->  Seq Scan on t2
5755          ->  Seq Scan on t3
5756    ->  Index Scan using t4_pkey on t4
5757          Index Cond: (id = t3.id)
5758 (12 rows)
5759
5760 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5761                        QUERY PLAN                       
5762 --------------------------------------------------------
5763  Hash Join
5764    Hash Cond: (t3.val = t2.val)
5765    ->  Seq Scan on t3
5766    ->  Hash
5767          ->  Hash Join
5768                Hash Cond: (t2.id = t1.id)
5769                ->  Seq Scan on t2
5770                ->  Hash
5771                      ->  Index Scan using t1_pkey on t1
5772                            Index Cond: (id < 10)
5773 (10 rows)
5774
5775 /*+Leading(((t1 t2) t3))*/
5776 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5777 LOG:  pg_hint_plan:
5778 used hint:
5779 Leading(((t1 t2) t3))
5780 not used hint:
5781 duplication hint:
5782 error hint:
5783
5784                  QUERY PLAN                 
5785 --------------------------------------------
5786  Nested Loop
5787    Join Filter: (t2.val = t3.val)
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                ->  Seq Scan on t2
5794    ->  Seq Scan on t3
5795 (9 rows)
5796
5797 /*+Leading((t1 (t2 t3)))*/
5798 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5799 LOG:  pg_hint_plan:
5800 used hint:
5801 Leading((t1 (t2 t3)))
5802 not used hint:
5803 duplication hint:
5804 error hint:
5805
5806                  QUERY PLAN                 
5807 --------------------------------------------
5808  Hash Join
5809    Hash Cond: (t1.id = t2.id)
5810    ->  Index Scan using t1_pkey on t1
5811          Index Cond: (id < 10)
5812    ->  Hash
5813          ->  Hash Join
5814                Hash Cond: (t2.val = t3.val)
5815                ->  Seq Scan on t2
5816                ->  Hash
5817                      ->  Seq Scan on t3
5818 (10 rows)
5819
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                        QUERY PLAN                       
5822 --------------------------------------------------------
5823  Nested Loop
5824    ->  Merge Join
5825          Merge Cond: (t3.id = t4.id)
5826          ->  Nested Loop
5827                Join Filter: (t1.val = t3.val)
5828                ->  Index Scan using t3_pkey on t3
5829                ->  Materialize
5830                      ->  Index Scan using t1_pkey on t1
5831                            Index Cond: (id < 10)
5832          ->  Sort
5833                Sort Key: t4.id
5834                ->  Seq Scan on t4
5835    ->  Index Scan using t2_pkey on t2
5836          Index Cond: (id = t1.id)
5837 (14 rows)
5838
5839 /*+Leading(((t1 t2) (t3 t4)))*/
5840 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;
5841 LOG:  pg_hint_plan:
5842 used hint:
5843 Leading(((t1 t2) (t3 t4)))
5844 not used hint:
5845 duplication hint:
5846 error hint:
5847
5848                  QUERY PLAN                 
5849 --------------------------------------------
5850  Nested Loop
5851    Join Filter: (t1.val = t3.val)
5852    ->  Hash Join
5853          Hash Cond: (t1.id = t2.id)
5854          ->  Index Scan using t1_pkey on t1
5855                Index Cond: (id < 10)
5856          ->  Hash
5857                ->  Seq Scan on t2
5858    ->  Merge Join
5859          Merge Cond: (t3.id = t4.id)
5860          ->  Index Scan using t3_pkey on t3
5861          ->  Sort
5862                Sort Key: t4.id
5863                ->  Seq Scan on t4
5864 (14 rows)
5865
5866 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);
5867                              QUERY PLAN                             
5868 --------------------------------------------------------------------
5869  Hash Join
5870    Hash Cond: (t2.val = t3.val)
5871    InitPlan 1 (returns $1)
5872      ->  Limit
5873            ->  Sort
5874                  Sort Key: t1_2.id
5875                  ->  Nested Loop
5876                        ->  Index Scan using t2_val on t2 t2_2
5877                              Index Cond: (val > 100)
5878                        ->  Index Only Scan using t1_pkey on t1 t1_2
5879                              Index Cond: (id = t2_2.id)
5880    ->  Merge Join
5881          Merge Cond: (t1.id = t2.id)
5882          ->  Index Scan using t1_pkey on t1
5883                Index Cond: (id < $1)
5884          ->  Index Scan using t2_pkey on t2
5885    ->  Hash
5886          ->  Seq Scan on t3
5887 (18 rows)
5888
5889 /*+Leading(((t1 t2) t3)) Leading(((t3 t1) t2))*/
5890 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);
5891 INFO:  pg_hint_plan: hint syntax error at or near "Leading(((t1 t2) t3)) Leading(((t3 t1) t2))"
5892 DETAIL:  Conflict leading hint.
5893 LOG:  pg_hint_plan:
5894 used hint:
5895 Leading(((t3 t1) t2))
5896 not used hint:
5897 duplication hint:
5898 Leading(((t1 t2) t3))
5899 error hint:
5900
5901                              QUERY PLAN                             
5902 --------------------------------------------------------------------
5903  Hash Join
5904    Hash Cond: (t1.id = t2.id)
5905    InitPlan 1 (returns $1)
5906      ->  Limit
5907            ->  Sort
5908                  Sort Key: t1_2.id
5909                  ->  Nested Loop
5910                        ->  Index Scan using t2_val on t2 t2_2
5911                              Index Cond: (val > 100)
5912                        ->  Index Only Scan using t1_pkey on t1 t1_2
5913                              Index Cond: (id = t2_2.id)
5914    ->  Hash Join
5915          Hash Cond: (t3.val = t1.val)
5916          ->  Seq Scan on t3
5917          ->  Hash
5918                ->  Index Scan using t1_pkey on t1
5919                      Index Cond: (id < $1)
5920    ->  Hash
5921          ->  Seq Scan on t2
5922 (19 rows)
5923
5924 /*+Leading(((t1 t2) t3)) Leading((t1_2 t2_2))*/
5925 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);
5926 LOG:  pg_hint_plan:
5927 used hint:
5928 Leading(((t1 t2) t3))
5929 Leading((t1_2 t2_2))
5930 not used hint:
5931 duplication hint:
5932 error hint:
5933
5934                           QUERY PLAN                          
5935 --------------------------------------------------------------
5936  Hash Join
5937    Hash Cond: (t2.val = t3.val)
5938    InitPlan 1 (returns $0)
5939      ->  Limit
5940            ->  Merge Join
5941                  Merge Cond: (t1_2.id = t2_2.id)
5942                  ->  Index Only Scan using t1_pkey on t1 t1_2
5943                  ->  Sort
5944                        Sort Key: t2_2.id
5945                        ->  Index Scan using t2_val on t2 t2_2
5946                              Index Cond: (val > 100)
5947    ->  Merge Join
5948          Merge Cond: (t1.id = t2.id)
5949          ->  Index Scan using t1_pkey on t1
5950                Index Cond: (id < $0)
5951          ->  Index Scan using t2_pkey on t2
5952    ->  Hash
5953          ->  Seq Scan on t3
5954 (18 rows)
5955
5956 /*+Leading(((((t1 t2) t3) t1_2) t2_2))*/
5957 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);
5958 LOG:  pg_hint_plan:
5959 used hint:
5960 not used hint:
5961 Leading(((((t1 t2) t3) t1_2) t2_2))
5962 duplication hint:
5963 error hint:
5964
5965                              QUERY PLAN                             
5966 --------------------------------------------------------------------
5967  Hash Join
5968    Hash Cond: (t2.val = t3.val)
5969    InitPlan 1 (returns $1)
5970      ->  Limit
5971            ->  Sort
5972                  Sort Key: t1_2.id
5973                  ->  Nested Loop
5974                        ->  Index Scan using t2_val on t2 t2_2
5975                              Index Cond: (val > 100)
5976                        ->  Index Only Scan using t1_pkey on t1 t1_2
5977                              Index Cond: (id = t2_2.id)
5978    ->  Merge Join
5979          Merge Cond: (t1.id = t2.id)
5980          ->  Index Scan using t1_pkey on t1
5981                Index Cond: (id < $1)
5982          ->  Index Scan using t2_pkey on t2
5983    ->  Hash
5984          ->  Seq Scan on t3
5985 (18 rows)
5986
5987 -- Specified outer/inner leading hint and join method hint at the same time
5988 /*+Leading(((t1 t2) t3))*/
5989 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
5990 LOG:  pg_hint_plan:
5991 used hint:
5992 Leading(((t1 t2) t3))
5993 not used hint:
5994 duplication hint:
5995 error hint:
5996
5997                  QUERY PLAN                 
5998 --------------------------------------------
5999  Nested Loop
6000    Join Filter: (t2.val = t3.val)
6001    ->  Hash Join
6002          Hash Cond: (t1.id = t2.id)
6003          ->  Index Scan using t1_pkey on t1
6004                Index Cond: (id < 10)
6005          ->  Hash
6006                ->  Seq Scan on t2
6007    ->  Seq Scan on t3
6008 (9 rows)
6009
6010 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t2)*/
6011 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6012 LOG:  pg_hint_plan:
6013 used hint:
6014 MergeJoin(t1 t2)
6015 Leading(((t1 t2) t3))
6016 not used hint:
6017 duplication hint:
6018 error hint:
6019
6020                  QUERY PLAN                 
6021 --------------------------------------------
6022  Nested Loop
6023    Join Filter: (t2.val = t3.val)
6024    ->  Merge Join
6025          Merge Cond: (t1.id = t2.id)
6026          ->  Index Scan using t1_pkey on t1
6027                Index Cond: (id < 10)
6028          ->  Index Scan using t2_pkey on t2
6029    ->  Seq Scan on t3
6030 (8 rows)
6031
6032 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t2 t3)*/
6033 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6034 LOG:  pg_hint_plan:
6035 used hint:
6036 MergeJoin(t1 t2 t3)
6037 Leading(((t1 t2) t3))
6038 not used hint:
6039 duplication hint:
6040 error hint:
6041
6042                     QUERY PLAN                    
6043 --------------------------------------------------
6044  Merge Join
6045    Merge Cond: (t2.val = t3.val)
6046    ->  Sort
6047          Sort Key: t2.val
6048          ->  Hash Join
6049                Hash Cond: (t1.id = t2.id)
6050                ->  Index Scan using t1_pkey on t1
6051                      Index Cond: (id < 10)
6052                ->  Hash
6053                      ->  Seq Scan on t2
6054    ->  Sort
6055          Sort Key: t3.val
6056          ->  Seq Scan on t3
6057 (13 rows)
6058
6059 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t3)*/
6060 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6061 LOG:  pg_hint_plan:
6062 used hint:
6063 Leading(((t1 t2) t3))
6064 not used hint:
6065 MergeJoin(t1 t3)
6066 duplication hint:
6067 error hint:
6068
6069                  QUERY PLAN                 
6070 --------------------------------------------
6071  Nested Loop
6072    Join Filter: (t2.val = t3.val)
6073    ->  Hash Join
6074          Hash Cond: (t1.id = t2.id)
6075          ->  Index Scan using t1_pkey on t1
6076                Index Cond: (id < 10)
6077          ->  Hash
6078                ->  Seq Scan on t2
6079    ->  Seq Scan on t3
6080 (9 rows)
6081
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                        QUERY PLAN                       
6084 --------------------------------------------------------
6085  Nested Loop
6086    ->  Merge Join
6087          Merge Cond: (t3.id = t4.id)
6088          ->  Nested Loop
6089                Join Filter: (t1.val = t3.val)
6090                ->  Index Scan using t3_pkey on t3
6091                ->  Materialize
6092                      ->  Index Scan using t1_pkey on t1
6093                            Index Cond: (id < 10)
6094          ->  Sort
6095                Sort Key: t4.id
6096                ->  Seq Scan on t4
6097    ->  Index Scan using t2_pkey on t2
6098          Index Cond: (id = t1.id)
6099 (14 rows)
6100
6101 /*+Leading(((t1 t2) t3)) MergeJoin(t3 t4)*/
6102 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;
6103 LOG:  pg_hint_plan:
6104 used hint:
6105 Leading(((t1 t2) t3))
6106 not used hint:
6107 MergeJoin(t3 t4)
6108 duplication hint:
6109 error hint:
6110
6111                     QUERY PLAN                    
6112 --------------------------------------------------
6113  Nested Loop
6114    Join Filter: (t3.id = t4.id)
6115    ->  Nested Loop
6116          Join Filter: (t1.val = t3.val)
6117          ->  Hash Join
6118                Hash Cond: (t1.id = t2.id)
6119                ->  Index Scan using t1_pkey on t1
6120                      Index Cond: (id < 10)
6121                ->  Hash
6122                      ->  Seq Scan on t2
6123          ->  Seq Scan on t3
6124    ->  Seq Scan on t4
6125 (12 rows)
6126
6127 /*+Leading(((t1 t2) t3)) MergeJoin(t1 t2 t3 t4)*/
6128 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;
6129 LOG:  pg_hint_plan:
6130 used hint:
6131 MergeJoin(t1 t2 t3 t4)
6132 Leading(((t1 t2) t3))
6133 not used hint:
6134 duplication hint:
6135 error hint:
6136
6137                        QUERY PLAN                       
6138 --------------------------------------------------------
6139  Merge Join
6140    Merge Cond: (t3.id = t4.id)
6141    ->  Sort
6142          Sort Key: t3.id
6143          ->  Nested Loop
6144                Join Filter: (t1.val = t3.val)
6145                ->  Hash Join
6146                      Hash Cond: (t1.id = t2.id)
6147                      ->  Index Scan using t1_pkey on t1
6148                            Index Cond: (id < 10)
6149                      ->  Hash
6150                            ->  Seq Scan on t2
6151                ->  Seq Scan on t3
6152    ->  Sort
6153          Sort Key: t4.id
6154          ->  Seq Scan on t4
6155 (16 rows)
6156
6157 /*+ Leading ( ( t1 ( t2 t3 ) ) ) */
6158 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6159 LOG:  pg_hint_plan:
6160 used hint:
6161 Leading((t1 (t2 t3)))
6162 not used hint:
6163 duplication hint:
6164 error hint:
6165
6166                  QUERY PLAN                 
6167 --------------------------------------------
6168  Hash Join
6169    Hash Cond: (t1.id = t2.id)
6170    ->  Index Scan using t1_pkey on t1
6171          Index Cond: (id < 10)
6172    ->  Hash
6173          ->  Hash Join
6174                Hash Cond: (t2.val = t3.val)
6175                ->  Seq Scan on t2
6176                ->  Hash
6177                      ->  Seq Scan on t3
6178 (10 rows)
6179
6180 /*+Leading((t1(t2 t3)))*/
6181 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6182 LOG:  pg_hint_plan:
6183 used hint:
6184 Leading((t1 (t2 t3)))
6185 not used hint:
6186 duplication hint:
6187 error hint:
6188
6189                  QUERY PLAN                 
6190 --------------------------------------------
6191  Hash Join
6192    Hash Cond: (t1.id = t2.id)
6193    ->  Index Scan using t1_pkey on t1
6194          Index Cond: (id < 10)
6195    ->  Hash
6196          ->  Hash Join
6197                Hash Cond: (t2.val = t3.val)
6198                ->  Seq Scan on t2
6199                ->  Hash
6200                      ->  Seq Scan on t3
6201 (10 rows)
6202
6203 /*+Leading(("t1(t2" "t3)"))*/
6204 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6205 LOG:  pg_hint_plan:
6206 used hint:
6207 not used hint:
6208 Leading(("t1(t2" "t3)"))
6209 duplication hint:
6210 error hint:
6211
6212                        QUERY PLAN                       
6213 --------------------------------------------------------
6214  Hash Join
6215    Hash Cond: (t3.val = t2.val)
6216    ->  Seq Scan on t3
6217    ->  Hash
6218          ->  Hash Join
6219                Hash Cond: (t2.id = t1.id)
6220                ->  Seq Scan on t2
6221                ->  Hash
6222                      ->  Index Scan using t1_pkey on t1
6223                            Index Cond: (id < 10)
6224 (10 rows)
6225
6226 /*+ Leading ( ( ( t1 t2 ) t3 ) ) */
6227 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6228 LOG:  pg_hint_plan:
6229 used hint:
6230 Leading(((t1 t2) t3))
6231 not used hint:
6232 duplication hint:
6233 error hint:
6234
6235                  QUERY PLAN                 
6236 --------------------------------------------
6237  Nested Loop
6238    Join Filter: (t2.val = t3.val)
6239    ->  Hash Join
6240          Hash Cond: (t1.id = t2.id)
6241          ->  Index Scan using t1_pkey on t1
6242                Index Cond: (id < 10)
6243          ->  Hash
6244                ->  Seq Scan on t2
6245    ->  Seq Scan on t3
6246 (9 rows)
6247
6248 /*+Leading(((t1 t2)t3))*/
6249 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6250 LOG:  pg_hint_plan:
6251 used hint:
6252 Leading(((t1 t2) t3))
6253 not used hint:
6254 duplication hint:
6255 error hint:
6256
6257                  QUERY PLAN                 
6258 --------------------------------------------
6259  Nested Loop
6260    Join Filter: (t2.val = t3.val)
6261    ->  Hash Join
6262          Hash Cond: (t1.id = t2.id)
6263          ->  Index Scan using t1_pkey on t1
6264                Index Cond: (id < 10)
6265          ->  Hash
6266                ->  Seq Scan on t2
6267    ->  Seq Scan on t3
6268 (9 rows)
6269
6270 /*+Leading(("(t1" "t2)t3"))*/
6271 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.val = t3.val AND t1.id < 10;
6272 LOG:  pg_hint_plan:
6273 used hint:
6274 not used hint:
6275 Leading(("(t1" "t2)t3"))
6276 duplication hint:
6277 error hint:
6278
6279                        QUERY PLAN                       
6280 --------------------------------------------------------
6281  Hash Join
6282    Hash Cond: (t3.val = t2.val)
6283    ->  Seq Scan on t3
6284    ->  Hash
6285          ->  Hash Join
6286                Hash Cond: (t2.id = t1.id)
6287                ->  Seq Scan on t2
6288                ->  Hash
6289                      ->  Index Scan using t1_pkey on t1
6290                            Index Cond: (id < 10)
6291 (10 rows)
6292
6293 /*+Leading((t1(t2(t3(t4 t5)))))*/
6294 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;
6295 LOG:  pg_hint_plan:
6296 used hint:
6297 Leading((t1 (t2 (t3 (t4 t5)))))
6298 not used hint:
6299 duplication hint:
6300 error hint:
6301
6302                                                             QUERY PLAN                                                            
6303 ----------------------------------------------------------------------------------------------------------------------------------
6304  Merge Join
6305    Merge Cond: (t1.id = t2.id)
6306    ->  Index Scan using t1_pkey on t1
6307    ->  Materialize
6308          ->  Merge Join
6309                Merge Cond: (t2.id = t3.id)
6310                ->  Index Scan using t2_pkey on t2
6311                ->  Materialize
6312                      ->  Merge Join
6313                            Merge Cond: (t3.id = t4.id)
6314                            ->  Index Scan using t3_pkey on t3
6315                            ->  Materialize
6316                                  ->  Merge Join
6317                                        Merge Cond: (t4.id = t5.id)
6318                                        ->  Index Scan using t4_pkey on t4
6319                                        ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6320 (16 rows)
6321
6322 /*+Leading((t5(t4(t3(t2 t1)))))*/
6323 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;
6324 LOG:  pg_hint_plan:
6325 used hint:
6326 Leading((t5 (t4 (t3 (t2 t1)))))
6327 not used hint:
6328 duplication hint:
6329 error hint:
6330
6331                                 QUERY PLAN                                
6332 --------------------------------------------------------------------------
6333  Hash Join
6334    Hash Cond: (t5.id = t1.id)
6335    ->  Seq Scan on t5
6336    ->  Hash
6337          ->  Merge Join
6338                Merge Cond: (t4.id = t1.id)
6339                ->  Sort
6340                      Sort Key: t4.id
6341                      ->  Seq Scan on t4
6342                ->  Materialize
6343                      ->  Merge Join
6344                            Merge Cond: (t3.id = t1.id)
6345                            ->  Sort
6346                                  Sort Key: t3.id
6347                                  ->  Seq Scan on t3
6348                            ->  Materialize
6349                                  ->  Merge Join
6350                                        Merge Cond: (t2.id = t1.id)
6351                                        ->  Index Scan using t2_pkey on t2
6352                                        ->  Index Scan using t1_pkey on t1
6353 (20 rows)
6354
6355 /*+Leading(((((t1 t2)t3)t4)t5))*/
6356 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;
6357 LOG:  pg_hint_plan:
6358 used hint:
6359 Leading(((((t1 t2) t3) t4) t5))
6360 not used hint:
6361 duplication hint:
6362 error hint:
6363
6364                                           QUERY PLAN                                          
6365 ----------------------------------------------------------------------------------------------
6366  Nested Loop
6367    ->  Merge Join
6368          Merge Cond: (t1.id = t4.id)
6369          ->  Merge Join
6370                Merge Cond: (t1.id = t3.id)
6371                ->  Merge Join
6372                      Merge Cond: (t1.id = t2.id)
6373                      ->  Index Scan using t1_pkey on t1
6374                      ->  Index Scan using t2_pkey on t2
6375                ->  Sort
6376                      Sort Key: t3.id
6377                      ->  Seq Scan on t3
6378          ->  Sort
6379                Sort Key: t4.id
6380                ->  Seq Scan on t4
6381    ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6382          Index Cond: (id = t1.id)
6383 (17 rows)
6384
6385 /*+Leading(((((t5 t4)t3)t2)t1))*/
6386 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;
6387 LOG:  pg_hint_plan:
6388 used hint:
6389 Leading(((((t5 t4) t3) t2) t1))
6390 not used hint:
6391 duplication hint:
6392 error hint:
6393
6394                                                    QUERY PLAN                                                   
6395 ----------------------------------------------------------------------------------------------------------------
6396  Nested Loop
6397    Join Filter: (t2.id = t1.id)
6398    ->  Nested Loop
6399          Join Filter: (t3.id = t2.id)
6400          ->  Merge Join
6401                Merge Cond: (t4.id = t3.id)
6402                ->  Merge Join
6403                      Merge Cond: (t5.id = t4.id)
6404                      ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6405                      ->  Sort
6406                            Sort Key: t4.id
6407                            ->  Seq Scan on t4
6408                ->  Index Scan using t3_pkey on t3
6409          ->  Index Scan using t2_pkey on t2
6410                Index Cond: (id = t5.id)
6411    ->  Index Scan using t1_pkey on t1
6412          Index Cond: (id = t5.id)
6413 (17 rows)
6414
6415 /*+Leading(((t1 t2)(t3(t4 t5))))*/
6416 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;
6417 LOG:  pg_hint_plan:
6418 used hint:
6419 Leading(((t1 t2) (t3 (t4 t5))))
6420 not used hint:
6421 duplication hint:
6422 error hint:
6423
6424                                                       QUERY PLAN                                                      
6425 ----------------------------------------------------------------------------------------------------------------------
6426  Merge Join
6427    Merge Cond: (t1.id = t3.id)
6428    ->  Merge Join
6429          Merge Cond: (t1.id = t2.id)
6430          ->  Index Scan using t1_pkey on t1
6431          ->  Index Scan using t2_pkey on t2
6432    ->  Materialize
6433          ->  Merge Join
6434                Merge Cond: (t3.id = t4.id)
6435                ->  Index Scan using t3_pkey on t3
6436                ->  Materialize
6437                      ->  Merge Join
6438                            Merge Cond: (t4.id = t5.id)
6439                            ->  Index Scan using t4_pkey on t4
6440                            ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6441 (15 rows)
6442
6443 /*+Leading(((t5 t4)(t3(t2 t1))))*/
6444 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;
6445 LOG:  pg_hint_plan:
6446 used hint:
6447 Leading(((t5 t4) (t3 (t2 t1))))
6448 not used hint:
6449 duplication hint:
6450 error hint:
6451
6452                                              QUERY PLAN                                             
6453 ----------------------------------------------------------------------------------------------------
6454  Merge Join
6455    Merge Cond: (t4.id = t1.id)
6456    ->  Merge Join
6457          Merge Cond: (t5.id = t4.id)
6458          ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6459          ->  Sort
6460                Sort Key: t4.id
6461                ->  Seq Scan on t4
6462    ->  Materialize
6463          ->  Merge Join
6464                Merge Cond: (t3.id = t1.id)
6465                ->  Sort
6466                      Sort Key: t3.id
6467                      ->  Seq Scan on t3
6468                ->  Materialize
6469                      ->  Merge Join
6470                            Merge Cond: (t2.id = t1.id)
6471                            ->  Index Scan using t2_pkey on t2
6472                            ->  Index Scan using t1_pkey on t1
6473 (19 rows)
6474
6475 /*+Leading((((t1 t2)t3)(t4 t5)))*/
6476 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;
6477 LOG:  pg_hint_plan:
6478 used hint:
6479 Leading((((t1 t2) t3) (t4 t5)))
6480 not used hint:
6481 duplication hint:
6482 error hint:
6483
6484                                                 QUERY PLAN                                                
6485 ----------------------------------------------------------------------------------------------------------
6486  Merge Join
6487    Merge Cond: (t1.id = t4.id)
6488    ->  Merge Join
6489          Merge Cond: (t1.id = t3.id)
6490          ->  Merge Join
6491                Merge Cond: (t1.id = t2.id)
6492                ->  Index Scan using t1_pkey on t1
6493                ->  Index Scan using t2_pkey on t2
6494          ->  Sort
6495                Sort Key: t3.id
6496                ->  Seq Scan on t3
6497    ->  Materialize
6498          ->  Merge Join
6499                Merge Cond: (t4.id = t5.id)
6500                ->  Index Scan using t4_pkey on t4
6501                ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6502 (16 rows)
6503
6504 /*+Leading((((t5 t4)t3)(t2 t1)))*/
6505 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;
6506 LOG:  pg_hint_plan:
6507 used hint:
6508 Leading((((t5 t4) t3) (t2 t1)))
6509 not used hint:
6510 duplication hint:
6511 error hint:
6512
6513                                                 QUERY PLAN                                                
6514 ----------------------------------------------------------------------------------------------------------
6515  Merge Join
6516    Merge Cond: (t3.id = t1.id)
6517    ->  Merge Join
6518          Merge Cond: (t4.id = t3.id)
6519          ->  Merge Join
6520                Merge Cond: (t5.id = t4.id)
6521                ->  Index Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
6522                ->  Sort
6523                      Sort Key: t4.id
6524                      ->  Seq Scan on t4
6525          ->  Index Scan using t3_pkey on t3
6526    ->  Materialize
6527          ->  Merge Join
6528                Merge Cond: (t2.id = t1.id)
6529                ->  Index Scan using t2_pkey on t2
6530                ->  Index Scan using t1_pkey on t1
6531 (16 rows)
6532
6533 -- inherite table test to specify the index's name
6534 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6535                               QUERY PLAN                               
6536 -----------------------------------------------------------------------
6537  Append
6538    ->  Seq Scan on p2
6539          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6540    ->  Seq Scan on p2_c1
6541          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6542    ->  Seq Scan on p2_c1_c1
6543          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6544    ->  Seq Scan on p2_c1_c2
6545          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6546 (9 rows)
6547
6548 /*+IndexScan(p2 p2_pkey)*/
6549 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6550 LOG:  available indexes for IndexScan(p2): p2_pkey
6551 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6552 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6553 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6554 LOG:  pg_hint_plan:
6555 used hint:
6556 IndexScan(p2 p2_pkey)
6557 not used hint:
6558 duplication hint:
6559 error hint:
6560
6561                     QUERY PLAN                    
6562 --------------------------------------------------
6563  Append
6564    ->  Index Scan using p2_pkey on p2
6565          Index Cond: ((id >= 50) AND (id <= 51))
6566          Filter: (ctid = '(1,1)'::tid)
6567    ->  Index Scan using p2_c1_pkey on p2_c1
6568          Index Cond: ((id >= 50) AND (id <= 51))
6569          Filter: (ctid = '(1,1)'::tid)
6570    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1
6571          Index Cond: ((id >= 50) AND (id <= 51))
6572          Filter: (ctid = '(1,1)'::tid)
6573    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2
6574          Index Cond: ((id >= 50) AND (id <= 51))
6575          Filter: (ctid = '(1,1)'::tid)
6576 (13 rows)
6577
6578 /*+IndexScan(p2 p2_id_val_idx)*/
6579 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6580 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
6581 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
6582 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
6583 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
6584 LOG:  pg_hint_plan:
6585 used hint:
6586 IndexScan(p2 p2_id_val_idx)
6587 not used hint:
6588 duplication hint:
6589 error hint:
6590
6591                        QUERY PLAN                       
6592 --------------------------------------------------------
6593  Append
6594    ->  Index Scan using p2_id_val_idx on p2
6595          Index Cond: ((id >= 50) AND (id <= 51))
6596          Filter: (ctid = '(1,1)'::tid)
6597    ->  Index Scan using p2_c1_id_val_idx on p2_c1
6598          Index Cond: ((id >= 50) AND (id <= 51))
6599          Filter: (ctid = '(1,1)'::tid)
6600    ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1
6601          Index Cond: ((id >= 50) AND (id <= 51))
6602          Filter: (ctid = '(1,1)'::tid)
6603    ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2
6604          Index Cond: ((id >= 50) AND (id <= 51))
6605          Filter: (ctid = '(1,1)'::tid)
6606 (13 rows)
6607
6608 /*+IndexScan(p2 p2_val_id_idx)*/
6609 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6610 LOG:  available indexes for IndexScan(p2): p2_val_id_idx
6611 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_id_idx
6612 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_id_idx
6613 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_id_idx
6614 LOG:  pg_hint_plan:
6615 used hint:
6616 IndexScan(p2 p2_val_id_idx)
6617 not used hint:
6618 duplication hint:
6619 error hint:
6620
6621                        QUERY PLAN                       
6622 --------------------------------------------------------
6623  Append
6624    ->  Index Scan using p2_val_id_idx on p2
6625          Index Cond: ((id >= 50) AND (id <= 51))
6626          Filter: (ctid = '(1,1)'::tid)
6627    ->  Index Scan using p2_c1_val_id_idx on p2_c1
6628          Index Cond: ((id >= 50) AND (id <= 51))
6629          Filter: (ctid = '(1,1)'::tid)
6630    ->  Index Scan using p2_c1_c1_val_id_idx on p2_c1_c1
6631          Index Cond: ((id >= 50) AND (id <= 51))
6632          Filter: (ctid = '(1,1)'::tid)
6633    ->  Index Scan using p2_c1_c2_val_id_idx on p2_c1_c2
6634          Index Cond: ((id >= 50) AND (id <= 51))
6635          Filter: (ctid = '(1,1)'::tid)
6636 (13 rows)
6637
6638 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
6639                                        QUERY PLAN                                        
6640 -----------------------------------------------------------------------------------------
6641  Append
6642    ->  Seq Scan on p2
6643          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6644    ->  Seq Scan on p2_c1
6645          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6646    ->  Seq Scan on p2_c2
6647          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6648    ->  Seq Scan on p2_c3
6649          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6650    ->  Seq Scan on p2_c4
6651          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6652    ->  Seq Scan on p2_c1_c1
6653          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6654    ->  Seq Scan on p2_c1_c2
6655          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6656    ->  Seq Scan on p2_c3_c1
6657          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6658    ->  Seq Scan on p2_c3_c2
6659          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6660 (19 rows)
6661
6662 -- Inhibit parallel exection to avoid interfaring the hint
6663 set max_parallel_workers_per_gather to 0;
6664 /*+ IndexScan(p2 p2_val)*/
6665 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
6666 LOG:  available indexes for IndexScan(p2):
6667 LOG:  available indexes for IndexScan(p2_c1):
6668 LOG:  available indexes for IndexScan(p2_c2):
6669 LOG:  available indexes for IndexScan(p2_c3):
6670 LOG:  available indexes for IndexScan(p2_c4):
6671 LOG:  available indexes for IndexScan(p2_c1_c1):
6672 LOG:  available indexes for IndexScan(p2_c1_c2):
6673 LOG:  available indexes for IndexScan(p2_c3_c1):
6674 LOG:  available indexes for IndexScan(p2_c3_c2):
6675 LOG:  pg_hint_plan:
6676 used hint:
6677 IndexScan(p2 p2_val)
6678 not used hint:
6679 duplication hint:
6680 error hint:
6681
6682                                        QUERY PLAN                                        
6683 -----------------------------------------------------------------------------------------
6684  Append
6685    ->  Seq Scan on p2
6686          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6687    ->  Seq Scan on p2_c1
6688          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6689    ->  Seq Scan on p2_c2
6690          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6691    ->  Seq Scan on p2_c3
6692          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6693    ->  Seq Scan on p2_c4
6694          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6695    ->  Seq Scan on p2_c1_c1
6696          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6697    ->  Seq Scan on p2_c1_c2
6698          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6699    ->  Seq Scan on p2_c3_c1
6700          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6701    ->  Seq Scan on p2_c3_c2
6702          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
6703 (19 rows)
6704
6705 /*+IndexScan(p2 p2_pkey)*/
6706 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6707 LOG:  available indexes for IndexScan(p2): p2_pkey
6708 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6709 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6710 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6711 LOG:  pg_hint_plan:
6712 used hint:
6713 IndexScan(p2 p2_pkey)
6714 not used hint:
6715 duplication hint:
6716 error hint:
6717
6718                     QUERY PLAN                    
6719 --------------------------------------------------
6720  Append
6721    ->  Index Scan using p2_pkey on p2
6722          Index Cond: ((id >= 50) AND (id <= 51))
6723          Filter: (ctid = '(1,1)'::tid)
6724    ->  Index Scan using p2_c1_pkey on p2_c1
6725          Index Cond: ((id >= 50) AND (id <= 51))
6726          Filter: (ctid = '(1,1)'::tid)
6727    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1
6728          Index Cond: ((id >= 50) AND (id <= 51))
6729          Filter: (ctid = '(1,1)'::tid)
6730    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2
6731          Index Cond: ((id >= 50) AND (id <= 51))
6732          Filter: (ctid = '(1,1)'::tid)
6733 (13 rows)
6734
6735 /*+IndexScan(p2 p2_id2_val)*/
6736 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6737 LOG:  available indexes for IndexScan(p2): p2_id2_val
6738 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id2_val
6739 LOG:  available indexes for IndexScan(p2_c1_c1):
6740 LOG:  available indexes for IndexScan(p2_c1_c2):
6741 LOG:  pg_hint_plan:
6742 used hint:
6743 IndexScan(p2 p2_id2_val)
6744 not used hint:
6745 duplication hint:
6746 error hint:
6747
6748                               QUERY PLAN                               
6749 -----------------------------------------------------------------------
6750  Append
6751    ->  Index Scan using p2_id2_val on p2
6752          Index Cond: ((id >= 50) AND (id <= 51))
6753          Filter: (ctid = '(1,1)'::tid)
6754    ->  Index Scan using p2_c1_id2_val on p2_c1
6755          Index Cond: ((id >= 50) AND (id <= 51))
6756          Filter: (ctid = '(1,1)'::tid)
6757    ->  Seq Scan on p2_c1_c1
6758          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6759    ->  Seq Scan on p2_c1_c2
6760          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6761 (11 rows)
6762
6763 /*+IndexScan(p2 p2_val2_id)*/
6764 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6765 LOG:  available indexes for IndexScan(p2): p2_val2_id
6766 LOG:  available indexes for IndexScan(p2_c1):
6767 LOG:  available indexes for IndexScan(p2_c1_c1):
6768 LOG:  available indexes for IndexScan(p2_c1_c2):
6769 LOG:  pg_hint_plan:
6770 used hint:
6771 IndexScan(p2 p2_val2_id)
6772 not used hint:
6773 duplication hint:
6774 error hint:
6775
6776                               QUERY PLAN                               
6777 -----------------------------------------------------------------------
6778  Append
6779    ->  Index Scan using p2_val2_id on p2
6780          Index Cond: ((id >= 50) AND (id <= 51))
6781          Filter: (ctid = '(1,1)'::tid)
6782    ->  Seq Scan on p2_c1
6783          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6784    ->  Seq Scan on p2_c1_c1
6785          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6786    ->  Seq Scan on p2_c1_c2
6787          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6788 (10 rows)
6789
6790 /*+IndexScan(p2 p2_pkey)*/
6791 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6792 LOG:  available indexes for IndexScan(p2): p2_pkey
6793 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6794 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6795 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6796 LOG:  pg_hint_plan:
6797 used hint:
6798 IndexScan(p2 p2_pkey)
6799 not used hint:
6800 duplication hint:
6801 error hint:
6802
6803                     QUERY PLAN                    
6804 --------------------------------------------------
6805  Append
6806    ->  Index Scan using p2_pkey on p2
6807          Index Cond: ((id >= 50) AND (id <= 51))
6808          Filter: (ctid = '(1,1)'::tid)
6809    ->  Index Scan using p2_c1_pkey on p2_c1
6810          Index Cond: ((id >= 50) AND (id <= 51))
6811          Filter: (ctid = '(1,1)'::tid)
6812    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1
6813          Index Cond: ((id >= 50) AND (id <= 51))
6814          Filter: (ctid = '(1,1)'::tid)
6815    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2
6816          Index Cond: ((id >= 50) AND (id <= 51))
6817          Filter: (ctid = '(1,1)'::tid)
6818 (13 rows)
6819
6820 /*+IndexScan(p2 p2_c1_id_val_idx)*/
6821 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6822 LOG:  available indexes for IndexScan(p2):
6823 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
6824 LOG:  available indexes for IndexScan(p2_c1_c1):
6825 LOG:  available indexes for IndexScan(p2_c1_c2):
6826 LOG:  pg_hint_plan:
6827 used hint:
6828 IndexScan(p2 p2_c1_id_val_idx)
6829 not used hint:
6830 duplication hint:
6831 error hint:
6832
6833                               QUERY PLAN                               
6834 -----------------------------------------------------------------------
6835  Append
6836    ->  Seq Scan on p2
6837          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6838    ->  Index Scan using p2_c1_id_val_idx on p2_c1
6839          Index Cond: ((id >= 50) AND (id <= 51))
6840          Filter: (ctid = '(1,1)'::tid)
6841    ->  Seq Scan on p2_c1_c1
6842          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6843    ->  Seq Scan on p2_c1_c2
6844          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6845 (10 rows)
6846
6847 /*+IndexScan(p2 no_exist)*/
6848 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6849 LOG:  available indexes for IndexScan(p2):
6850 LOG:  available indexes for IndexScan(p2_c1):
6851 LOG:  available indexes for IndexScan(p2_c1_c1):
6852 LOG:  available indexes for IndexScan(p2_c1_c2):
6853 LOG:  pg_hint_plan:
6854 used hint:
6855 IndexScan(p2 no_exist)
6856 not used hint:
6857 duplication hint:
6858 error hint:
6859
6860                               QUERY PLAN                               
6861 -----------------------------------------------------------------------
6862  Append
6863    ->  Seq Scan on p2
6864          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6865    ->  Seq Scan on p2_c1
6866          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6867    ->  Seq Scan on p2_c1_c1
6868          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6869    ->  Seq Scan on p2_c1_c2
6870          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6871 (9 rows)
6872
6873 /*+IndexScan(p2 p2_pkey p2_c1_id_val_idx)*/
6874 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6875 LOG:  available indexes for IndexScan(p2): p2_pkey
6876 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx p2_c1_pkey
6877 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6878 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6879 LOG:  pg_hint_plan:
6880 used hint:
6881 IndexScan(p2 p2_pkey p2_c1_id_val_idx)
6882 not used hint:
6883 duplication hint:
6884 error hint:
6885
6886                     QUERY PLAN                    
6887 --------------------------------------------------
6888  Append
6889    ->  Index Scan using p2_pkey on p2
6890          Index Cond: ((id >= 50) AND (id <= 51))
6891          Filter: (ctid = '(1,1)'::tid)
6892    ->  Index Scan using p2_c1_id_val_idx on p2_c1
6893          Index Cond: ((id >= 50) AND (id <= 51))
6894          Filter: (ctid = '(1,1)'::tid)
6895    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1
6896          Index Cond: ((id >= 50) AND (id <= 51))
6897          Filter: (ctid = '(1,1)'::tid)
6898    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2
6899          Index Cond: ((id >= 50) AND (id <= 51))
6900          Filter: (ctid = '(1,1)'::tid)
6901 (13 rows)
6902
6903 /*+IndexScan(p2 p2_pkey no_exist)*/
6904 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6905 LOG:  available indexes for IndexScan(p2): p2_pkey
6906 LOG:  available indexes for IndexScan(p2_c1): p2_c1_pkey
6907 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6908 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6909 LOG:  pg_hint_plan:
6910 used hint:
6911 IndexScan(p2 p2_pkey no_exist)
6912 not used hint:
6913 duplication hint:
6914 error hint:
6915
6916                     QUERY PLAN                    
6917 --------------------------------------------------
6918  Append
6919    ->  Index Scan using p2_pkey on p2
6920          Index Cond: ((id >= 50) AND (id <= 51))
6921          Filter: (ctid = '(1,1)'::tid)
6922    ->  Index Scan using p2_c1_pkey on p2_c1
6923          Index Cond: ((id >= 50) AND (id <= 51))
6924          Filter: (ctid = '(1,1)'::tid)
6925    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1
6926          Index Cond: ((id >= 50) AND (id <= 51))
6927          Filter: (ctid = '(1,1)'::tid)
6928    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2
6929          Index Cond: ((id >= 50) AND (id <= 51))
6930          Filter: (ctid = '(1,1)'::tid)
6931 (13 rows)
6932
6933 /*+IndexScan(p2 p2_c1_id_val_idx no_exist)*/
6934 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6935 LOG:  available indexes for IndexScan(p2):
6936 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
6937 LOG:  available indexes for IndexScan(p2_c1_c1):
6938 LOG:  available indexes for IndexScan(p2_c1_c2):
6939 LOG:  pg_hint_plan:
6940 used hint:
6941 IndexScan(p2 p2_c1_id_val_idx no_exist)
6942 not used hint:
6943 duplication hint:
6944 error hint:
6945
6946                               QUERY PLAN                               
6947 -----------------------------------------------------------------------
6948  Append
6949    ->  Seq Scan on p2
6950          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6951    ->  Index Scan using p2_c1_id_val_idx on p2_c1
6952          Index Cond: ((id >= 50) AND (id <= 51))
6953          Filter: (ctid = '(1,1)'::tid)
6954    ->  Seq Scan on p2_c1_c1
6955          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6956    ->  Seq Scan on p2_c1_c2
6957          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
6958 (10 rows)
6959
6960 /*+IndexScan(p2 p2_pkey p2_c1_id_val_idx no_exist)*/
6961 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
6962 LOG:  available indexes for IndexScan(p2): p2_pkey
6963 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx p2_c1_pkey
6964 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_pkey
6965 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_pkey
6966 LOG:  pg_hint_plan:
6967 used hint:
6968 IndexScan(p2 p2_pkey p2_c1_id_val_idx no_exist)
6969 not used hint:
6970 duplication hint:
6971 error hint:
6972
6973                     QUERY PLAN                    
6974 --------------------------------------------------
6975  Append
6976    ->  Index Scan using p2_pkey on p2
6977          Index Cond: ((id >= 50) AND (id <= 51))
6978          Filter: (ctid = '(1,1)'::tid)
6979    ->  Index Scan using p2_c1_id_val_idx on p2_c1
6980          Index Cond: ((id >= 50) AND (id <= 51))
6981          Filter: (ctid = '(1,1)'::tid)
6982    ->  Index Scan using p2_c1_c1_pkey on p2_c1_c1
6983          Index Cond: ((id >= 50) AND (id <= 51))
6984          Filter: (ctid = '(1,1)'::tid)
6985    ->  Index Scan using p2_c1_c2_pkey on p2_c1_c2
6986          Index Cond: ((id >= 50) AND (id <= 51))
6987          Filter: (ctid = '(1,1)'::tid)
6988 (13 rows)
6989
6990 /*+IndexScan(p2 p2_val_idx)*/
6991 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
6992 LOG:  available indexes for IndexScan(p2): p2_val_idx
6993 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_idx
6994 LOG:  available indexes for IndexScan(p2_c2): p2_c2_val_idx
6995 LOG:  available indexes for IndexScan(p2_c3): p2_c3_val_idx
6996 LOG:  available indexes for IndexScan(p2_c4): p2_c4_val_idx
6997 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_idx
6998 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_idx
6999 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_val_idx
7000 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_val_idx
7001 LOG:  pg_hint_plan:
7002 used hint:
7003 IndexScan(p2 p2_val_idx)
7004 not used hint:
7005 duplication hint:
7006 error hint:
7007
7008                             QUERY PLAN                             
7009 -------------------------------------------------------------------
7010  Append
7011    ->  Index Scan using p2_val_idx on p2
7012          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7013          Filter: (ctid = '(1,1)'::tid)
7014    ->  Index Scan using p2_c1_val_idx on p2_c1
7015          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7016          Filter: (ctid = '(1,1)'::tid)
7017    ->  Index Scan using p2_c2_val_idx on p2_c2
7018          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7019          Filter: (ctid = '(1,1)'::tid)
7020    ->  Index Scan using p2_c3_val_idx on p2_c3
7021          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7022          Filter: (ctid = '(1,1)'::tid)
7023    ->  Index Scan using p2_c4_val_idx on p2_c4
7024          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7025          Filter: (ctid = '(1,1)'::tid)
7026    ->  Index Scan using p2_c1_c1_val_idx on p2_c1_c1
7027          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7028          Filter: (ctid = '(1,1)'::tid)
7029    ->  Index Scan using p2_c1_c2_val_idx on p2_c1_c2
7030          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7031          Filter: (ctid = '(1,1)'::tid)
7032    ->  Index Scan using p2_c3_c1_val_idx on p2_c3_c1
7033          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7034          Filter: (ctid = '(1,1)'::tid)
7035    ->  Index Scan using p2_c3_c2_val_idx on p2_c3_c2
7036          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7037          Filter: (ctid = '(1,1)'::tid)
7038 (28 rows)
7039
7040 /*+IndexScan(p2 p2_expr)*/
7041 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
7042 LOG:  available indexes for IndexScan(p2): p2_expr
7043 LOG:  available indexes for IndexScan(p2_c1): p2_c1_expr_idx
7044 LOG:  available indexes for IndexScan(p2_c2): p2_c2_expr_idx
7045 LOG:  available indexes for IndexScan(p2_c3): p2_c3_expr_idx
7046 LOG:  available indexes for IndexScan(p2_c4): p2_c4_expr_idx
7047 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_expr_idx
7048 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_expr_idx
7049 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_expr_idx
7050 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_expr_idx
7051 LOG:  pg_hint_plan:
7052 used hint:
7053 IndexScan(p2 p2_expr)
7054 not used hint:
7055 duplication hint:
7056 error hint:
7057
7058                                        QUERY PLAN                                        
7059 -----------------------------------------------------------------------------------------
7060  Append
7061    ->  Seq Scan on p2
7062          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7063    ->  Seq Scan on p2_c1
7064          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7065    ->  Seq Scan on p2_c2
7066          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7067    ->  Seq Scan on p2_c3
7068          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7069    ->  Seq Scan on p2_c4
7070          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7071    ->  Seq Scan on p2_c1_c1
7072          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7073    ->  Seq Scan on p2_c1_c2
7074          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7075    ->  Seq Scan on p2_c3_c1
7076          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7077    ->  Seq Scan on p2_c3_c2
7078          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7079 (19 rows)
7080
7081 /*+IndexScan(p2 p2_val_idx6)*/
7082 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
7083 LOG:  available indexes for IndexScan(p2): p2_val_idx6
7084 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_idx6
7085 LOG:  available indexes for IndexScan(p2_c2): p2_c2_val_idx6
7086 LOG:  available indexes for IndexScan(p2_c3): p2_c3_val_idx6
7087 LOG:  available indexes for IndexScan(p2_c4): p2_c4_val_idx6
7088 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_idx6
7089 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_idx6
7090 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_val_idx6
7091 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_val_idx6
7092 LOG:  pg_hint_plan:
7093 used hint:
7094 IndexScan(p2 p2_val_idx6)
7095 not used hint:
7096 duplication hint:
7097 error hint:
7098
7099                                        QUERY PLAN                                        
7100 -----------------------------------------------------------------------------------------
7101  Append
7102    ->  Seq Scan on p2
7103          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7104    ->  Seq Scan on p2_c1
7105          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7106    ->  Seq Scan on p2_c2
7107          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7108    ->  Seq Scan on p2_c3
7109          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7110    ->  Seq Scan on p2_c4
7111          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7112    ->  Seq Scan on p2_c1_c1
7113          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7114    ->  Seq Scan on p2_c1_c2
7115          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7116    ->  Seq Scan on p2_c3_c1
7117          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7118    ->  Seq Scan on p2_c3_c2
7119          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
7120 (19 rows)
7121
7122 /*+IndexScan(p2 p2_val_idx p2_val_idx6)*/
7123 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
7124 LOG:  available indexes for IndexScan(p2): p2_val_idx6 p2_val_idx
7125 LOG:  available indexes for IndexScan(p2_c1): p2_c1_val_idx6 p2_c1_val_idx
7126 LOG:  available indexes for IndexScan(p2_c2): p2_c2_val_idx6 p2_c2_val_idx
7127 LOG:  available indexes for IndexScan(p2_c3): p2_c3_val_idx6 p2_c3_val_idx
7128 LOG:  available indexes for IndexScan(p2_c4): p2_c4_val_idx6 p2_c4_val_idx
7129 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_val_idx6 p2_c1_c1_val_idx
7130 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_val_idx6 p2_c1_c2_val_idx
7131 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_val_idx6 p2_c3_c1_val_idx
7132 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_val_idx6 p2_c3_c2_val_idx
7133 LOG:  pg_hint_plan:
7134 used hint:
7135 IndexScan(p2 p2_val_idx p2_val_idx6)
7136 not used hint:
7137 duplication hint:
7138 error hint:
7139
7140                             QUERY PLAN                             
7141 -------------------------------------------------------------------
7142  Append
7143    ->  Index Scan using p2_val_idx on p2
7144          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7145          Filter: (ctid = '(1,1)'::tid)
7146    ->  Index Scan using p2_c1_val_idx on p2_c1
7147          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7148          Filter: (ctid = '(1,1)'::tid)
7149    ->  Index Scan using p2_c2_val_idx on p2_c2
7150          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7151          Filter: (ctid = '(1,1)'::tid)
7152    ->  Index Scan using p2_c3_val_idx on p2_c3
7153          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7154          Filter: (ctid = '(1,1)'::tid)
7155    ->  Index Scan using p2_c4_val_idx on p2_c4
7156          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7157          Filter: (ctid = '(1,1)'::tid)
7158    ->  Index Scan using p2_c1_c1_val_idx on p2_c1_c1
7159          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7160          Filter: (ctid = '(1,1)'::tid)
7161    ->  Index Scan using p2_c1_c2_val_idx on p2_c1_c2
7162          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7163          Filter: (ctid = '(1,1)'::tid)
7164    ->  Index Scan using p2_c3_c1_val_idx on p2_c3_c1
7165          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7166          Filter: (ctid = '(1,1)'::tid)
7167    ->  Index Scan using p2_c3_c2_val_idx on p2_c3_c2
7168          Index Cond: ((val >= '50'::text) AND (val <= '51'::text))
7169          Filter: (ctid = '(1,1)'::tid)
7170 (28 rows)
7171
7172 -- regular expression
7173 -- ordinary table
7174 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7175                                          QUERY PLAN                                          
7176 ---------------------------------------------------------------------------------------------
7177  Index Only Scan using t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa on t5
7178    Index Cond: (id = 1)
7179 (2 rows)
7180
7181 /*+ IndexScanRegexp(t5 t5_[^i].*)*/
7182 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7183 LOG:  available indexes for IndexScanRegexp(t5): t5_val t5_pkey
7184 LOG:  pg_hint_plan:
7185 used hint:
7186 IndexScanRegexp(t5 t5_[^i].*)
7187 not used hint:
7188 duplication hint:
7189 error hint:
7190
7191            QUERY PLAN           
7192 --------------------------------
7193  Index Scan using t5_pkey on t5
7194    Index Cond: (id = 1)
7195 (2 rows)
7196
7197 /*+ IndexScanRegexp(t5 t5_id[0-9].*)*/
7198 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7199 LOG:  available indexes for IndexScanRegexp(t5): t5_id3 t5_id2 t5_id1
7200 LOG:  pg_hint_plan:
7201 used hint:
7202 IndexScanRegexp(t5 t5_id[0-9].*)
7203 not used hint:
7204 duplication hint:
7205 error hint:
7206
7207           QUERY PLAN           
7208 -------------------------------
7209  Index Scan using t5_id3 on t5
7210    Index Cond: (id = 1)
7211 (2 rows)
7212
7213 /*+ IndexScanRegexp(t5 t5[^_].*)*/
7214 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7215 LOG:  available indexes for IndexScanRegexp(t5):
7216 LOG:  pg_hint_plan:
7217 used hint:
7218 IndexScanRegexp(t5 t5[^_].*)
7219 not used hint:
7220 duplication hint:
7221 error hint:
7222
7223      QUERY PLAN     
7224 --------------------
7225  Seq Scan on t5
7226    Filter: (id = 1)
7227 (2 rows)
7228
7229 /*+ IndexScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)*/
7230 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7231 LOG:  available indexes for IndexScanRegexp(t5):
7232 LOG:  pg_hint_plan:
7233 used hint:
7234 IndexScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)
7235 not used hint:
7236 duplication hint:
7237 error hint:
7238
7239      QUERY PLAN     
7240 --------------------
7241  Seq Scan on t5
7242    Filter: (id = 1)
7243 (2 rows)
7244
7245 /*+ IndexScan(t5 t5_id[0-9].*)*/
7246 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7247 LOG:  available indexes for IndexScan(t5):
7248 LOG:  pg_hint_plan:
7249 used hint:
7250 IndexScan(t5 t5_id[0-9].*)
7251 not used hint:
7252 duplication hint:
7253 error hint:
7254
7255      QUERY PLAN     
7256 --------------------
7257  Seq Scan on t5
7258    Filter: (id = 1)
7259 (2 rows)
7260
7261 /*+ IndexOnlyScanRegexp(t5 t5_[^i].*)*/
7262 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7263 LOG:  available indexes for IndexOnlyScanRegexp(t5): t5_val t5_pkey
7264 LOG:  pg_hint_plan:
7265 used hint:
7266 IndexOnlyScanRegexp(t5 t5_[^i].*)
7267 not used hint:
7268 duplication hint:
7269 error hint:
7270
7271              QUERY PLAN              
7272 -------------------------------------
7273  Index Only Scan using t5_pkey on t5
7274    Index Cond: (id = 1)
7275 (2 rows)
7276
7277 /*+ IndexOnlyScanRegexp(t5 t5_id[0-9].*)*/
7278 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7279 LOG:  available indexes for IndexOnlyScanRegexp(t5): t5_id3 t5_id2 t5_id1
7280 LOG:  pg_hint_plan:
7281 used hint:
7282 IndexOnlyScanRegexp(t5 t5_id[0-9].*)
7283 not used hint:
7284 duplication hint:
7285 error hint:
7286
7287              QUERY PLAN             
7288 ------------------------------------
7289  Index Only Scan using t5_id3 on t5
7290    Index Cond: (id = 1)
7291 (2 rows)
7292
7293 /*+ IndexOnlyScanRegexp(t5 t5[^_].*)*/
7294 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7295 LOG:  available indexes for IndexOnlyScanRegexp(t5):
7296 LOG:  pg_hint_plan:
7297 used hint:
7298 IndexOnlyScanRegexp(t5 t5[^_].*)
7299 not used hint:
7300 duplication hint:
7301 error hint:
7302
7303      QUERY PLAN     
7304 --------------------
7305  Seq Scan on t5
7306    Filter: (id = 1)
7307 (2 rows)
7308
7309 /*+ IndexOnlyScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)*/
7310 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7311 LOG:  available indexes for IndexOnlyScanRegexp(t5):
7312 LOG:  pg_hint_plan:
7313 used hint:
7314 IndexOnlyScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)
7315 not used hint:
7316 duplication hint:
7317 error hint:
7318
7319      QUERY PLAN     
7320 --------------------
7321  Seq Scan on t5
7322    Filter: (id = 1)
7323 (2 rows)
7324
7325 /*+ IndexOnlyScan(t5 t5_id[0-9].*)*/
7326 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7327 LOG:  available indexes for IndexOnlyScan(t5):
7328 LOG:  pg_hint_plan:
7329 used hint:
7330 IndexOnlyScan(t5 t5_id[0-9].*)
7331 not used hint:
7332 duplication hint:
7333 error hint:
7334
7335      QUERY PLAN     
7336 --------------------
7337  Seq Scan on t5
7338    Filter: (id = 1)
7339 (2 rows)
7340
7341 /*+ BitmapScanRegexp(t5 t5_[^i].*)*/
7342 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7343 LOG:  available indexes for BitmapScanRegexp(t5): t5_val t5_pkey
7344 LOG:  pg_hint_plan:
7345 used hint:
7346 BitmapScanRegexp(t5 t5_[^i].*)
7347 not used hint:
7348 duplication hint:
7349 error hint:
7350
7351              QUERY PLAN             
7352 ------------------------------------
7353  Bitmap Heap Scan on t5
7354    Recheck Cond: (id = 1)
7355    ->  Bitmap Index Scan on t5_pkey
7356          Index Cond: (id = 1)
7357 (4 rows)
7358
7359 /*+ BitmapScanRegexp(t5 t5_id[0-9].*)*/
7360 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7361 LOG:  available indexes for BitmapScanRegexp(t5): t5_id3 t5_id2 t5_id1
7362 LOG:  pg_hint_plan:
7363 used hint:
7364 BitmapScanRegexp(t5 t5_id[0-9].*)
7365 not used hint:
7366 duplication hint:
7367 error hint:
7368
7369             QUERY PLAN             
7370 -----------------------------------
7371  Bitmap Heap Scan on t5
7372    Recheck Cond: (id = 1)
7373    ->  Bitmap Index Scan on t5_id3
7374          Index Cond: (id = 1)
7375 (4 rows)
7376
7377 /*+ BitmapScanRegexp(t5 t5[^_].*)*/
7378 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7379 LOG:  available indexes for BitmapScanRegexp(t5):
7380 LOG:  pg_hint_plan:
7381 used hint:
7382 BitmapScanRegexp(t5 t5[^_].*)
7383 not used hint:
7384 duplication hint:
7385 error hint:
7386
7387      QUERY PLAN     
7388 --------------------
7389  Seq Scan on t5
7390    Filter: (id = 1)
7391 (2 rows)
7392
7393 /*+ BitmapScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)*/
7394 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7395 LOG:  available indexes for BitmapScanRegexp(t5):
7396 LOG:  pg_hint_plan:
7397 used hint:
7398 BitmapScanRegexp(t5 ^.*t5_idaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab)
7399 not used hint:
7400 duplication hint:
7401 error hint:
7402
7403      QUERY PLAN     
7404 --------------------
7405  Seq Scan on t5
7406    Filter: (id = 1)
7407 (2 rows)
7408
7409 /*+ BitmapScan(t5 t5_id[0-9].*)*/
7410 EXPLAIN (COSTS false) SELECT id FROM t5 WHERE id = 1;
7411 LOG:  available indexes for BitmapScan(t5):
7412 LOG:  pg_hint_plan:
7413 used hint:
7414 BitmapScan(t5 t5_id[0-9].*)
7415 not used hint:
7416 duplication hint:
7417 error hint:
7418
7419      QUERY PLAN     
7420 --------------------
7421  Seq Scan on t5
7422    Filter: (id = 1)
7423 (2 rows)
7424
7425 -- Inheritance
7426 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7427          QUERY PLAN         
7428 ----------------------------
7429  Append
7430    ->  Seq Scan on p1
7431          Filter: (val = 1)
7432    ->  Seq Scan on p1_c1
7433          Filter: (val = 1)
7434    ->  Seq Scan on p1_c2
7435          Filter: (val = 1)
7436    ->  Seq Scan on p1_c3
7437          Filter: (val = 1)
7438    ->  Seq Scan on p1_c4
7439          Filter: (val = 1)
7440    ->  Seq Scan on p1_c1_c1
7441          Filter: (val = 1)
7442    ->  Seq Scan on p1_c1_c2
7443          Filter: (val = 1)
7444    ->  Seq Scan on p1_c3_c1
7445          Filter: (val = 1)
7446    ->  Seq Scan on p1_c3_c2
7447          Filter: (val = 1)
7448 (19 rows)
7449
7450 /*+ IndexScanRegexp(p1 p1_.*[^0-9]$)*/
7451 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7452 LOG:  available indexes for IndexScanRegexp(p1): p1_pkey
7453 LOG:  available indexes for IndexScanRegexp(p1_c1): p1_c1_pkey
7454 LOG:  available indexes for IndexScanRegexp(p1_c2): p1_c2_pkey
7455 LOG:  available indexes for IndexScanRegexp(p1_c3): p1_c3_pkey
7456 LOG:  available indexes for IndexScanRegexp(p1_c4): p1_c4_pkey
7457 LOG:  available indexes for IndexScanRegexp(p1_c1_c1): p1_c1_c1_pkey
7458 LOG:  available indexes for IndexScanRegexp(p1_c1_c2): p1_c1_c2_pkey
7459 LOG:  available indexes for IndexScanRegexp(p1_c3_c1): p1_c3_c1_pkey
7460 LOG:  available indexes for IndexScanRegexp(p1_c3_c2): p1_c3_c2_pkey
7461 LOG:  pg_hint_plan:
7462 used hint:
7463 IndexScanRegexp(p1 p1_.*[^0-9]$)
7464 not used hint:
7465 duplication hint:
7466 error hint:
7467
7468          QUERY PLAN         
7469 ----------------------------
7470  Append
7471    ->  Seq Scan on p1
7472          Filter: (val = 1)
7473    ->  Seq Scan on p1_c1
7474          Filter: (val = 1)
7475    ->  Seq Scan on p1_c2
7476          Filter: (val = 1)
7477    ->  Seq Scan on p1_c3
7478          Filter: (val = 1)
7479    ->  Seq Scan on p1_c4
7480          Filter: (val = 1)
7481    ->  Seq Scan on p1_c1_c1
7482          Filter: (val = 1)
7483    ->  Seq Scan on p1_c1_c2
7484          Filter: (val = 1)
7485    ->  Seq Scan on p1_c3_c1
7486          Filter: (val = 1)
7487    ->  Seq Scan on p1_c3_c2
7488          Filter: (val = 1)
7489 (19 rows)
7490
7491 /*+ IndexScanRegexp(p1 p1_.*val2.*)*/
7492 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7493 LOG:  available indexes for IndexScanRegexp(p1): p1_val2
7494 LOG:  available indexes for IndexScanRegexp(p1_c1): p1_c1_val2
7495 LOG:  available indexes for IndexScanRegexp(p1_c2): p1_c2_val2
7496 LOG:  available indexes for IndexScanRegexp(p1_c3): p1_c3_val2
7497 LOG:  available indexes for IndexScanRegexp(p1_c4): p1_c4_val2
7498 LOG:  available indexes for IndexScanRegexp(p1_c1_c1): p1_c1_c1_val2
7499 LOG:  available indexes for IndexScanRegexp(p1_c1_c2): p1_c1_c2_val2
7500 LOG:  available indexes for IndexScanRegexp(p1_c3_c1): p1_c3_c1_val2
7501 LOG:  available indexes for IndexScanRegexp(p1_c3_c2): p1_c3_c2_val2
7502 LOG:  pg_hint_plan:
7503 used hint:
7504 IndexScanRegexp(p1 p1_.*val2.*)
7505 not used hint:
7506 duplication hint:
7507 error hint:
7508
7509                     QUERY PLAN                    
7510 --------------------------------------------------
7511  Append
7512    ->  Index Scan using p1_val2 on p1
7513          Index Cond: (val = 1)
7514    ->  Index Scan using p1_c1_val2 on p1_c1
7515          Index Cond: (val = 1)
7516    ->  Index Scan using p1_c2_val2 on p1_c2
7517          Index Cond: (val = 1)
7518    ->  Index Scan using p1_c3_val2 on p1_c3
7519          Index Cond: (val = 1)
7520    ->  Index Scan using p1_c4_val2 on p1_c4
7521          Index Cond: (val = 1)
7522    ->  Index Scan using p1_c1_c1_val2 on p1_c1_c1
7523          Index Cond: (val = 1)
7524    ->  Index Scan using p1_c1_c2_val2 on p1_c1_c2
7525          Index Cond: (val = 1)
7526    ->  Index Scan using p1_c3_c1_val2 on p1_c3_c1
7527          Index Cond: (val = 1)
7528    ->  Index Scan using p1_c3_c2_val2 on p1_c3_c2
7529          Index Cond: (val = 1)
7530 (19 rows)
7531
7532 /*+ IndexScanRegexp(p1 p1[^_].*)*/
7533 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7534 LOG:  available indexes for IndexScanRegexp(p1):
7535 LOG:  available indexes for IndexScanRegexp(p1_c1):
7536 LOG:  available indexes for IndexScanRegexp(p1_c2):
7537 LOG:  available indexes for IndexScanRegexp(p1_c3):
7538 LOG:  available indexes for IndexScanRegexp(p1_c4):
7539 LOG:  available indexes for IndexScanRegexp(p1_c1_c1):
7540 LOG:  available indexes for IndexScanRegexp(p1_c1_c2):
7541 LOG:  available indexes for IndexScanRegexp(p1_c3_c1):
7542 LOG:  available indexes for IndexScanRegexp(p1_c3_c2):
7543 LOG:  pg_hint_plan:
7544 used hint:
7545 IndexScanRegexp(p1 p1[^_].*)
7546 not used hint:
7547 duplication hint:
7548 error hint:
7549
7550          QUERY PLAN         
7551 ----------------------------
7552  Append
7553    ->  Seq Scan on p1
7554          Filter: (val = 1)
7555    ->  Seq Scan on p1_c1
7556          Filter: (val = 1)
7557    ->  Seq Scan on p1_c2
7558          Filter: (val = 1)
7559    ->  Seq Scan on p1_c3
7560          Filter: (val = 1)
7561    ->  Seq Scan on p1_c4
7562          Filter: (val = 1)
7563    ->  Seq Scan on p1_c1_c1
7564          Filter: (val = 1)
7565    ->  Seq Scan on p1_c1_c2
7566          Filter: (val = 1)
7567    ->  Seq Scan on p1_c3_c1
7568          Filter: (val = 1)
7569    ->  Seq Scan on p1_c3_c2
7570          Filter: (val = 1)
7571 (19 rows)
7572
7573 /*+ IndexScan(p1 p1_.*val2.*)*/
7574 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7575 LOG:  available indexes for IndexScan(p1):
7576 LOG:  available indexes for IndexScan(p1_c1):
7577 LOG:  available indexes for IndexScan(p1_c2):
7578 LOG:  available indexes for IndexScan(p1_c3):
7579 LOG:  available indexes for IndexScan(p1_c4):
7580 LOG:  available indexes for IndexScan(p1_c1_c1):
7581 LOG:  available indexes for IndexScan(p1_c1_c2):
7582 LOG:  available indexes for IndexScan(p1_c3_c1):
7583 LOG:  available indexes for IndexScan(p1_c3_c2):
7584 LOG:  pg_hint_plan:
7585 used hint:
7586 IndexScan(p1 p1_.*val2.*)
7587 not used hint:
7588 duplication hint:
7589 error hint:
7590
7591          QUERY PLAN         
7592 ----------------------------
7593  Append
7594    ->  Seq Scan on p1
7595          Filter: (val = 1)
7596    ->  Seq Scan on p1_c1
7597          Filter: (val = 1)
7598    ->  Seq Scan on p1_c2
7599          Filter: (val = 1)
7600    ->  Seq Scan on p1_c3
7601          Filter: (val = 1)
7602    ->  Seq Scan on p1_c4
7603          Filter: (val = 1)
7604    ->  Seq Scan on p1_c1_c1
7605          Filter: (val = 1)
7606    ->  Seq Scan on p1_c1_c2
7607          Filter: (val = 1)
7608    ->  Seq Scan on p1_c3_c1
7609          Filter: (val = 1)
7610    ->  Seq Scan on p1_c3_c2
7611          Filter: (val = 1)
7612 (19 rows)
7613
7614 /*+ IndexOnlyScanRegexp(p1 p1_.*[^0-9]$)*/
7615 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7616 LOG:  available indexes for IndexOnlyScanRegexp(p1): p1_pkey
7617 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1): p1_c1_pkey
7618 LOG:  available indexes for IndexOnlyScanRegexp(p1_c2): p1_c2_pkey
7619 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3): p1_c3_pkey
7620 LOG:  available indexes for IndexOnlyScanRegexp(p1_c4): p1_c4_pkey
7621 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c1): p1_c1_c1_pkey
7622 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c2): p1_c1_c2_pkey
7623 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c1): p1_c3_c1_pkey
7624 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c2): p1_c3_c2_pkey
7625 LOG:  pg_hint_plan:
7626 used hint:
7627 IndexOnlyScanRegexp(p1 p1_.*[^0-9]$)
7628 not used hint:
7629 duplication hint:
7630 error hint:
7631
7632          QUERY PLAN         
7633 ----------------------------
7634  Append
7635    ->  Seq Scan on p1
7636          Filter: (val = 1)
7637    ->  Seq Scan on p1_c1
7638          Filter: (val = 1)
7639    ->  Seq Scan on p1_c2
7640          Filter: (val = 1)
7641    ->  Seq Scan on p1_c3
7642          Filter: (val = 1)
7643    ->  Seq Scan on p1_c4
7644          Filter: (val = 1)
7645    ->  Seq Scan on p1_c1_c1
7646          Filter: (val = 1)
7647    ->  Seq Scan on p1_c1_c2
7648          Filter: (val = 1)
7649    ->  Seq Scan on p1_c3_c1
7650          Filter: (val = 1)
7651    ->  Seq Scan on p1_c3_c2
7652          Filter: (val = 1)
7653 (19 rows)
7654
7655 /*+ IndexOnlyScanRegexp(p1 p1_.*val2.*)*/
7656 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7657 LOG:  available indexes for IndexOnlyScanRegexp(p1): p1_val2
7658 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1): p1_c1_val2
7659 LOG:  available indexes for IndexOnlyScanRegexp(p1_c2): p1_c2_val2
7660 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3): p1_c3_val2
7661 LOG:  available indexes for IndexOnlyScanRegexp(p1_c4): p1_c4_val2
7662 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c1): p1_c1_c1_val2
7663 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c2): p1_c1_c2_val2
7664 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c1): p1_c3_c1_val2
7665 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c2): p1_c3_c2_val2
7666 LOG:  pg_hint_plan:
7667 used hint:
7668 IndexOnlyScanRegexp(p1 p1_.*val2.*)
7669 not used hint:
7670 duplication hint:
7671 error hint:
7672
7673                       QUERY PLAN                       
7674 -------------------------------------------------------
7675  Append
7676    ->  Index Only Scan using p1_val2 on p1
7677          Index Cond: (val = 1)
7678    ->  Index Only Scan using p1_c1_val2 on p1_c1
7679          Index Cond: (val = 1)
7680    ->  Index Only Scan using p1_c2_val2 on p1_c2
7681          Index Cond: (val = 1)
7682    ->  Index Only Scan using p1_c3_val2 on p1_c3
7683          Index Cond: (val = 1)
7684    ->  Index Only Scan using p1_c4_val2 on p1_c4
7685          Index Cond: (val = 1)
7686    ->  Index Only Scan using p1_c1_c1_val2 on p1_c1_c1
7687          Index Cond: (val = 1)
7688    ->  Index Only Scan using p1_c1_c2_val2 on p1_c1_c2
7689          Index Cond: (val = 1)
7690    ->  Index Only Scan using p1_c3_c1_val2 on p1_c3_c1
7691          Index Cond: (val = 1)
7692    ->  Index Only Scan using p1_c3_c2_val2 on p1_c3_c2
7693          Index Cond: (val = 1)
7694 (19 rows)
7695
7696 /*+ IndexOnlyScanRegexp(p1 p1[^_].*)*/
7697 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7698 LOG:  available indexes for IndexOnlyScanRegexp(p1):
7699 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1):
7700 LOG:  available indexes for IndexOnlyScanRegexp(p1_c2):
7701 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3):
7702 LOG:  available indexes for IndexOnlyScanRegexp(p1_c4):
7703 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c1):
7704 LOG:  available indexes for IndexOnlyScanRegexp(p1_c1_c2):
7705 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c1):
7706 LOG:  available indexes for IndexOnlyScanRegexp(p1_c3_c2):
7707 LOG:  pg_hint_plan:
7708 used hint:
7709 IndexOnlyScanRegexp(p1 p1[^_].*)
7710 not used hint:
7711 duplication hint:
7712 error hint:
7713
7714          QUERY PLAN         
7715 ----------------------------
7716  Append
7717    ->  Seq Scan on p1
7718          Filter: (val = 1)
7719    ->  Seq Scan on p1_c1
7720          Filter: (val = 1)
7721    ->  Seq Scan on p1_c2
7722          Filter: (val = 1)
7723    ->  Seq Scan on p1_c3
7724          Filter: (val = 1)
7725    ->  Seq Scan on p1_c4
7726          Filter: (val = 1)
7727    ->  Seq Scan on p1_c1_c1
7728          Filter: (val = 1)
7729    ->  Seq Scan on p1_c1_c2
7730          Filter: (val = 1)
7731    ->  Seq Scan on p1_c3_c1
7732          Filter: (val = 1)
7733    ->  Seq Scan on p1_c3_c2
7734          Filter: (val = 1)
7735 (19 rows)
7736
7737 /*+ IndexOnlyScan(p1 p1_.*val2.*)*/
7738 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7739 LOG:  available indexes for IndexOnlyScan(p1):
7740 LOG:  available indexes for IndexOnlyScan(p1_c1):
7741 LOG:  available indexes for IndexOnlyScan(p1_c2):
7742 LOG:  available indexes for IndexOnlyScan(p1_c3):
7743 LOG:  available indexes for IndexOnlyScan(p1_c4):
7744 LOG:  available indexes for IndexOnlyScan(p1_c1_c1):
7745 LOG:  available indexes for IndexOnlyScan(p1_c1_c2):
7746 LOG:  available indexes for IndexOnlyScan(p1_c3_c1):
7747 LOG:  available indexes for IndexOnlyScan(p1_c3_c2):
7748 LOG:  pg_hint_plan:
7749 used hint:
7750 IndexOnlyScan(p1 p1_.*val2.*)
7751 not used hint:
7752 duplication hint:
7753 error hint:
7754
7755          QUERY PLAN         
7756 ----------------------------
7757  Append
7758    ->  Seq Scan on p1
7759          Filter: (val = 1)
7760    ->  Seq Scan on p1_c1
7761          Filter: (val = 1)
7762    ->  Seq Scan on p1_c2
7763          Filter: (val = 1)
7764    ->  Seq Scan on p1_c3
7765          Filter: (val = 1)
7766    ->  Seq Scan on p1_c4
7767          Filter: (val = 1)
7768    ->  Seq Scan on p1_c1_c1
7769          Filter: (val = 1)
7770    ->  Seq Scan on p1_c1_c2
7771          Filter: (val = 1)
7772    ->  Seq Scan on p1_c3_c1
7773          Filter: (val = 1)
7774    ->  Seq Scan on p1_c3_c2
7775          Filter: (val = 1)
7776 (19 rows)
7777
7778 /*+ BitmapScanRegexp(p1 p1_.*[^0-9]$)*/
7779 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7780 LOG:  available indexes for BitmapScanRegexp(p1): p1_pkey
7781 LOG:  available indexes for BitmapScanRegexp(p1_c1): p1_c1_pkey
7782 LOG:  available indexes for BitmapScanRegexp(p1_c2): p1_c2_pkey
7783 LOG:  available indexes for BitmapScanRegexp(p1_c3): p1_c3_pkey
7784 LOG:  available indexes for BitmapScanRegexp(p1_c4): p1_c4_pkey
7785 LOG:  available indexes for BitmapScanRegexp(p1_c1_c1): p1_c1_c1_pkey
7786 LOG:  available indexes for BitmapScanRegexp(p1_c1_c2): p1_c1_c2_pkey
7787 LOG:  available indexes for BitmapScanRegexp(p1_c3_c1): p1_c3_c1_pkey
7788 LOG:  available indexes for BitmapScanRegexp(p1_c3_c2): p1_c3_c2_pkey
7789 LOG:  pg_hint_plan:
7790 used hint:
7791 BitmapScanRegexp(p1 p1_.*[^0-9]$)
7792 not used hint:
7793 duplication hint:
7794 error hint:
7795
7796          QUERY PLAN         
7797 ----------------------------
7798  Append
7799    ->  Seq Scan on p1
7800          Filter: (val = 1)
7801    ->  Seq Scan on p1_c1
7802          Filter: (val = 1)
7803    ->  Seq Scan on p1_c2
7804          Filter: (val = 1)
7805    ->  Seq Scan on p1_c3
7806          Filter: (val = 1)
7807    ->  Seq Scan on p1_c4
7808          Filter: (val = 1)
7809    ->  Seq Scan on p1_c1_c1
7810          Filter: (val = 1)
7811    ->  Seq Scan on p1_c1_c2
7812          Filter: (val = 1)
7813    ->  Seq Scan on p1_c3_c1
7814          Filter: (val = 1)
7815    ->  Seq Scan on p1_c3_c2
7816          Filter: (val = 1)
7817 (19 rows)
7818
7819 /*+ BitmapScanRegexp(p1 p1_.*val2.*)*/
7820 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7821 LOG:  available indexes for BitmapScanRegexp(p1): p1_val2
7822 LOG:  available indexes for BitmapScanRegexp(p1_c1): p1_c1_val2
7823 LOG:  available indexes for BitmapScanRegexp(p1_c2): p1_c2_val2
7824 LOG:  available indexes for BitmapScanRegexp(p1_c3): p1_c3_val2
7825 LOG:  available indexes for BitmapScanRegexp(p1_c4): p1_c4_val2
7826 LOG:  available indexes for BitmapScanRegexp(p1_c1_c1): p1_c1_c1_val2
7827 LOG:  available indexes for BitmapScanRegexp(p1_c1_c2): p1_c1_c2_val2
7828 LOG:  available indexes for BitmapScanRegexp(p1_c3_c1): p1_c3_c1_val2
7829 LOG:  available indexes for BitmapScanRegexp(p1_c3_c2): p1_c3_c2_val2
7830 LOG:  pg_hint_plan:
7831 used hint:
7832 BitmapScanRegexp(p1 p1_.*val2.*)
7833 not used hint:
7834 duplication hint:
7835 error hint:
7836
7837                    QUERY PLAN                   
7838 ------------------------------------------------
7839  Append
7840    ->  Bitmap Heap Scan on p1
7841          Recheck Cond: (val = 1)
7842          ->  Bitmap Index Scan on p1_val2
7843                Index Cond: (val = 1)
7844    ->  Bitmap Heap Scan on p1_c1
7845          Recheck Cond: (val = 1)
7846          ->  Bitmap Index Scan on p1_c1_val2
7847                Index Cond: (val = 1)
7848    ->  Bitmap Heap Scan on p1_c2
7849          Recheck Cond: (val = 1)
7850          ->  Bitmap Index Scan on p1_c2_val2
7851                Index Cond: (val = 1)
7852    ->  Bitmap Heap Scan on p1_c3
7853          Recheck Cond: (val = 1)
7854          ->  Bitmap Index Scan on p1_c3_val2
7855                Index Cond: (val = 1)
7856    ->  Bitmap Heap Scan on p1_c4
7857          Recheck Cond: (val = 1)
7858          ->  Bitmap Index Scan on p1_c4_val2
7859                Index Cond: (val = 1)
7860    ->  Bitmap Heap Scan on p1_c1_c1
7861          Recheck Cond: (val = 1)
7862          ->  Bitmap Index Scan on p1_c1_c1_val2
7863                Index Cond: (val = 1)
7864    ->  Bitmap Heap Scan on p1_c1_c2
7865          Recheck Cond: (val = 1)
7866          ->  Bitmap Index Scan on p1_c1_c2_val2
7867                Index Cond: (val = 1)
7868    ->  Bitmap Heap Scan on p1_c3_c1
7869          Recheck Cond: (val = 1)
7870          ->  Bitmap Index Scan on p1_c3_c1_val2
7871                Index Cond: (val = 1)
7872    ->  Bitmap Heap Scan on p1_c3_c2
7873          Recheck Cond: (val = 1)
7874          ->  Bitmap Index Scan on p1_c3_c2_val2
7875                Index Cond: (val = 1)
7876 (37 rows)
7877
7878 /*+ BitmapScanRegexp(p1 p1[^_].*)*/
7879 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7880 LOG:  available indexes for BitmapScanRegexp(p1):
7881 LOG:  available indexes for BitmapScanRegexp(p1_c1):
7882 LOG:  available indexes for BitmapScanRegexp(p1_c2):
7883 LOG:  available indexes for BitmapScanRegexp(p1_c3):
7884 LOG:  available indexes for BitmapScanRegexp(p1_c4):
7885 LOG:  available indexes for BitmapScanRegexp(p1_c1_c1):
7886 LOG:  available indexes for BitmapScanRegexp(p1_c1_c2):
7887 LOG:  available indexes for BitmapScanRegexp(p1_c3_c1):
7888 LOG:  available indexes for BitmapScanRegexp(p1_c3_c2):
7889 LOG:  pg_hint_plan:
7890 used hint:
7891 BitmapScanRegexp(p1 p1[^_].*)
7892 not used hint:
7893 duplication hint:
7894 error hint:
7895
7896          QUERY PLAN         
7897 ----------------------------
7898  Append
7899    ->  Seq Scan on p1
7900          Filter: (val = 1)
7901    ->  Seq Scan on p1_c1
7902          Filter: (val = 1)
7903    ->  Seq Scan on p1_c2
7904          Filter: (val = 1)
7905    ->  Seq Scan on p1_c3
7906          Filter: (val = 1)
7907    ->  Seq Scan on p1_c4
7908          Filter: (val = 1)
7909    ->  Seq Scan on p1_c1_c1
7910          Filter: (val = 1)
7911    ->  Seq Scan on p1_c1_c2
7912          Filter: (val = 1)
7913    ->  Seq Scan on p1_c3_c1
7914          Filter: (val = 1)
7915    ->  Seq Scan on p1_c3_c2
7916          Filter: (val = 1)
7917 (19 rows)
7918
7919 /*+ BitmapScan(p1 p1_.*val2.*)*/
7920 EXPLAIN (COSTS false) SELECT val FROM p1 WHERE val = 1;
7921 LOG:  available indexes for BitmapScan(p1):
7922 LOG:  available indexes for BitmapScan(p1_c1):
7923 LOG:  available indexes for BitmapScan(p1_c2):
7924 LOG:  available indexes for BitmapScan(p1_c3):
7925 LOG:  available indexes for BitmapScan(p1_c4):
7926 LOG:  available indexes for BitmapScan(p1_c1_c1):
7927 LOG:  available indexes for BitmapScan(p1_c1_c2):
7928 LOG:  available indexes for BitmapScan(p1_c3_c1):
7929 LOG:  available indexes for BitmapScan(p1_c3_c2):
7930 LOG:  pg_hint_plan:
7931 used hint:
7932 BitmapScan(p1 p1_.*val2.*)
7933 not used hint:
7934 duplication hint:
7935 error hint:
7936
7937          QUERY PLAN         
7938 ----------------------------
7939  Append
7940    ->  Seq Scan on p1
7941          Filter: (val = 1)
7942    ->  Seq Scan on p1_c1
7943          Filter: (val = 1)
7944    ->  Seq Scan on p1_c2
7945          Filter: (val = 1)
7946    ->  Seq Scan on p1_c3
7947          Filter: (val = 1)
7948    ->  Seq Scan on p1_c4
7949          Filter: (val = 1)
7950    ->  Seq Scan on p1_c1_c1
7951          Filter: (val = 1)
7952    ->  Seq Scan on p1_c1_c2
7953          Filter: (val = 1)
7954    ->  Seq Scan on p1_c3_c1
7955          Filter: (val = 1)
7956    ->  Seq Scan on p1_c3_c2
7957          Filter: (val = 1)
7958 (19 rows)
7959
7960 -- search from hint table
7961 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints) VALUES ('EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;', '', 'SeqScan(t1)');
7962 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints) VALUES ('EXPLAIN (COSTS false) SELECT id FROM t1 WHERE t1.id = ?;', '', 'IndexScan(t1)');
7963 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints) VALUES ('EXPLAIN SELECT * FROM t1 WHERE t1.id = ?;', '', 'BitmapScan(t1)');
7964 SELECT * FROM hint_plan.hints ORDER BY id;
7965  id |                    norm_query_string                     | application_name |     hints      
7966 ----+----------------------------------------------------------+------------------+----------------
7967   1 | EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = ?;  |                  | SeqScan(t1)
7968   2 | EXPLAIN (COSTS false) SELECT id FROM t1 WHERE t1.id = ?; |                  | IndexScan(t1)
7969   3 | EXPLAIN SELECT * FROM t1 WHERE t1.id = ?;                |                  | BitmapScan(t1)
7970 (3 rows)
7971
7972 SET pg_hint_plan.enable_hint_table = on;
7973 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1;
7974 LOG:  pg_hint_plan:
7975 used hint:
7976 SeqScan(t1)
7977 not used hint:
7978 duplication hint:
7979 error hint:
7980
7981      QUERY PLAN     
7982 --------------------
7983  Seq Scan on t1
7984    Filter: (id = 1)
7985 (2 rows)
7986
7987 SET pg_hint_plan.enable_hint_table = off;
7988 EXPLAIN (COSTS false) SELECT * FROM t1 WHERE t1.id = 1;
7989            QUERY PLAN           
7990 --------------------------------
7991  Index Scan using t1_pkey on t1
7992    Index Cond: (id = 1)
7993 (2 rows)
7994
7995 TRUNCATE hint_plan.hints;
7996 VACUUM ANALYZE hint_plan.hints;
7997 -- plpgsql test
7998 EXPLAIN (COSTS false) SELECT id FROM t1 WHERE t1.id = 1;
7999              QUERY PLAN              
8000 -------------------------------------
8001  Index Only Scan using t1_pkey on t1
8002    Index Cond: (id = 1)
8003 (2 rows)
8004
8005 -- static function
8006 CREATE FUNCTION testfunc() RETURNS RECORD AS $$
8007 DECLARE
8008   ret record;
8009 BEGIN
8010   SELECT /*+ SeqScan(t1) */ * INTO ret FROM t1 LIMIT 1;
8011   RETURN ret;
8012 END;
8013 $$ LANGUAGE plpgsql;
8014 SELECT testfunc();
8015 LOG:  pg_hint_plan:
8016 used hint:
8017 SeqScan(t1)
8018 not used hint:
8019 duplication hint:
8020 error hint:
8021
8022 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ *          FROM t1 LIMIT 1"
8023 PL/pgSQL function testfunc() line 5 at SQL statement
8024  testfunc 
8025 ----------
8026  (1,1)
8027 (1 row)
8028
8029 -- dynamic function
8030 DROP FUNCTION testfunc();
8031 CREATE FUNCTION testfunc() RETURNS void AS $$
8032 BEGIN
8033   EXECUTE format('/*+ SeqScan(t1) */ SELECT * FROM t1');
8034 END;
8035 $$ LANGUAGE plpgsql;
8036 SELECT testfunc();
8037 LOG:  pg_hint_plan:
8038 used hint:
8039 SeqScan(t1)
8040 not used hint:
8041 duplication hint:
8042 error hint:
8043
8044 CONTEXT:  SQL statement "/*+ SeqScan(t1) */ SELECT * FROM t1"
8045 PL/pgSQL function testfunc() line 3 at EXECUTE
8046  testfunc 
8047 ----------
8048  
8049 (1 row)
8050
8051 -- This should not use SeqScan(t1)
8052 /*+ IndexScan(t1) */ SELECT * from t1 LIMIT 1;
8053 LOG:  pg_hint_plan:
8054 used hint:
8055 IndexScan(t1)
8056 not used hint:
8057 duplication hint:
8058 error hint:
8059
8060  id | val 
8061 ----+-----
8062   1 |   1
8063 (1 row)
8064
8065 -- Perform
8066 DROP FUNCTION testfunc();
8067 CREATE FUNCTION testfunc() RETURNS void AS $$
8068 BEGIN
8069   PERFORM  1, /*+ SeqScan(t1) */ * from t1;
8070 END;
8071 $$ LANGUAGE plpgsql;
8072 SELECT testfunc();
8073 LOG:  pg_hint_plan:
8074 used hint:
8075 SeqScan(t1)
8076 not used hint:
8077 duplication hint:
8078 error hint:
8079
8080 CONTEXT:  SQL statement "SELECT 1, /*+ SeqScan(t1) */ * from t1"
8081 PL/pgSQL function testfunc() line 3 at PERFORM
8082  testfunc 
8083 ----------
8084  
8085 (1 row)
8086
8087 -- FOR loop
8088 DROP FUNCTION testfunc();
8089 CREATE FUNCTION testfunc() RETURNS int AS $$
8090 DECLARE
8091   sum int;
8092   v int;
8093 BEGIN
8094   sum := 0;
8095   FOR v IN SELECT /*+ SeqScan(t1) */ v FROM t1 ORDER BY id LOOP
8096     sum := sum + v;
8097   END LOOP;
8098   RETURN v;
8099 END;
8100 $$ LANGUAGE plpgsql;
8101 SELECT testfunc();
8102 LOG:  pg_hint_plan:
8103 used hint:
8104 SeqScan(t1)
8105 not used hint:
8106 duplication hint:
8107 error hint:
8108
8109 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ v FROM t1 ORDER BY id"
8110 PL/pgSQL function testfunc() line 7 at FOR over SELECT rows
8111  testfunc 
8112 ----------
8113          
8114 (1 row)
8115
8116 -- Dynamic FOR loop
8117 DROP FUNCTION testfunc();
8118 CREATE FUNCTION testfunc() RETURNS int AS $$
8119 DECLARE
8120   sum int;
8121   v int;
8122   i   int;
8123 BEGIN
8124   sum := 0;
8125   FOR v IN EXECUTE 'SELECT /*+ SeqScan(t1) */ val FROM t1 ORDER BY id' LOOP
8126     sum := sum + v;
8127   END LOOP;
8128   RETURN v;
8129 END;
8130 $$ LANGUAGE plpgsql;
8131 SELECT testfunc();
8132 LOG:  pg_hint_plan:
8133 used hint:
8134 SeqScan(t1)
8135 not used hint:
8136 duplication hint:
8137 error hint:
8138
8139 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ val FROM t1 ORDER BY id"
8140 PL/pgSQL function testfunc() line 8 at FOR over EXECUTE statement
8141  testfunc 
8142 ----------
8143         0
8144 (1 row)
8145
8146 -- Cursor FOR loop
8147 DROP FUNCTION testfunc();
8148 CREATE FUNCTION testfunc() RETURNS int AS $$
8149 DECLARE
8150   ref CURSOR FOR SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id;
8151   rec record;
8152   sum int := 0;
8153 BEGIN
8154   FOR rec IN ref LOOP
8155     sum := sum + rec.val;
8156   END LOOP;
8157   RETURN sum;
8158 END;
8159 $$ LANGUAGE plpgsql;
8160 SELECT testfunc();
8161 LOG:  pg_hint_plan:
8162 used hint:
8163 SeqScan(t1)
8164 not used hint:
8165 duplication hint:
8166 error hint:
8167
8168 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id"
8169 PL/pgSQL function testfunc() line 7 at FOR over cursor
8170  testfunc 
8171 ----------
8172    495000
8173 (1 row)
8174
8175 -- RETURN QUERY
8176 DROP FUNCTION testfunc();
8177 CREATE FUNCTION testfunc() RETURNS SETOF t1 AS $$
8178 BEGIN
8179   RETURN QUERY SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id;
8180 END;
8181 $$ LANGUAGE plpgsql;
8182 SELECT * FROM testfunc() LIMIT 1;
8183 LOG:  pg_hint_plan:
8184 used hint:
8185 SeqScan(t1)
8186 not used hint:
8187 duplication hint:
8188 error hint:
8189
8190 CONTEXT:  SQL statement "SELECT /*+ SeqScan(t1) */ * FROM t1 ORDER BY id"
8191 PL/pgSQL function testfunc() line 3 at RETURN QUERY
8192  id | val 
8193 ----+-----
8194   1 |   1
8195 (1 row)
8196
8197 -- Test for error exit from inner SQL statement.
8198 DROP FUNCTION testfunc();
8199 CREATE FUNCTION testfunc() RETURNS SETOF t1 AS $$
8200 BEGIN
8201   RETURN QUERY SELECT /*+ SeqScan(t1) */ * FROM ttx ORDER BY id;
8202 END;
8203 $$ LANGUAGE plpgsql;
8204 SELECT * FROM testfunc() LIMIT 1;
8205 ERROR:  relation "ttx" does not exist
8206 LINE 1: SELECT /*+ SeqScan(t1) */ * FROM ttx ORDER BY id
8207                                          ^
8208 QUERY:  SELECT /*+ SeqScan(t1) */ * FROM ttx ORDER BY id
8209 CONTEXT:  PL/pgSQL function testfunc() line 3 at RETURN QUERY
8210 -- this should not use SeqScan(t1) hint.
8211 /*+ IndexScan(t1) */ SELECT * from t1 LIMIT 1;
8212 LOG:  pg_hint_plan:
8213 used hint:
8214 IndexScan(t1)
8215 not used hint:
8216 duplication hint:
8217 error hint:
8218
8219  id | val 
8220 ----+-----
8221   1 |   1
8222 (1 row)
8223
8224 DROP FUNCTION testfunc();
8225 DROP EXTENSION pg_hint_plan;
8226 CREATE FUNCTION reset_stats_and_wait() RETURNS void AS $$
8227 DECLARE
8228   rows int;
8229 BEGIN
8230   rows = 1;
8231   while rows > 0 LOOP
8232    PERFORM pg_stat_reset();
8233    PERFORM pg_sleep(0.5);
8234    SELECT sum(seq_scan + idx_scan) from pg_stat_user_tables into rows;
8235   END LOOP;
8236 END;
8237 $$ LANGUAGE plpgsql;
8238 -- Dynamic query in pl/pgsql
8239 CREATE OR REPLACE FUNCTION dynsql1(x int) RETURNS int AS $$
8240 DECLARE c int;
8241 BEGIN
8242   EXECUTE '/*+ IndexScan(t1) */ SELECT count(*) FROM t1 WHERE id < $1'
8243         INTO c USING x;
8244   RETURN c;
8245 END;
8246 $$ VOLATILE LANGUAGE plpgsql;
8247 vacuum analyze t1;
8248 SET pg_hint_plan.enable_hint = false;
8249 SELECT pg_sleep(1);
8250  pg_sleep 
8251 ----------
8252  
8253 (1 row)
8254
8255 SELECT reset_stats_and_wait();
8256  reset_stats_and_wait 
8257 ----------------------
8258  
8259 (1 row)
8260
8261 SELECT dynsql1(9000);
8262  dynsql1 
8263 ---------
8264     8999
8265 (1 row)
8266
8267 SELECT pg_sleep(1);
8268  pg_sleep 
8269 ----------
8270  
8271 (1 row)
8272
8273 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';
8274  relname | seq_scan | idx_scan 
8275 ---------+----------+----------
8276  t1      | t        | f
8277 (1 row)
8278
8279 SET pg_hint_plan.enable_hint = true;
8280 SELECT pg_sleep(1);
8281  pg_sleep 
8282 ----------
8283  
8284 (1 row)
8285
8286 SELECT reset_stats_and_wait();
8287  reset_stats_and_wait 
8288 ----------------------
8289  
8290 (1 row)
8291
8292 SELECT dynsql1(9000);
8293 LOG:  pg_hint_plan:
8294 used hint:
8295 IndexScan(t1)
8296 not used hint:
8297 duplication hint:
8298 error hint:
8299
8300 CONTEXT:  SQL statement "/*+ IndexScan(t1) */ SELECT count(*) FROM t1 WHERE id < $1"
8301 PL/pgSQL function dynsql1(integer) line 4 at EXECUTE
8302  dynsql1 
8303 ---------
8304     8999
8305 (1 row)
8306
8307 SELECT pg_sleep(1);
8308  pg_sleep 
8309 ----------
8310  
8311 (1 row)
8312
8313 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';
8314  relname | seq_scan | idx_scan 
8315 ---------+----------+----------
8316  t1      | f        | t
8317 (1 row)
8318
8319 -- Looped dynamic query in pl/pgsql
8320 CREATE OR REPLACE FUNCTION dynsql2(x int, OUT r int) AS $$
8321 DECLARE
8322   c text;
8323   s int;
8324 BEGIN
8325   r := 0;
8326   FOR c IN SELECT f.f FROM (VALUES ('p1_c1'), ('p1_c2')) f(f) LOOP
8327     FOR s IN EXECUTE '/*+ IndexScan(' || c || ' ' || c || '_pkey) */ SELECT sum(val) FROM ' || c || ' WHERE id < ' || x LOOP
8328       r := r + s;
8329     END LOOP;
8330   END LOOP;
8331 END;
8332 $$ VOLATILE LANGUAGE plpgsql;
8333 SET pg_hint_plan.enable_hint = false;
8334 SELECT pg_sleep(1);
8335  pg_sleep 
8336 ----------
8337  
8338 (1 row)
8339
8340 SELECT reset_stats_and_wait();
8341  reset_stats_and_wait 
8342 ----------------------
8343  
8344 (1 row)
8345
8346 SELECT dynsql2(9000);
8347  dynsql2 
8348 ---------
8349     9900
8350 (1 row)
8351
8352 SELECT pg_sleep(1);
8353  pg_sleep 
8354 ----------
8355  
8356 (1 row)
8357
8358 -- one of the index scans happened while planning.
8359 SELECT relname, seq_scan, idx_scan FROM pg_stat_user_tables WHERE schemaname = 'public' AND (relname = 'p1_c1' OR relname = 'p1_c2');
8360  relname | seq_scan | idx_scan 
8361 ---------+----------+----------
8362  p1_c1   |        1 |        0
8363  p1_c2   |        1 |        1
8364 (2 rows)
8365
8366 SET pg_hint_plan.enable_hint = true;
8367 SELECT pg_sleep(1);
8368  pg_sleep 
8369 ----------
8370  
8371 (1 row)
8372
8373 SELECT reset_stats_and_wait();
8374  reset_stats_and_wait 
8375 ----------------------
8376  
8377 (1 row)
8378
8379 SELECT dynsql2(9000);
8380 LOG:  available indexes for IndexScan(p1_c1): p1_c1_pkey
8381 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8382 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8383 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_pkey
8384 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8385 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8386 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_pkey
8387 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8388 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8389 LOG:  pg_hint_plan:
8390 used hint:
8391 IndexScan(p1_c1 p1_c1_pkey)
8392 not used hint:
8393 duplication hint:
8394 error hint:
8395
8396 CONTEXT:  SQL statement "/*+ IndexScan(p1_c1 p1_c1_pkey) */ SELECT sum(val) FROM p1_c1 WHERE id < 9000"
8397 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8398 LOG:  available indexes for IndexScan(p1_c2): p1_c2_pkey
8399 CONTEXT:  SQL statement "/*+ IndexScan(p1_c2 p1_c2_pkey) */ SELECT sum(val) FROM p1_c2 WHERE id < 9000"
8400 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8401 LOG:  pg_hint_plan:
8402 used hint:
8403 IndexScan(p1_c2 p1_c2_pkey)
8404 not used hint:
8405 duplication hint:
8406 error hint:
8407
8408 CONTEXT:  SQL statement "/*+ IndexScan(p1_c2 p1_c2_pkey) */ SELECT sum(val) FROM p1_c2 WHERE id < 9000"
8409 PL/pgSQL function dynsql2(integer) line 8 at FOR over EXECUTE statement
8410  dynsql2 
8411 ---------
8412     9900
8413 (1 row)
8414
8415 SELECT pg_sleep(1);
8416  pg_sleep 
8417 ----------
8418  
8419 (1 row)
8420
8421 -- the index scan happened while planning.
8422 SELECT relname, seq_scan, idx_scan FROM pg_stat_user_tables WHERE schemaname = 'public' AND (relname = 'p1_c1' OR relname = 'p1_c2');
8423  relname | seq_scan | idx_scan 
8424 ---------+----------+----------
8425  p1_c1   |        0 |        1
8426  p1_c2   |        0 |        2
8427 (2 rows)
8428
8429 -- Subqueries on inheritance tables under UNION
8430 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8431 UNION ALL
8432 SELECT val::int FROM p2 WHERE id < 1000;
8433                QUERY PLAN                
8434 -----------------------------------------
8435  Append
8436    ->  Append
8437          ->  Seq Scan on p1
8438                Filter: (val < 1000)
8439          ->  Seq Scan on p1_c1
8440                Filter: (val < 1000)
8441          ->  Seq Scan on p1_c2
8442                Filter: (val < 1000)
8443          ->  Seq Scan on p1_c3
8444                Filter: (val < 1000)
8445          ->  Seq Scan on p1_c4
8446                Filter: (val < 1000)
8447          ->  Seq Scan on p1_c1_c1
8448                Filter: (val < 1000)
8449          ->  Seq Scan on p1_c1_c2
8450                Filter: (val < 1000)
8451          ->  Seq Scan on p1_c3_c1
8452                Filter: (val < 1000)
8453          ->  Seq Scan on p1_c3_c2
8454                Filter: (val < 1000)
8455    ->  Result
8456          ->  Append
8457                ->  Seq Scan on p2
8458                      Filter: (id < 1000)
8459                ->  Seq Scan on p2_c1
8460                      Filter: (id < 1000)
8461                ->  Seq Scan on p2_c2
8462                      Filter: (id < 1000)
8463                ->  Seq Scan on p2_c3
8464                      Filter: (id < 1000)
8465                ->  Seq Scan on p2_c4
8466                      Filter: (id < 1000)
8467                ->  Seq Scan on p2_c1_c1
8468                      Filter: (id < 1000)
8469                ->  Seq Scan on p2_c1_c2
8470                      Filter: (id < 1000)
8471                ->  Seq Scan on p2_c3_c1
8472                      Filter: (id < 1000)
8473                ->  Seq Scan on p2_c3_c2
8474                      Filter: (id < 1000)
8475 (40 rows)
8476
8477 /*+ IndexScan(p1 p1_val2) */
8478 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8479 UNION ALL
8480 SELECT val::int FROM p2 WHERE id < 1000;
8481 LOG:  available indexes for IndexScan(p1): p1_val3 p1_val2 p1_val1
8482 LOG:  available indexes for IndexScan(p1_c1): p1_c1_val3 p1_c1_val2 p1_c1_val1
8483 LOG:  available indexes for IndexScan(p1_c2): p1_c2_val3 p1_c2_val2 p1_c2_val1
8484 LOG:  available indexes for IndexScan(p1_c3): p1_c3_val3 p1_c3_val2 p1_c3_val1
8485 LOG:  available indexes for IndexScan(p1_c4): p1_c4_val3 p1_c4_val2 p1_c4_val1
8486 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_val3 p1_c1_c1_val2 p1_c1_c1_val1
8487 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_val3 p1_c1_c2_val2 p1_c1_c2_val1
8488 LOG:  available indexes for IndexScan(p1_c3_c1): p1_c3_c1_val3 p1_c3_c1_val2 p1_c3_c1_val1
8489 LOG:  available indexes for IndexScan(p1_c3_c2): p1_c3_c2_val3 p1_c3_c2_val2 p1_c3_c2_val1
8490 LOG:  pg_hint_plan:
8491 used hint:
8492 IndexScan(p1 p1_val2)
8493 not used hint:
8494 duplication hint:
8495 error hint:
8496
8497                        QUERY PLAN                       
8498 --------------------------------------------------------
8499  Append
8500    ->  Append
8501          ->  Index Scan using p1_val3 on p1
8502                Index Cond: (val < 1000)
8503          ->  Index Scan using p1_c1_val3 on p1_c1
8504                Index Cond: (val < 1000)
8505          ->  Index Scan using p1_c2_val3 on p1_c2
8506                Index Cond: (val < 1000)
8507          ->  Index Scan using p1_c3_val3 on p1_c3
8508                Index Cond: (val < 1000)
8509          ->  Index Scan using p1_c4_val3 on p1_c4
8510                Index Cond: (val < 1000)
8511          ->  Index Scan using p1_c1_c1_val3 on p1_c1_c1
8512                Index Cond: (val < 1000)
8513          ->  Index Scan using p1_c1_c2_val3 on p1_c1_c2
8514                Index Cond: (val < 1000)
8515          ->  Index Scan using p1_c3_c1_val3 on p1_c3_c1
8516                Index Cond: (val < 1000)
8517          ->  Index Scan using p1_c3_c2_val3 on p1_c3_c2
8518                Index Cond: (val < 1000)
8519    ->  Result
8520          ->  Append
8521                ->  Seq Scan on p2
8522                      Filter: (id < 1000)
8523                ->  Seq Scan on p2_c1
8524                      Filter: (id < 1000)
8525                ->  Seq Scan on p2_c2
8526                      Filter: (id < 1000)
8527                ->  Seq Scan on p2_c3
8528                      Filter: (id < 1000)
8529                ->  Seq Scan on p2_c4
8530                      Filter: (id < 1000)
8531                ->  Seq Scan on p2_c1_c1
8532                      Filter: (id < 1000)
8533                ->  Seq Scan on p2_c1_c2
8534                      Filter: (id < 1000)
8535                ->  Seq Scan on p2_c3_c1
8536                      Filter: (id < 1000)
8537                ->  Seq Scan on p2_c3_c2
8538                      Filter: (id < 1000)
8539 (40 rows)
8540
8541 /*+ IndexScan(p1 p1_val2) IndexScan(p2 p2_id_val_idx) */
8542 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8543 UNION ALL
8544 SELECT val::int FROM p2 WHERE id < 1000;
8545 LOG:  available indexes for IndexScan(p1): p1_val3 p1_val2 p1_val1
8546 LOG:  available indexes for IndexScan(p1_c1): p1_c1_val3 p1_c1_val2 p1_c1_val1
8547 LOG:  available indexes for IndexScan(p1_c2): p1_c2_val3 p1_c2_val2 p1_c2_val1
8548 LOG:  available indexes for IndexScan(p1_c3): p1_c3_val3 p1_c3_val2 p1_c3_val1
8549 LOG:  available indexes for IndexScan(p1_c4): p1_c4_val3 p1_c4_val2 p1_c4_val1
8550 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_val3 p1_c1_c1_val2 p1_c1_c1_val1
8551 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_val3 p1_c1_c2_val2 p1_c1_c2_val1
8552 LOG:  available indexes for IndexScan(p1_c3_c1): p1_c3_c1_val3 p1_c3_c1_val2 p1_c3_c1_val1
8553 LOG:  available indexes for IndexScan(p1_c3_c2): p1_c3_c2_val3 p1_c3_c2_val2 p1_c3_c2_val1
8554 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
8555 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
8556 LOG:  available indexes for IndexScan(p2_c2): p2_c2_id_val_idx
8557 LOG:  available indexes for IndexScan(p2_c3): p2_c3_id_val_idx
8558 LOG:  available indexes for IndexScan(p2_c4): p2_c4_id_val_idx
8559 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
8560 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
8561 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_id_val_idx
8562 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_id_val_idx
8563 LOG:  pg_hint_plan:
8564 used hint:
8565 IndexScan(p1 p1_val2)
8566 IndexScan(p2 p2_id_val_idx)
8567 not used hint:
8568 duplication hint:
8569 error hint:
8570
8571                              QUERY PLAN                             
8572 --------------------------------------------------------------------
8573  Append
8574    ->  Append
8575          ->  Index Scan using p1_val3 on p1
8576                Index Cond: (val < 1000)
8577          ->  Index Scan using p1_c1_val3 on p1_c1
8578                Index Cond: (val < 1000)
8579          ->  Index Scan using p1_c2_val3 on p1_c2
8580                Index Cond: (val < 1000)
8581          ->  Index Scan using p1_c3_val3 on p1_c3
8582                Index Cond: (val < 1000)
8583          ->  Index Scan using p1_c4_val3 on p1_c4
8584                Index Cond: (val < 1000)
8585          ->  Index Scan using p1_c1_c1_val3 on p1_c1_c1
8586                Index Cond: (val < 1000)
8587          ->  Index Scan using p1_c1_c2_val3 on p1_c1_c2
8588                Index Cond: (val < 1000)
8589          ->  Index Scan using p1_c3_c1_val3 on p1_c3_c1
8590                Index Cond: (val < 1000)
8591          ->  Index Scan using p1_c3_c2_val3 on p1_c3_c2
8592                Index Cond: (val < 1000)
8593    ->  Result
8594          ->  Append
8595                ->  Index Scan using p2_id_val_idx on p2
8596                      Index Cond: (id < 1000)
8597                ->  Index Scan using p2_c1_id_val_idx on p2_c1
8598                      Index Cond: (id < 1000)
8599                ->  Index Scan using p2_c2_id_val_idx on p2_c2
8600                      Index Cond: (id < 1000)
8601                ->  Index Scan using p2_c3_id_val_idx on p2_c3
8602                      Index Cond: (id < 1000)
8603                ->  Index Scan using p2_c4_id_val_idx on p2_c4
8604                      Index Cond: (id < 1000)
8605                ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1
8606                      Index Cond: (id < 1000)
8607                ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2
8608                      Index Cond: (id < 1000)
8609                ->  Index Scan using p2_c3_c1_id_val_idx on p2_c3_c1
8610                      Index Cond: (id < 1000)
8611                ->  Index Scan using p2_c3_c2_id_val_idx on p2_c3_c2
8612                      Index Cond: (id < 1000)
8613 (40 rows)
8614
8615 -- union all case
8616 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8617 UNION
8618 SELECT val::int FROM p2 WHERE id < 1000;
8619                   QUERY PLAN                   
8620 -----------------------------------------------
8621  HashAggregate
8622    Group Key: p1.val
8623    ->  Append
8624          ->  Append
8625                ->  Seq Scan on p1
8626                      Filter: (val < 1000)
8627                ->  Seq Scan on p1_c1
8628                      Filter: (val < 1000)
8629                ->  Seq Scan on p1_c2
8630                      Filter: (val < 1000)
8631                ->  Seq Scan on p1_c3
8632                      Filter: (val < 1000)
8633                ->  Seq Scan on p1_c4
8634                      Filter: (val < 1000)
8635                ->  Seq Scan on p1_c1_c1
8636                      Filter: (val < 1000)
8637                ->  Seq Scan on p1_c1_c2
8638                      Filter: (val < 1000)
8639                ->  Seq Scan on p1_c3_c1
8640                      Filter: (val < 1000)
8641                ->  Seq Scan on p1_c3_c2
8642                      Filter: (val < 1000)
8643          ->  Result
8644                ->  Append
8645                      ->  Seq Scan on p2
8646                            Filter: (id < 1000)
8647                      ->  Seq Scan on p2_c1
8648                            Filter: (id < 1000)
8649                      ->  Seq Scan on p2_c2
8650                            Filter: (id < 1000)
8651                      ->  Seq Scan on p2_c3
8652                            Filter: (id < 1000)
8653                      ->  Seq Scan on p2_c4
8654                            Filter: (id < 1000)
8655                      ->  Seq Scan on p2_c1_c1
8656                            Filter: (id < 1000)
8657                      ->  Seq Scan on p2_c1_c2
8658                            Filter: (id < 1000)
8659                      ->  Seq Scan on p2_c3_c1
8660                            Filter: (id < 1000)
8661                      ->  Seq Scan on p2_c3_c2
8662                            Filter: (id < 1000)
8663 (42 rows)
8664
8665 /*+ IndexScan(p2 p2_id_val_idx) */
8666 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8667 UNION
8668 SELECT val::int FROM p2 WHERE id < 1000;
8669 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
8670 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
8671 LOG:  available indexes for IndexScan(p2_c2): p2_c2_id_val_idx
8672 LOG:  available indexes for IndexScan(p2_c3): p2_c3_id_val_idx
8673 LOG:  available indexes for IndexScan(p2_c4): p2_c4_id_val_idx
8674 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
8675 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
8676 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_id_val_idx
8677 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_id_val_idx
8678 LOG:  pg_hint_plan:
8679 used hint:
8680 IndexScan(p2 p2_id_val_idx)
8681 not used hint:
8682 duplication hint:
8683 error hint:
8684
8685                                 QUERY PLAN                                
8686 --------------------------------------------------------------------------
8687  HashAggregate
8688    Group Key: p1.val
8689    ->  Append
8690          ->  Append
8691                ->  Seq Scan on p1
8692                      Filter: (val < 1000)
8693                ->  Seq Scan on p1_c1
8694                      Filter: (val < 1000)
8695                ->  Seq Scan on p1_c2
8696                      Filter: (val < 1000)
8697                ->  Seq Scan on p1_c3
8698                      Filter: (val < 1000)
8699                ->  Seq Scan on p1_c4
8700                      Filter: (val < 1000)
8701                ->  Seq Scan on p1_c1_c1
8702                      Filter: (val < 1000)
8703                ->  Seq Scan on p1_c1_c2
8704                      Filter: (val < 1000)
8705                ->  Seq Scan on p1_c3_c1
8706                      Filter: (val < 1000)
8707                ->  Seq Scan on p1_c3_c2
8708                      Filter: (val < 1000)
8709          ->  Result
8710                ->  Append
8711                      ->  Index Scan using p2_id_val_idx on p2
8712                            Index Cond: (id < 1000)
8713                      ->  Index Scan using p2_c1_id_val_idx on p2_c1
8714                            Index Cond: (id < 1000)
8715                      ->  Index Scan using p2_c2_id_val_idx on p2_c2
8716                            Index Cond: (id < 1000)
8717                      ->  Index Scan using p2_c3_id_val_idx on p2_c3
8718                            Index Cond: (id < 1000)
8719                      ->  Index Scan using p2_c4_id_val_idx on p2_c4
8720                            Index Cond: (id < 1000)
8721                      ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1
8722                            Index Cond: (id < 1000)
8723                      ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2
8724                            Index Cond: (id < 1000)
8725                      ->  Index Scan using p2_c3_c1_id_val_idx on p2_c3_c1
8726                            Index Cond: (id < 1000)
8727                      ->  Index Scan using p2_c3_c2_id_val_idx on p2_c3_c2
8728                            Index Cond: (id < 1000)
8729 (42 rows)
8730
8731 /*+ IndexScan(p1 p1_val2) IndexScan(p2 p2_id_val_idx) */
8732 EXPLAIN (COSTS off) SELECT val FROM p1 WHERE val < 1000
8733 UNION
8734 SELECT val::int FROM p2 WHERE id < 1000;
8735 LOG:  available indexes for IndexScan(p1): p1_val3 p1_val2 p1_val1
8736 LOG:  available indexes for IndexScan(p1_c1): p1_c1_val3 p1_c1_val2 p1_c1_val1
8737 LOG:  available indexes for IndexScan(p1_c2): p1_c2_val3 p1_c2_val2 p1_c2_val1
8738 LOG:  available indexes for IndexScan(p1_c3): p1_c3_val3 p1_c3_val2 p1_c3_val1
8739 LOG:  available indexes for IndexScan(p1_c4): p1_c4_val3 p1_c4_val2 p1_c4_val1
8740 LOG:  available indexes for IndexScan(p1_c1_c1): p1_c1_c1_val3 p1_c1_c1_val2 p1_c1_c1_val1
8741 LOG:  available indexes for IndexScan(p1_c1_c2): p1_c1_c2_val3 p1_c1_c2_val2 p1_c1_c2_val1
8742 LOG:  available indexes for IndexScan(p1_c3_c1): p1_c3_c1_val3 p1_c3_c1_val2 p1_c3_c1_val1
8743 LOG:  available indexes for IndexScan(p1_c3_c2): p1_c3_c2_val3 p1_c3_c2_val2 p1_c3_c2_val1
8744 LOG:  available indexes for IndexScan(p2): p2_id_val_idx
8745 LOG:  available indexes for IndexScan(p2_c1): p2_c1_id_val_idx
8746 LOG:  available indexes for IndexScan(p2_c2): p2_c2_id_val_idx
8747 LOG:  available indexes for IndexScan(p2_c3): p2_c3_id_val_idx
8748 LOG:  available indexes for IndexScan(p2_c4): p2_c4_id_val_idx
8749 LOG:  available indexes for IndexScan(p2_c1_c1): p2_c1_c1_id_val_idx
8750 LOG:  available indexes for IndexScan(p2_c1_c2): p2_c1_c2_id_val_idx
8751 LOG:  available indexes for IndexScan(p2_c3_c1): p2_c3_c1_id_val_idx
8752 LOG:  available indexes for IndexScan(p2_c3_c2): p2_c3_c2_id_val_idx
8753 LOG:  pg_hint_plan:
8754 used hint:
8755 IndexScan(p1 p1_val2)
8756 IndexScan(p2 p2_id_val_idx)
8757 not used hint:
8758 duplication hint:
8759 error hint:
8760
8761                                 QUERY PLAN                                
8762 --------------------------------------------------------------------------
8763  HashAggregate
8764    Group Key: p1.val
8765    ->  Append
8766          ->  Append
8767                ->  Index Scan using p1_val3 on p1
8768                      Index Cond: (val < 1000)
8769                ->  Index Scan using p1_c1_val3 on p1_c1
8770                      Index Cond: (val < 1000)
8771                ->  Index Scan using p1_c2_val3 on p1_c2
8772                      Index Cond: (val < 1000)
8773                ->  Index Scan using p1_c3_val3 on p1_c3
8774                      Index Cond: (val < 1000)
8775                ->  Index Scan using p1_c4_val3 on p1_c4
8776                      Index Cond: (val < 1000)
8777                ->  Index Scan using p1_c1_c1_val3 on p1_c1_c1
8778                      Index Cond: (val < 1000)
8779                ->  Index Scan using p1_c1_c2_val3 on p1_c1_c2
8780                      Index Cond: (val < 1000)
8781                ->  Index Scan using p1_c3_c1_val3 on p1_c3_c1
8782                      Index Cond: (val < 1000)
8783                ->  Index Scan using p1_c3_c2_val3 on p1_c3_c2
8784                      Index Cond: (val < 1000)
8785          ->  Result
8786                ->  Append
8787                      ->  Index Scan using p2_id_val_idx on p2
8788                            Index Cond: (id < 1000)
8789                      ->  Index Scan using p2_c1_id_val_idx on p2_c1
8790                            Index Cond: (id < 1000)
8791                      ->  Index Scan using p2_c2_id_val_idx on p2_c2
8792                            Index Cond: (id < 1000)
8793                      ->  Index Scan using p2_c3_id_val_idx on p2_c3
8794                            Index Cond: (id < 1000)
8795                      ->  Index Scan using p2_c4_id_val_idx on p2_c4
8796                            Index Cond: (id < 1000)
8797                      ->  Index Scan using p2_c1_c1_id_val_idx on p2_c1_c1
8798                            Index Cond: (id < 1000)
8799                      ->  Index Scan using p2_c1_c2_id_val_idx on p2_c1_c2
8800                            Index Cond: (id < 1000)
8801                      ->  Index Scan using p2_c3_c1_id_val_idx on p2_c3_c1
8802                            Index Cond: (id < 1000)
8803                      ->  Index Scan using p2_c3_c2_id_val_idx on p2_c3_c2
8804                            Index Cond: (id < 1000)
8805 (42 rows)
8806
8807 --
8808 -- Rows hint tests
8809 --
8810 -- Explain result includes "Planning time" if COSTS is enabled, but
8811 -- this test needs it enabled for get rows count. So do tests via psql
8812 -- and grep -v the mutable line.
8813 -- Parse error check
8814 /*+ Rows() */ SELECT 1;
8815 INFO:  pg_hint_plan: hint syntax error at or near " "
8816 DETAIL:  Rows hint needs at least one relation followed by one correction term.
8817 LOG:  pg_hint_plan:
8818 used hint:
8819 not used hint:
8820 duplication hint:
8821 error hint:
8822 Rows()
8823
8824  ?column? 
8825 ----------
8826         1
8827 (1 row)
8828
8829 /*+ Rows(x) */ SELECT 1;
8830 INFO:  pg_hint_plan: hint syntax error at or near " "
8831 DETAIL:  Rows hint needs at least one relation followed by one correction term.
8832 LOG:  pg_hint_plan:
8833 used hint:
8834 not used hint:
8835 duplication hint:
8836 error hint:
8837 Rows()
8838
8839  ?column? 
8840 ----------
8841         1
8842 (1 row)
8843
8844 -- value types
8845 \o results/pg_hint_plan.tmpout
8846 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8847 \o
8848 \! sql/maskout.sh results/pg_hint_plan.tmpout
8849                                   QUERY PLAN                                  
8850 ------------------------------------------------------------------------------
8851  Merge Join  (cost=xxx rows=1000 width=xxx)
8852    Merge Cond: (t1.id = t2.id)
8853    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8854    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8855 (4 rows)
8856
8857 \o results/pg_hint_plan.tmpout
8858 /*+ Rows(t1 t2 #99) */
8859 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8860 LOG:  pg_hint_plan:
8861 used hint:
8862 Rows(t1 t2 #99)
8863 not used hint:
8864 duplication hint:
8865 error hint:
8866
8867 \o
8868 \! sql/maskout.sh results/pg_hint_plan.tmpout
8869                                   QUERY PLAN                                  
8870 ------------------------------------------------------------------------------
8871  Merge Join  (cost=xxx rows=99 width=xxx)
8872    Merge Cond: (t1.id = t2.id)
8873    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8874    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8875 (4 rows)
8876
8877 \o results/pg_hint_plan.tmpout
8878 /*+ Rows(t1 t2 +99) */
8879 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8880 LOG:  pg_hint_plan:
8881 used hint:
8882 Rows(t1 t2 +99)
8883 not used hint:
8884 duplication hint:
8885 error hint:
8886
8887 \o
8888 \! sql/maskout.sh results/pg_hint_plan.tmpout
8889                                   QUERY PLAN                                  
8890 ------------------------------------------------------------------------------
8891  Merge Join  (cost=xxx rows=1099 width=xxx)
8892    Merge Cond: (t1.id = t2.id)
8893    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8894    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8895 (4 rows)
8896
8897 \o results/pg_hint_plan.tmpout
8898 /*+ Rows(t1 t2 -99) */
8899 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8900 LOG:  pg_hint_plan:
8901 used hint:
8902 Rows(t1 t2 -99)
8903 not used hint:
8904 duplication hint:
8905 error hint:
8906
8907 \o
8908 \! sql/maskout.sh results/pg_hint_plan.tmpout
8909                                   QUERY PLAN                                  
8910 ------------------------------------------------------------------------------
8911  Merge Join  (cost=xxx rows=901 width=xxx)
8912    Merge Cond: (t1.id = t2.id)
8913    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8914    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8915 (4 rows)
8916
8917 \o results/pg_hint_plan.tmpout
8918 /*+ Rows(t1 t2 *99) */
8919 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8920 LOG:  pg_hint_plan:
8921 used hint:
8922 Rows(t1 t2 *99)
8923 not used hint:
8924 duplication hint:
8925 error hint:
8926
8927 \o
8928 \! sql/maskout.sh results/pg_hint_plan.tmpout
8929                                   QUERY PLAN                                  
8930 ------------------------------------------------------------------------------
8931  Merge Join  (cost=xxx rows=99000 width=xxx)
8932    Merge Cond: (t1.id = t2.id)
8933    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8934    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8935 (4 rows)
8936
8937 \o results/pg_hint_plan.tmpout
8938 /*+ Rows(t1 t2 *0.01) */
8939 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
8940 LOG:  pg_hint_plan:
8941 used hint:
8942 Rows(t1 t2 *0.01)
8943 not used hint:
8944 duplication hint:
8945 error hint:
8946
8947 \o
8948 \! sql/maskout.sh results/pg_hint_plan.tmpout
8949                                   QUERY PLAN                                  
8950 ------------------------------------------------------------------------------
8951  Merge Join  (cost=xxx rows=10 width=xxx)
8952    Merge Cond: (t1.id = t2.id)
8953    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8954    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8955 (4 rows)
8956
8957 \o results/pg_hint_plan.tmpout
8958 /*+ Rows(t1 t2 #aa) */
8959 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
8960 INFO:  pg_hint_plan: hint syntax error at or near "aa"
8961 DETAIL:  Rows hint requires valid number as rows estimation.
8962 LOG:  pg_hint_plan:
8963 used hint:
8964 not used hint:
8965 duplication hint:
8966 error hint:
8967 Rows(t1 t2 #aa)
8968
8969 \o
8970 \! sql/maskout.sh results/pg_hint_plan.tmpout
8971                                   QUERY PLAN                                  
8972 ------------------------------------------------------------------------------
8973  Merge Join  (cost=xxx rows=1000 width=xxx)
8974    Merge Cond: (t1.id = t2.id)
8975    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8976    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8977 (4 rows)
8978
8979 \o results/pg_hint_plan.tmpout
8980 /*+ Rows(t1 t2 /99) */
8981 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
8982 INFO:  pg_hint_plan: hint syntax error at or near "/99"
8983 DETAIL:  Unrecognized rows value type notation.
8984 LOG:  pg_hint_plan:
8985 used hint:
8986 not used hint:
8987 duplication hint:
8988 error hint:
8989 Rows(t1 t2 /99)
8990
8991 \o
8992 \! sql/maskout.sh results/pg_hint_plan.tmpout
8993                                   QUERY PLAN                                  
8994 ------------------------------------------------------------------------------
8995  Merge Join  (cost=xxx rows=1000 width=xxx)
8996    Merge Cond: (t1.id = t2.id)
8997    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
8998    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
8999 (4 rows)
9000
9001 -- round up to 1
9002 \o results/pg_hint_plan.tmpout
9003 /*+ Rows(t1 t2 -99999) */
9004 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
9005 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 -99999) 
9006 LOG:  pg_hint_plan:
9007 used hint:
9008 Rows(t1 t2 -99999)
9009 not used hint:
9010 duplication hint:
9011 error hint:
9012
9013 \o
9014 \! sql/maskout.sh results/pg_hint_plan.tmpout
9015                                   QUERY PLAN                                  
9016 ------------------------------------------------------------------------------
9017  Merge Join  (cost=xxx rows=1 width=xxx)
9018    Merge Cond: (t1.id = t2.id)
9019    ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
9020    ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
9021 (4 rows)
9022
9023 -- complex join tree
9024 \o results/pg_hint_plan.tmpout
9025 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
9026 \o
9027 \! sql/maskout.sh results/pg_hint_plan.tmpout
9028                                      QUERY PLAN                                     
9029 ------------------------------------------------------------------------------------
9030  Merge Join  (cost=xxx rows=10 width=xxx)
9031    Merge Cond: (t1.id = t3.id)
9032    ->  Merge Join  (cost=xxx rows=1000 width=xxx)
9033          Merge Cond: (t1.id = t2.id)
9034          ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
9035          ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
9036    ->  Sort  (cost=xxx rows=100 width=xxx)
9037          Sort Key: t3.id
9038          ->  Seq Scan on t3  (cost=xxx rows=100 width=xxx)
9039 (9 rows)
9040
9041 \o results/pg_hint_plan.tmpout
9042 /*+ Rows(t1 t2 #22) */
9043 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
9044 LOG:  pg_hint_plan:
9045 used hint:
9046 Rows(t1 t2 #22)
9047 not used hint:
9048 duplication hint:
9049 error hint:
9050
9051 \o
9052 \! sql/maskout.sh results/pg_hint_plan.tmpout
9053                                      QUERY PLAN                                     
9054 ------------------------------------------------------------------------------------
9055  Merge Join  (cost=xxx rows=1 width=xxx)
9056    Merge Cond: (t1.id = t3.id)
9057    ->  Merge Join  (cost=xxx rows=22 width=xxx)
9058          Merge Cond: (t1.id = t2.id)
9059          ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
9060          ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
9061    ->  Sort  (cost=xxx rows=100 width=xxx)
9062          Sort Key: t3.id
9063          ->  Seq Scan on t3  (cost=xxx rows=100 width=xxx)
9064 (9 rows)
9065
9066 \o results/pg_hint_plan.tmpout
9067 /*+ Rows(t1 t3 *10) */
9068 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
9069 LOG:  pg_hint_plan:
9070 used hint:
9071 Rows(t1 t3 *10)
9072 not used hint:
9073 duplication hint:
9074 error hint:
9075
9076 \o
9077 set max_parallel_workers_per_gather to DEFAULT;
9078 \! sql/maskout.sh results/pg_hint_plan.tmpout
9079                                      QUERY PLAN                                     
9080 ------------------------------------------------------------------------------------
9081  Merge Join  (cost=xxx rows=100 width=xxx)
9082    Merge Cond: (t1.id = t3.id)
9083    ->  Merge Join  (cost=xxx rows=1000 width=xxx)
9084          Merge Cond: (t1.id = t2.id)
9085          ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
9086          ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
9087    ->  Sort  (cost=xxx rows=100 width=xxx)
9088          Sort Key: t3.id
9089          ->  Seq Scan on t3  (cost=xxx rows=100 width=xxx)
9090 (9 rows)
9091
9092 \! rm results/pg_hint_plan.tmpout
9093 -- hint error level
9094 set client_min_messages to 'DEBUG1';
9095 set pg_hint_plan.debug_level to 'verbose';
9096 /*+ SeqScan( */ SELECT 1;
9097 INFO:  pg_hint_plan: hint syntax error at or near ""
9098 DETAIL:  Closing parenthesis is necessary.
9099  ?column? 
9100 ----------
9101         1
9102 (1 row)
9103
9104 /*+ SeqScan(t1) */ SELECT * FROM t1 LIMIT 0;
9105 LOG:  pg_hint_plan:
9106 used hint:
9107 SeqScan(t1)
9108 not used hint:
9109 duplication hint:
9110 error hint:
9111
9112  id | val 
9113 ----+-----
9114 (0 rows)
9115
9116 set pg_hint_plan.message_level to 'DEBUG1';
9117 set pg_hint_plan.parse_messages to 'NOTICE';
9118 /*+ SeqScan( */ SELECT 1;
9119 NOTICE:  pg_hint_plan: hint syntax error at or near ""
9120 DETAIL:  Closing parenthesis is necessary.
9121  ?column? 
9122 ----------
9123         1
9124 (1 row)
9125
9126 /*+ SeqScan(t1) */ SELECT * FROM t1 LIMIT 0;
9127 DEBUG:  pg_hint_plan:
9128 used hint:
9129 SeqScan(t1)
9130 not used hint:
9131 duplication hint:
9132 error hint:
9133
9134  id | val 
9135 ----+-----
9136 (0 rows)
9137