OSDN Git Service

3082f6a6ae610429fa37940153dfffff9714d830
[pghintplan/pg_hint_plan.git] / expected / pg_hint_plan.out
1 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
2                                   QUERY PLAN                                  
3 ------------------------------------------------------------------------------
4  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
5    Merge Cond: (t1.id = t2.id)
6    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
7    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
8 (4 rows)
9
10 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val = t2.val;
11                                     QUERY PLAN                                     
12 -----------------------------------------------------------------------------------
13  Merge Join  (cost=0.00..1377.64 rows=100000 width=16)
14    Merge Cond: (t2.val = t1.val)
15    ->  Index Scan using t2_val on t2  (cost=0.00..55.12 rows=1000 width=8)
16    ->  Materialize  (cost=0.00..475.21 rows=10000 width=8)
17          ->  Index Scan using t1_val on t1  (cost=0.00..450.21 rows=10000 width=8)
18 (5 rows)
19
20 LOAD 'pg_hint_plan';
21 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
22                                   QUERY PLAN                                  
23 ------------------------------------------------------------------------------
24  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
25    Merge Cond: (t1.id = t2.id)
26    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
27    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
28 (4 rows)
29
30 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val = t2.val;
31                                     QUERY PLAN                                     
32 -----------------------------------------------------------------------------------
33  Merge Join  (cost=0.00..1377.64 rows=100000 width=16)
34    Merge Cond: (t2.val = t1.val)
35    ->  Index Scan using t2_val on t2  (cost=0.00..55.12 rows=1000 width=8)
36    ->  Materialize  (cost=0.00..475.21 rows=10000 width=8)
37          ->  Index Scan using t1_val on t1  (cost=0.00..450.21 rows=10000 width=8)
38 (5 rows)
39
40 /* Test (t1 t2) */
41 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
42 INFO:  hint syntax error at or near "Test (t1 t2) "
43 DETAIL:  Keyword "Test" does not exist.
44                                   QUERY PLAN                                  
45 ------------------------------------------------------------------------------
46  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
47    Merge Cond: (t1.id = t2.id)
48    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
49    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
50 (4 rows)
51
52 SET pg_hint_plan.enable TO off;
53 /* Test (t1 t2) */
54 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
55                                   QUERY PLAN                                  
56 ------------------------------------------------------------------------------
57  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
58    Merge Cond: (t1.id = t2.id)
59    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
60    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
61 (4 rows)
62
63 SET pg_hint_plan.enable TO on;
64 /*Set(enable_indexscan off)*/
65 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
66                             QUERY PLAN                            
67 ------------------------------------------------------------------
68  Hash Join  (cost=27.50..220.00 rows=1000 width=16)
69    Hash Cond: (t1.id = t2.id)
70    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
71    ->  Hash  (cost=15.00..15.00 rows=1000 width=8)
72          ->  Seq Scan on t2  (cost=0.00..15.00 rows=1000 width=8)
73 (5 rows)
74
75 /* Set(enable_indexscan off) Set(enable_hashjoin off) */
76 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
77                              QUERY PLAN                             
78 --------------------------------------------------------------------
79  Merge Join  (cost=874.21..894.21 rows=1000 width=16)
80    Merge Cond: (t1.id = t2.id)
81    ->  Sort  (cost=809.39..834.39 rows=10000 width=8)
82          Sort Key: t1.id
83          ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
84    ->  Sort  (cost=64.83..67.33 rows=1000 width=8)
85          Sort Key: t2.id
86          ->  Seq Scan on t2  (cost=0.00..15.00 rows=1000 width=8)
87 (8 rows)
88
89 /*       Set     (       enable_indexscan        off     )       */
90 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
91                             QUERY PLAN                            
92 ------------------------------------------------------------------
93  Hash Join  (cost=27.50..220.00 rows=1000 width=16)
94    Hash Cond: (t1.id = t2.id)
95    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
96    ->  Hash  (cost=15.00..15.00 rows=1000 width=8)
97          ->  Seq Scan on t2  (cost=0.00..15.00 rows=1000 width=8)
98 (5 rows)
99
100 /*       
101                 Set      
102                 (        
103                 enable_indexscan         
104                 off      
105                 )        
106                 */              
107 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
108                             QUERY PLAN                            
109 ------------------------------------------------------------------
110  Hash Join  (cost=27.50..220.00 rows=1000 width=16)
111    Hash Cond: (t1.id = t2.id)
112    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
113    ->  Hash  (cost=15.00..15.00 rows=1000 width=8)
114          ->  Seq Scan on t2  (cost=0.00..15.00 rows=1000 width=8)
115 (5 rows)
116
117 /* Set(enable_indexscan off)Set(enable_nestloop off)Set(enable_mergejoin off)           
118                 Set(enable_seqscan off)
119                 */
120 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
121                                              QUERY PLAN                                              
122 -----------------------------------------------------------------------------------------------------
123  Hash Join  (cost=20000000055.75..20000000421.51 rows=1000 width=16)
124    Hash Cond: (t1.id = t2.id)
125    ->  Index Scan using t1_pkey on t1  (cost=10000000000.00..10000000318.26 rows=10000 width=8)
126    ->  Hash  (cost=10000000043.25..10000000043.25 rows=1000 width=8)
127          ->  Index Scan using t2_pkey on t2  (cost=10000000000.00..10000000043.25 rows=1000 width=8)
128 (5 rows)
129
130 /*Set(work_mem "1M")*/
131 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
132 INFO:  invalid value for parameter "work_mem": "1M"
133 HINT:  Valid units for this parameter are "kB", "MB", and "GB".
134                                   QUERY PLAN                                  
135 ------------------------------------------------------------------------------
136  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
137    Merge Cond: (t1.id = t2.id)
138    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
139    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
140 (4 rows)
141
142 /*Set(work_mem "1MB")*/
143 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
144                                   QUERY PLAN                                  
145 ------------------------------------------------------------------------------
146  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
147    Merge Cond: (t1.id = t2.id)
148    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
149    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
150 (4 rows)
151
152 /*Set(work_mem TO "1MB")*/
153 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
154 INFO:  hint syntax error at or near ""1MB")"
155 DETAIL:  Closed parenthesis is necessary.
156                                   QUERY PLAN                                  
157 ------------------------------------------------------------------------------
158  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
159    Merge Cond: (t1.id = t2.id)
160    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
161    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
162 (4 rows)
163
164 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
165                                   QUERY PLAN                                  
166 ------------------------------------------------------------------------------
167  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
168    Merge Cond: (t1.id = t2.id)
169    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
170    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
171 (4 rows)
172
173 /*SeqScan(t1 t2)*/
174 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
175 INFO:  hint syntax error at or near "t2)"
176 DETAIL:  Closed parenthesis is necessary.
177                                   QUERY PLAN                                  
178 ------------------------------------------------------------------------------
179  Merge Join  (cost=0.00..90.08 rows=1000 width=16)
180    Merge Cond: (t1.id = t2.id)
181    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
182    ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
183 (4 rows)
184
185 /*SeqScan(t1)*/
186 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
187                             QUERY PLAN                            
188 ------------------------------------------------------------------
189  Hash Join  (cost=27.50..220.00 rows=1000 width=16)
190    Hash Cond: (t1.id = t2.id)
191    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
192    ->  Hash  (cost=15.00..15.00 rows=1000 width=8)
193          ->  Seq Scan on t2  (cost=0.00..15.00 rows=1000 width=8)
194 (5 rows)
195
196 /*SeqScan(t1)IndexScan(t2)*/
197 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
198                                     QUERY PLAN                                    
199 ----------------------------------------------------------------------------------
200  Hash Join  (cost=55.75..248.25 rows=1000 width=16)
201    Hash Cond: (t1.id = t2.id)
202    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
203    ->  Hash  (cost=43.25..43.25 rows=1000 width=8)
204          ->  Index Scan using t2_pkey on t2  (cost=0.00..43.25 rows=1000 width=8)
205 (5 rows)
206
207 /*BitmapScan(t2)*/
208 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
209                                  QUERY PLAN                                 
210 ----------------------------------------------------------------------------
211  Nested Loop  (cost=0.26..42987.50 rows=1000 width=16)
212    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
213    ->  Bitmap Heap Scan on t2  (cost=0.26..4.27 rows=1 width=8)
214          Recheck Cond: (id = t1.id)
215          ->  Bitmap Index Scan on t2_pkey  (cost=0.00..0.26 rows=1 width=0)
216                Index Cond: (id = t1.id)
217 (6 rows)
218
219 /*BitmapScan(t2)NoSeqScan(t1)*/
220 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
221                                   QUERY PLAN                                  
222 ------------------------------------------------------------------------------
223  Nested Loop  (cost=0.26..43160.76 rows=1000 width=16)
224    ->  Index Scan using t1_pkey on t1  (cost=0.00..318.26 rows=10000 width=8)
225    ->  Bitmap Heap Scan on t2  (cost=0.26..4.27 rows=1 width=8)
226          Recheck Cond: (id = t1.id)
227          ->  Bitmap Index Scan on t2_pkey  (cost=0.00..0.26 rows=1 width=0)
228                Index Cond: (id = t1.id)
229 (6 rows)
230
231 /*NoIndexScan(t1)*/
232 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id;
233                             QUERY PLAN                            
234 ------------------------------------------------------------------
235  Hash Join  (cost=27.50..220.00 rows=1000 width=16)
236    Hash Cond: (t1.id = t2.id)
237    ->  Seq Scan on t1  (cost=0.00..145.00 rows=10000 width=8)
238    ->  Hash  (cost=15.00..15.00 rows=1000 width=8)
239          ->  Seq Scan on t2  (cost=0.00..15.00 rows=1000 width=8)
240 (5 rows)
241
242 EXPLAIN SELECT * FROM t1, t4 WHERE t1.val < 10;
243                                   QUERY PLAN                                   
244 -------------------------------------------------------------------------------
245  Nested Loop  (cost=20.01..203.64 rows=10000 width=16)
246    ->  Bitmap Heap Scan on t1  (cost=20.01..77.51 rows=1000 width=8)
247          Recheck Cond: (val < 10)
248          ->  Bitmap Index Scan on t1_val  (cost=0.00..19.76 rows=1000 width=0)
249                Index Cond: (val < 10)
250    ->  Materialize  (cost=0.00..1.15 rows=10 width=8)
251          ->  Seq Scan on t4  (cost=0.00..1.10 rows=10 width=8)
252 (7 rows)
253
254 /*NoBitmapScan(t1)*/
255 EXPLAIN SELECT * FROM t1, t4 WHERE t1.val < 10;
256                           QUERY PLAN                           
257 ---------------------------------------------------------------
258  Nested Loop  (cost=0.00..296.12 rows=10000 width=16)
259    ->  Seq Scan on t1  (cost=0.00..170.00 rows=1000 width=8)
260          Filter: (val < 10)
261    ->  Materialize  (cost=0.00..1.15 rows=10 width=8)
262          ->  Seq Scan on t4  (cost=0.00..1.10 rows=10 width=8)
263 (5 rows)
264
265 EXPLAIN SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
266                                 QUERY PLAN                                 
267 ---------------------------------------------------------------------------
268  Merge Join  (cost=1.14..2.41 rows=1 width=16)
269    Merge Cond: (t3.id = t4.id)
270    ->  Index Scan using t3_pkey on t3  (cost=0.00..13.75 rows=100 width=8)
271    ->  Sort  (cost=1.14..1.14 rows=1 width=8)
272          Sort Key: t4.id
273          ->  Seq Scan on t4  (cost=0.00..1.12 rows=1 width=8)
274                Filter: (ctid = '(1,1)'::tid)
275 (7 rows)
276
277 /*TidScan(t4)*/
278 EXPLAIN SELECT * FROM t3, t4 WHERE t3.id = t4.id AND t4.ctid = '(1,1)';
279                                 QUERY PLAN                                 
280 ---------------------------------------------------------------------------
281  Merge Join  (cost=4.02..5.30 rows=1 width=16)
282    Merge Cond: (t3.id = t4.id)
283    ->  Index Scan using t3_pkey on t3  (cost=0.00..13.75 rows=100 width=8)
284    ->  Sort  (cost=4.02..4.03 rows=1 width=8)
285          Sort Key: t4.id
286          ->  Tid Scan on t4  (cost=0.00..4.01 rows=1 width=8)
287                TID Cond: (ctid = '(1,1)'::tid)
288 (7 rows)
289
290 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
291                                QUERY PLAN                               
292 ------------------------------------------------------------------------
293  Nested Loop  (cost=0.00..12.29 rows=1 width=16)
294    ->  Tid Scan on t1  (cost=0.00..4.01 rows=1 width=8)
295          TID Cond: (ctid = '(1,1)'::tid)
296    ->  Index Scan using t2_pkey on t2  (cost=0.00..8.27 rows=1 width=8)
297          Index Cond: (id = t1.id)
298 (5 rows)
299
300 /*NoTidScan(t1)*/
301 EXPLAIN SELECT * FROM t1, t2 WHERE t1.id = t2.id AND t1.ctid = '(1,1)';
302                                QUERY PLAN                               
303 ------------------------------------------------------------------------
304  Nested Loop  (cost=0.00..178.28 rows=1 width=16)
305    ->  Seq Scan on t1  (cost=0.00..170.00 rows=1 width=8)
306          Filter: (ctid = '(1,1)'::tid)
307    ->  Index Scan using t2_pkey on t2  (cost=0.00..8.27 rows=1 width=8)
308          Index Cond: (id = t1.id)
309 (5 rows)
310
311 \q