OSDN Git Service

副問い合わせやビュー定義内のテーブル数が1つの場合に、スキャンヒントが
[pghintplan/pg_hint_plan.git] / expected / pg_hint_plan.out
1 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
2               QUERY PLAN              
3 --------------------------------------
4  Merge Join
5    Merge Cond: (t1.id = t2.id)
6    ->  Index Scan using t1_pkey on t1
7    ->  Index Scan using t2_pkey on t2
8 (4 rows)
9
10 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
11                 QUERY PLAN                 
12 -------------------------------------------
13  Merge Join
14    Merge Cond: (t2.val = t1.val)
15    ->  Index Scan using t2_val on t2
16    ->  Materialize
17          ->  Index Scan using t1_val on t1
18 (5 rows)
19
20 LOAD 'pg_hint_plan';
21 SET pg_hint_plan.debug_print TO on;
22 SET client_min_messages TO LOG;
23 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
24               QUERY PLAN              
25 --------------------------------------
26  Merge Join
27    Merge Cond: (t1.id = t2.id)
28    ->  Index Scan using t1_pkey on t1
29    ->  Index Scan using t2_pkey on t2
30 (4 rows)
31
32 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
33                 QUERY PLAN                 
34 -------------------------------------------
35  Merge Join
36    Merge Cond: (t2.val = t1.val)
37    ->  Index Scan using t2_val on t2
38    ->  Materialize
39          ->  Index Scan using t1_val on t1
40 (5 rows)
41
42 /*+ Test (t1 t2) */
43 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
44 INFO:  hint syntax error at or near "Test (t1 t2) "
45 DETAIL:  Keyword "Test" does not exist.
46               QUERY PLAN              
47 --------------------------------------
48  Merge Join
49    Merge Cond: (t1.id = t2.id)
50    ->  Index Scan using t1_pkey on t1
51    ->  Index Scan using t2_pkey on t2
52 (4 rows)
53
54 SET pg_hint_plan.enable TO off;
55 /*+ Test (t1 t2) */
56 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
57               QUERY PLAN              
58 --------------------------------------
59  Merge Join
60    Merge Cond: (t1.id = t2.id)
61    ->  Index Scan using t1_pkey on t1
62    ->  Index Scan using t2_pkey on t2
63 (4 rows)
64
65 SET pg_hint_plan.enable TO on;
66 /*+Set(enable_indexscan off)*/
67 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
68 LOG:  pg_hint_plan:
69 used hint:
70 Set(enable_indexscan off)
71 not used hint:
72 duplication hint:
73 error hint:
74
75           QUERY PLAN          
76 ------------------------------
77  Hash Join
78    Hash Cond: (t1.id = t2.id)
79    ->  Seq Scan on t1
80    ->  Hash
81          ->  Seq Scan on t2
82 (5 rows)
83
84 /*+ Set(enable_indexscan off) Set(enable_hashjoin off) */
85 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
86 LOG:  pg_hint_plan:
87 used hint:
88 Set(enable_hashjoin off)
89 Set(enable_indexscan off)
90 not used hint:
91 duplication hint:
92 error hint:
93
94           QUERY PLAN           
95 -------------------------------
96  Merge Join
97    Merge Cond: (t1.id = t2.id)
98    ->  Sort
99          Sort Key: t1.id
100          ->  Seq Scan on t1
101    ->  Sort
102          Sort Key: t2.id
103          ->  Seq Scan on t2
104 (8 rows)
105
106 /*+      Set     (       enable_indexscan        off     )       */
107 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
108 LOG:  pg_hint_plan:
109 used hint:
110 Set(enable_indexscan off)
111 not used hint:
112 duplication hint:
113 error hint:
114
115           QUERY PLAN          
116 ------------------------------
117  Hash Join
118    Hash Cond: (t1.id = t2.id)
119    ->  Seq Scan on t1
120    ->  Hash
121          ->  Seq Scan on t2
122 (5 rows)
123
124 /*+      
125                 Set      
126                 (        
127                 enable_indexscan         
128                 off      
129                 )        
130                 */              
131 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
132 LOG:  pg_hint_plan:
133 used hint:
134 Set(enable_indexscan off)
135 not used hint:
136 duplication hint:
137 error hint:
138
139           QUERY PLAN          
140 ------------------------------
141  Hash Join
142    Hash Cond: (t1.id = t2.id)
143    ->  Seq Scan on t1
144    ->  Hash
145          ->  Seq Scan on t2
146 (5 rows)
147
148 /*+ Set(enable_indexscan off)Set(enable_nestloop off)Set(enable_mergejoin off)          
149                 Set(enable_seqscan off)
150                 */
151 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
152 LOG:  pg_hint_plan:
153 used hint:
154 Set(enable_indexscan off)
155 Set(enable_mergejoin off)
156 Set(enable_nestloop off)
157 Set(enable_seqscan off)
158 not used hint:
159 duplication hint:
160 error hint:
161
162                  QUERY PLAN                 
163 --------------------------------------------
164  Hash Join
165    Hash Cond: (t1.id = t2.id)
166    ->  Index Scan using t1_pkey on t1
167    ->  Hash
168          ->  Index Scan using t2_pkey on t2
169 (5 rows)
170
171 /*+Set(work_mem "1M")*/
172 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
173 INFO:  invalid value for parameter "work_mem": "1M"
174 HINT:  Valid units for this parameter are "kB", "MB", and "GB".
175 LOG:  pg_hint_plan:
176 used hint:
177 not used hint:
178 duplication hint:
179 error hint:
180 Set(work_mem 1M)
181
182               QUERY PLAN              
183 --------------------------------------
184  Merge Join
185    Merge Cond: (t1.id = t2.id)
186    ->  Index Scan using t1_pkey on t1
187    ->  Index Scan using t2_pkey on t2
188 (4 rows)
189
190 /*+Set(work_mem "1MB")*/
191 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
192 LOG:  pg_hint_plan:
193 used hint:
194 Set(work_mem 1MB)
195 not used hint:
196 duplication hint:
197 error hint:
198
199               QUERY PLAN              
200 --------------------------------------
201  Merge Join
202    Merge Cond: (t1.id = t2.id)
203    ->  Index Scan using t1_pkey on t1
204    ->  Index Scan using t2_pkey on t2
205 (4 rows)
206
207 /*+Set(work_mem TO "1MB")*/
208 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
209 INFO:  hint syntax error at or near ""1MB")"
210 DETAIL:  Closed parenthesis is necessary.
211               QUERY PLAN              
212 --------------------------------------
213  Merge Join
214    Merge Cond: (t1.id = t2.id)
215    ->  Index Scan using t1_pkey on t1
216    ->  Index Scan using t2_pkey on t2
217 (4 rows)
218
219 /*+SeqScan(t1 t2)*/
220 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
221 INFO:  hint syntax error at or near "t2)"
222 DETAIL:  Closed parenthesis is necessary.
223               QUERY PLAN              
224 --------------------------------------
225  Merge Join
226    Merge Cond: (t1.id = t2.id)
227    ->  Index Scan using t1_pkey on t1
228    ->  Index Scan using t2_pkey on t2
229 (4 rows)
230
231 /*+SeqScan(t1)*/
232 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
233 LOG:  pg_hint_plan:
234 used hint:
235 SeqScan(t1)
236 not used hint:
237 duplication hint:
238 error hint:
239
240           QUERY PLAN          
241 ------------------------------
242  Hash Join
243    Hash Cond: (t1.id = t2.id)
244    ->  Seq Scan on t1
245    ->  Hash
246          ->  Seq Scan on t2
247 (5 rows)
248
249 /*+SeqScan(t1)IndexScan(t2)*/
250 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
251 LOG:  pg_hint_plan:
252 used hint:
253 SeqScan(t1)
254 IndexScan(t2)
255 not used hint:
256 duplication hint:
257 error hint:
258
259                  QUERY PLAN                 
260 --------------------------------------------
261  Hash Join
262    Hash Cond: (t1.id = t2.id)
263    ->  Seq Scan on t1
264    ->  Hash
265          ->  Index Scan using t2_pkey on t2
266 (5 rows)
267
268 /*+BitmapScan(t2)*/
269 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
270 LOG:  pg_hint_plan:
271 used hint:
272 BitmapScan(t2)
273 not used hint:
274 duplication hint:
275 error hint:
276
277               QUERY PLAN              
278 --------------------------------------
279  Nested Loop
280    ->  Seq Scan on t1
281    ->  Index Scan using t2_pkey on t2
282          Index Cond: (id = t1.id)
283 (4 rows)
284
285 /*+BitmapScan(t2)NoSeqScan(t1)*/
286 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
287 LOG:  pg_hint_plan:
288 used hint:
289 NoSeqScan(t1)
290 BitmapScan(t2)
291 not used hint:
292 duplication hint:
293 error hint:
294
295               QUERY PLAN              
296 --------------------------------------
297  Nested Loop
298    ->  Index Scan using t1_pkey on t1
299    ->  Index Scan using t2_pkey on t2
300          Index Cond: (id = t1.id)
301 (4 rows)
302
303 /*+NoIndexScan(t1)*/
304 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
305 LOG:  pg_hint_plan:
306 used hint:
307 NoIndexScan(t1)
308 not used hint:
309 duplication hint:
310 error hint:
311
312           QUERY PLAN          
313 ------------------------------
314  Hash Join
315    Hash Cond: (t1.id = t2.id)
316    ->  Seq Scan on t1
317    ->  Hash
318          ->  Seq Scan on t2
319 (5 rows)
320
321 /*+NoBitmapScan(t1)*/
322 EXPLAIN (COSTS false) SELECT * FROM t1, t4 WHERE t1.val < 10;
323 LOG:  pg_hint_plan:
324 used hint:
325 NoBitmapScan(t1)
326 not used hint:
327 duplication hint:
328 error hint:
329
330          QUERY PLAN         
331 ----------------------------
332  Nested Loop
333    ->  Seq Scan on t1
334          Filter: (val < 10)
335    ->  Materialize
336          ->  Seq Scan on t4
337 (5 rows)
338
339 /*+TidScan(t4)*/
340 EXPLAIN (COSTS false) SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
341 LOG:  pg_hint_plan:
342 used hint:
343 TidScan(t4)
344 not used hint:
345 duplication hint:
346 error hint:
347
348                   QUERY PLAN                   
349 -----------------------------------------------
350  Merge Join
351    Merge Cond: (t3.id = t4.id)
352    ->  Index Scan using t3_pkey on t3
353    ->  Sort
354          Sort Key: t4.id
355          ->  Tid Scan on t4
356                TID Cond: (ctid = '(1,1)'::tid)
357 (7 rows)
358
359 /*+NoTidScan(t1)*/
360 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
361 LOG:  pg_hint_plan:
362 used hint:
363 NoTidScan(t1)
364 not used hint:
365 duplication hint:
366 error hint:
367
368               QUERY PLAN               
369 ---------------------------------------
370  Nested Loop
371    ->  Seq Scan on t1
372          Filter: (ctid = '(1,1)'::tid)
373    ->  Index Scan using t2_pkey on t2
374          Index Cond: (id = t1.id)
375 (5 rows)
376
377 /*+HashJoin(t1 t2)*/
378 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
379 LOG:  pg_hint_plan:
380 used hint:
381 HashJoin(t1 t2)
382 not used hint:
383 duplication hint:
384 error hint:
385
386           QUERY PLAN          
387 ------------------------------
388  Hash Join
389    Hash Cond: (t1.id = t2.id)
390    ->  Seq Scan on t1
391    ->  Hash
392          ->  Seq Scan on t2
393 (5 rows)
394
395 /*+NestLoop(t1 t2)*/
396 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
397 LOG:  pg_hint_plan:
398 used hint:
399 NestLoop(t1 t2)
400 not used hint:
401 duplication hint:
402 error hint:
403
404               QUERY PLAN              
405 --------------------------------------
406  Nested Loop
407    ->  Seq Scan on t2
408    ->  Index Scan using t1_pkey on t1
409          Index Cond: (id = t2.id)
410 (4 rows)
411
412 /*+NoMergeJoin(t1 t2)*/
413 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
414 LOG:  pg_hint_plan:
415 used hint:
416 NoMergeJoin(t1 t2)
417 not used hint:
418 duplication hint:
419 error hint:
420
421           QUERY PLAN          
422 ------------------------------
423  Hash Join
424    Hash Cond: (t1.id = t2.id)
425    ->  Seq Scan on t1
426    ->  Hash
427          ->  Seq Scan on t2
428 (5 rows)
429
430 /*+MergeJoin(t1 t3)*/
431 EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
432 LOG:  pg_hint_plan:
433 used hint:
434 MergeJoin(t1 t3)
435 not used hint:
436 duplication hint:
437 error hint:
438
439              QUERY PLAN              
440 -------------------------------------
441  Merge Join
442    Merge Cond: (t1.val = t3.val)
443    ->  Index Scan using t1_val on t1
444    ->  Sort
445          Sort Key: t3.val
446          ->  Seq Scan on t3
447 (6 rows)
448
449 /*+NestLoop(t1 t3)*/
450 EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
451 LOG:  pg_hint_plan:
452 used hint:
453 NestLoop(t1 t3)
454 not used hint:
455 duplication hint:
456 error hint:
457
458              QUERY PLAN              
459 -------------------------------------
460  Nested Loop
461    ->  Seq Scan on t3
462    ->  Index Scan using t1_val on t1
463          Index Cond: (val = t3.val)
464 (4 rows)
465
466 /*+NoHashJoin(t1 t3)*/
467 EXPLAIN (COSTS false) SELECT * FROM t1, t3 WHERE t1.val = t3.val;
468 LOG:  pg_hint_plan:
469 used hint:
470 NoHashJoin(t1 t3)
471 not used hint:
472 duplication hint:
473 error hint:
474
475              QUERY PLAN              
476 -------------------------------------
477  Nested Loop
478    ->  Seq Scan on t3
479    ->  Index Scan using t1_val on t1
480          Index Cond: (val = t3.val)
481 (4 rows)
482
483 /*+MergeJoin(t4 t1 t2 t3)*/
484 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
485 LOG:  pg_hint_plan:
486 used hint:
487 MergeJoin(t1 t2 t3 t4)
488 not used hint:
489 duplication hint:
490 error hint:
491
492                     QUERY PLAN                    
493 --------------------------------------------------
494  Merge Join
495    Merge Cond: (t1.id = t4.id)
496    ->  Merge Join
497          Merge Cond: (t1.id = t3.id)
498          ->  Merge Join
499                Merge Cond: (t1.id = t2.id)
500                ->  Index Scan using t1_pkey on t1
501                ->  Index Scan using t2_pkey on t2
502          ->  Index Scan using t3_pkey on t3
503    ->  Sort
504          Sort Key: t4.id
505          ->  Seq Scan on t4
506 (12 rows)
507
508 /*+HashJoin(t3 t4 t1 t2)*/
509 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
510 LOG:  pg_hint_plan:
511 used hint:
512 HashJoin(t1 t2 t3 t4)
513 not used hint:
514 duplication hint:
515 error hint:
516
517                        QUERY PLAN                       
518 --------------------------------------------------------
519  Hash Join
520    Hash Cond: (t3.id = t1.id)
521    ->  Seq Scan on t3
522    ->  Hash
523          ->  Merge Join
524                Merge Cond: (t1.id = t4.id)
525                ->  Merge Join
526                      Merge Cond: (t1.id = t2.id)
527                      ->  Index Scan using t1_pkey on t1
528                      ->  Index Scan using t2_pkey on t2
529                ->  Sort
530                      Sort Key: t4.id
531                      ->  Seq Scan on t4
532 (13 rows)
533
534 /*+NestLoop(t2 t3 t4 t1) IndexScan(t3)*/
535 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
536 LOG:  pg_hint_plan:
537 used hint:
538 IndexScan(t3)
539 NestLoop(t1 t2 t3 t4)
540 not used hint:
541 duplication hint:
542 error hint:
543
544                     QUERY PLAN                    
545 --------------------------------------------------
546  Nested Loop
547    ->  Merge Join
548          Merge Cond: (t1.id = t4.id)
549          ->  Merge Join
550                Merge Cond: (t1.id = t2.id)
551                ->  Index Scan using t1_pkey on t1
552                ->  Index Scan using t2_pkey on t2
553          ->  Sort
554                Sort Key: t4.id
555                ->  Seq Scan on t4
556    ->  Index Scan using t3_pkey on t3
557          Index Cond: (id = t1.id)
558 (12 rows)
559
560 /*+NoNestLoop(t4 t1 t3 t2)*/
561 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
562 LOG:  pg_hint_plan:
563 used hint:
564 NoNestLoop(t1 t2 t3 t4)
565 not used hint:
566 duplication hint:
567 error hint:
568
569                     QUERY PLAN                    
570 --------------------------------------------------
571  Merge Join
572    Merge Cond: (t1.id = t4.id)
573    ->  Merge Join
574          Merge Cond: (t1.id = t3.id)
575          ->  Merge Join
576                Merge Cond: (t1.id = t2.id)
577                ->  Index Scan using t1_pkey on t1
578                ->  Index Scan using t2_pkey on t2
579          ->  Index Scan using t3_pkey on t3
580    ->  Sort
581          Sort Key: t4.id
582          ->  Seq Scan on t4
583 (12 rows)
584
585 /*+Leading(t3 t4)*/
586 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
587 LOG:  pg_hint_plan:
588 used hint:
589 Leading(t3 t4)
590 not used hint:
591 duplication hint:
592 error hint:
593
594                     QUERY PLAN                    
595 --------------------------------------------------
596  Nested Loop
597    ->  Nested Loop
598          ->  Merge Join
599                Merge Cond: (t3.id = t4.id)
600                ->  Index Scan using t3_pkey on t3
601                ->  Sort
602                      Sort Key: t4.id
603                      ->  Seq Scan on t4
604          ->  Index Scan using t2_pkey on t2
605                Index Cond: (id = t3.id)
606    ->  Index Scan using t1_pkey on t1
607          Index Cond: (id = t2.id)
608 (12 rows)
609
610 /*+Leading(t3 t4 t1)*/
611 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
612 LOG:  pg_hint_plan:
613 used hint:
614 Leading(t3 t4 t1)
615 not used hint:
616 duplication hint:
617 error hint:
618
619                     QUERY PLAN                    
620 --------------------------------------------------
621  Nested Loop
622    ->  Merge Join
623          Merge Cond: (t3.id = t1.id)
624          ->  Merge Join
625                Merge Cond: (t3.id = t4.id)
626                ->  Index Scan using t3_pkey on t3
627                ->  Sort
628                      Sort Key: t4.id
629                      ->  Seq Scan on t4
630          ->  Index Scan using t1_pkey on t1
631    ->  Index Scan using t2_pkey on t2
632          Index Cond: (id = t1.id)
633 (12 rows)
634
635 /*+Leading(t3 t4 t1 t2)*/
636 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
637 LOG:  pg_hint_plan:
638 used hint:
639 Leading(t3 t4 t1 t2)
640 not used hint:
641 duplication hint:
642 error hint:
643
644                     QUERY PLAN                    
645 --------------------------------------------------
646  Nested Loop
647    ->  Merge Join
648          Merge Cond: (t3.id = t1.id)
649          ->  Merge Join
650                Merge Cond: (t3.id = t4.id)
651                ->  Index Scan using t3_pkey on t3
652                ->  Sort
653                      Sort Key: t4.id
654                      ->  Seq Scan on t4
655          ->  Index Scan using t1_pkey on t1
656    ->  Index Scan using t2_pkey on t2
657          Index Cond: (id = t1.id)
658 (12 rows)
659
660 /*+Leading(t3 t4 t1 t2 t1)*/
661 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
662 INFO:  hint syntax error at or near "Leading(t3 t4 t1 t2 t1)"
663 DETAIL:  In Leading hint, specified relation name 4 or less.
664 LOG:  pg_hint_plan:
665 used hint:
666 not used hint:
667 duplication hint:
668 error hint:
669 Leading(t3 t4 t1 t2 t1)
670
671                     QUERY PLAN                    
672 --------------------------------------------------
673  Merge Join
674    Merge Cond: (t1.id = t4.id)
675    ->  Merge Join
676          Merge Cond: (t1.id = t3.id)
677          ->  Merge Join
678                Merge Cond: (t1.id = t2.id)
679                ->  Index Scan using t1_pkey on t1
680                ->  Index Scan using t2_pkey on t2
681          ->  Index Scan using t3_pkey on t3
682    ->  Sort
683          Sort Key: t4.id
684          ->  Seq Scan on t4
685 (12 rows)
686
687 /*+Leading(t3 t4 t4)*/
688 EXPLAIN (COSTS false) SELECT * FROM t1, t2, t3, t4 WHERE t1.id = t2.id AND t1.id = t3.id AND t1.id = t4.id;
689 LOG:  pg_hint_plan:
690 used hint:
691 Leading(t3 t4 t4)
692 not used hint:
693 duplication hint:
694 error hint:
695
696                     QUERY PLAN                    
697 --------------------------------------------------
698  Nested Loop
699    ->  Nested Loop
700          ->  Merge Join
701                Merge Cond: (t3.id = t4.id)
702                ->  Index Scan using t3_pkey on t3
703                ->  Sort
704                      Sort Key: t4.id
705                      ->  Seq Scan on t4
706          ->  Index Scan using t2_pkey on t2
707                Index Cond: (id = t3.id)
708    ->  Index Scan using t1_pkey on t1
709          Index Cond: (id = t2.id)
710 (12 rows)
711
712 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
713                   QUERY PLAN                   
714 -----------------------------------------------
715  Nested Loop
716    ->  Values Scan on "*VALUES*"
717    ->  Index Scan using t1_pkey on t1
718          Index Cond: (id = "*VALUES*".column1)
719 (4 rows)
720
721 /*+HashJoin(t1 t2)*/
722 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
723 INFO:  hint syntax error at or near "HashJoin(t1 t2)"
724 DETAIL:  Relation "t2" does not exist.
725 LOG:  pg_hint_plan:
726 used hint:
727 not used hint:
728 HashJoin(t1 t2)
729 duplication hint:
730 error hint:
731
732                   QUERY PLAN                   
733 -----------------------------------------------
734  Nested Loop
735    ->  Values Scan on "*VALUES*"
736    ->  Index Scan using t1_pkey on t1
737          Index Cond: (id = "*VALUES*".column1)
738 (4 rows)
739
740 /*+HashJoin(t1 *VALUES*)*/
741 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
742 LOG:  pg_hint_plan:
743 used hint:
744 HashJoin(*VALUES* t1)
745 not used hint:
746 duplication hint:
747 error hint:
748
749                 QUERY PLAN                 
750 -------------------------------------------
751  Hash Join
752    Hash Cond: (t1.id = "*VALUES*".column1)
753    ->  Seq Scan on t1
754    ->  Hash
755          ->  Values Scan on "*VALUES*"
756 (5 rows)
757
758 /*+HashJoin(t1 *VALUES*) IndexScan(t1) IndexScan(*VALUES*)*/
759 EXPLAIN (COSTS false) SELECT * FROM t1, (VALUES(1,1),(2,2),(3,3)) AS t2(id,val) WHERE t1.id = t2.id;
760 LOG:  pg_hint_plan:
761 used hint:
762 IndexScan(t1)
763 HashJoin(*VALUES* t1)
764 not used hint:
765 IndexScan(*VALUES*)
766 duplication hint:
767 error hint:
768
769                 QUERY PLAN                 
770 -------------------------------------------
771  Hash Join
772    Hash Cond: (t1.id = "*VALUES*".column1)
773    ->  Index Scan using t1_pkey on t1
774    ->  Hash
775          ->  Values Scan on "*VALUES*"
776 (5 rows)
777
778 EXPLAIN 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);
779                                              QUERY PLAN                                              
780 -----------------------------------------------------------------------------------------------------
781  Index Scan using t1_pkey on t1  (cost=1.89..10.16 rows=1 width=4)
782    Index Cond: (id = $3)
783    InitPlan 2 (returns $1)
784      ->  Result  (cost=0.94..0.95 rows=1 width=0)
785            InitPlan 1 (returns $0)
786              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
787                    ->  Index Scan Backward using t1_pkey on t1 v_1  (cost=0.00..8.43 rows=9 width=4)
788                          Index Cond: ((id IS NOT NULL) AND (id < 10))
789    InitPlan 4 (returns $3)
790      ->  Result  (cost=0.94..0.95 rows=1 width=0)
791            InitPlan 3 (returns $2)
792              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
793                    ->  Index Scan Backward using t1_pkey on t1 v_2  (cost=0.00..8.43 rows=9 width=4)
794                          Index Cond: ((id IS NOT NULL) AND (id < 10))
795 (14 rows)
796
797 /*+BitmapScan(v_1)*/
798 EXPLAIN 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);
799 LOG:  pg_hint_plan:
800 used hint:
801 BitmapScan(v_1)
802 not used hint:
803 duplication hint:
804 error hint:
805
806                                              QUERY PLAN                                              
807 -----------------------------------------------------------------------------------------------------
808  Index Scan using t1_pkey on t1  (cost=29.34..37.61 rows=1 width=4)
809    Index Cond: (id = $2)
810    InitPlan 1 (returns $0)
811      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
812            ->  Bitmap Heap Scan on t1 v_1  (cost=4.32..28.36 rows=9 width=4)
813                  Recheck Cond: (id < 10)
814                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
815                        Index Cond: (id < 10)
816    InitPlan 3 (returns $2)
817      ->  Result  (cost=0.94..0.95 rows=1 width=0)
818            InitPlan 2 (returns $1)
819              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
820                    ->  Index Scan Backward using t1_pkey on t1 v_2  (cost=0.00..8.43 rows=9 width=4)
821                          Index Cond: ((id IS NOT NULL) AND (id < 10))
822 (14 rows)
823
824 /*+BitmapScan(v_2)*/
825 EXPLAIN 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);
826 LOG:  pg_hint_plan:
827 used hint:
828 BitmapScan(v_2)
829 not used hint:
830 duplication hint:
831 error hint:
832
833                                              QUERY PLAN                                              
834 -----------------------------------------------------------------------------------------------------
835  Index Scan using t1_pkey on t1  (cost=29.34..37.61 rows=1 width=4)
836    Index Cond: (id = $2)
837    InitPlan 2 (returns $1)
838      ->  Result  (cost=0.94..0.95 rows=1 width=0)
839            InitPlan 1 (returns $0)
840              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
841                    ->  Index Scan Backward using t1_pkey on t1 v_1  (cost=0.00..8.43 rows=9 width=4)
842                          Index Cond: ((id IS NOT NULL) AND (id < 10))
843    InitPlan 3 (returns $2)
844      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
845            ->  Bitmap Heap Scan on t1 v_2  (cost=4.32..28.36 rows=9 width=4)
846                  Recheck Cond: (id < 10)
847                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
848                        Index Cond: (id < 10)
849 (14 rows)
850
851 /*+BitmapScan(t1)*/
852 EXPLAIN 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);
853 LOG:  pg_hint_plan:
854 used hint:
855 BitmapScan(t1)
856 not used hint:
857 duplication hint:
858 error hint:
859
860                                              QUERY PLAN                                              
861 -----------------------------------------------------------------------------------------------------
862  Bitmap Heap Scan on t1  (cost=6.15..10.17 rows=1 width=4)
863    Recheck Cond: (id = $3)
864    InitPlan 2 (returns $1)
865      ->  Result  (cost=0.94..0.95 rows=1 width=0)
866            InitPlan 1 (returns $0)
867              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
868                    ->  Index Scan Backward using t1_pkey on t1 v_1  (cost=0.00..8.43 rows=9 width=4)
869                          Index Cond: ((id IS NOT NULL) AND (id < 10))
870    InitPlan 4 (returns $3)
871      ->  Result  (cost=0.94..0.95 rows=1 width=0)
872            InitPlan 3 (returns $2)
873              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
874                    ->  Index Scan Backward using t1_pkey on t1 v_2  (cost=0.00..8.43 rows=9 width=4)
875                          Index Cond: ((id IS NOT NULL) AND (id < 10))
876    ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.26 rows=1 width=0)
877          Index Cond: (id = $3)
878 (16 rows)
879
880 /*+BitmapScan(v_1)BitmapScan(v_2)*/
881 EXPLAIN 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);
882 LOG:  pg_hint_plan:
883 used hint:
884 BitmapScan(v_1)
885 BitmapScan(v_2)
886 not used hint:
887 duplication hint:
888 error hint:
889
890                                      QUERY PLAN                                     
891 ------------------------------------------------------------------------------------
892  Index Scan using t1_pkey on t1  (cost=56.78..65.05 rows=1 width=4)
893    Index Cond: (id = $1)
894    InitPlan 1 (returns $0)
895      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
896            ->  Bitmap Heap Scan on t1 v_1  (cost=4.32..28.36 rows=9 width=4)
897                  Recheck Cond: (id < 10)
898                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
899                        Index Cond: (id < 10)
900    InitPlan 2 (returns $1)
901      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
902            ->  Bitmap Heap Scan on t1 v_2  (cost=4.32..28.36 rows=9 width=4)
903                  Recheck Cond: (id < 10)
904                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
905                        Index Cond: (id < 10)
906 (14 rows)
907
908 /*+BitmapScan(v_1)BitmapScan(t1)*/
909 EXPLAIN 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);
910 LOG:  pg_hint_plan:
911 used hint:
912 BitmapScan(t1)
913 BitmapScan(v_1)
914 not used hint:
915 duplication hint:
916 error hint:
917
918                                              QUERY PLAN                                              
919 -----------------------------------------------------------------------------------------------------
920  Bitmap Heap Scan on t1  (cost=33.60..37.61 rows=1 width=4)
921    Recheck Cond: (id = $2)
922    InitPlan 1 (returns $0)
923      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
924            ->  Bitmap Heap Scan on t1 v_1  (cost=4.32..28.36 rows=9 width=4)
925                  Recheck Cond: (id < 10)
926                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
927                        Index Cond: (id < 10)
928    InitPlan 3 (returns $2)
929      ->  Result  (cost=0.94..0.95 rows=1 width=0)
930            InitPlan 2 (returns $1)
931              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
932                    ->  Index Scan Backward using t1_pkey on t1 v_2  (cost=0.00..8.43 rows=9 width=4)
933                          Index Cond: ((id IS NOT NULL) AND (id < 10))
934    ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.26 rows=1 width=0)
935          Index Cond: (id = $2)
936 (16 rows)
937
938 /*+BitmapScan(v_2)BitmapScan(t1)*/
939 EXPLAIN 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);
940 LOG:  pg_hint_plan:
941 used hint:
942 BitmapScan(t1)
943 BitmapScan(v_2)
944 not used hint:
945 duplication hint:
946 error hint:
947
948                                              QUERY PLAN                                              
949 -----------------------------------------------------------------------------------------------------
950  Bitmap Heap Scan on t1  (cost=33.60..37.61 rows=1 width=4)
951    Recheck Cond: (id = $2)
952    InitPlan 2 (returns $1)
953      ->  Result  (cost=0.94..0.95 rows=1 width=0)
954            InitPlan 1 (returns $0)
955              ->  Limit  (cost=0.00..0.94 rows=1 width=4)
956                    ->  Index Scan Backward using t1_pkey on t1 v_1  (cost=0.00..8.43 rows=9 width=4)
957                          Index Cond: ((id IS NOT NULL) AND (id < 10))
958    InitPlan 3 (returns $2)
959      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
960            ->  Bitmap Heap Scan on t1 v_2  (cost=4.32..28.36 rows=9 width=4)
961                  Recheck Cond: (id < 10)
962                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
963                        Index Cond: (id < 10)
964    ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.26 rows=1 width=0)
965          Index Cond: (id = $2)
966 (16 rows)
967
968 /*+BitmapScan(v_1)BitmapScan(v_2)BitmapScan(t1)*/
969 EXPLAIN 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);
970 LOG:  pg_hint_plan:
971 used hint:
972 BitmapScan(t1)
973 BitmapScan(v_1)
974 BitmapScan(v_2)
975 not used hint:
976 duplication hint:
977 error hint:
978
979                                      QUERY PLAN                                     
980 ------------------------------------------------------------------------------------
981  Bitmap Heap Scan on t1  (cost=61.04..65.05 rows=1 width=4)
982    Recheck Cond: (id = $1)
983    InitPlan 1 (returns $0)
984      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
985            ->  Bitmap Heap Scan on t1 v_1  (cost=4.32..28.36 rows=9 width=4)
986                  Recheck Cond: (id < 10)
987                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
988                        Index Cond: (id < 10)
989    InitPlan 2 (returns $1)
990      ->  Aggregate  (cost=28.38..28.39 rows=1 width=4)
991            ->  Bitmap Heap Scan on t1 v_2  (cost=4.32..28.36 rows=9 width=4)
992                  Recheck Cond: (id < 10)
993                  ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.32 rows=9 width=0)
994                        Index Cond: (id < 10)
995    ->  Bitmap Index Scan on t1_pkey  (cost=0.00..4.26 rows=1 width=0)
996          Index Cond: (id = $1)
997 (16 rows)
998