OSDN Git Service

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