OSDN Git Service

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