1 CREATE TABLE t1 (val1 int, val2 int);
2 CREATE TABLE t2 (val1 int, val2 int);
3 CREATE TABLE t3 (val1 int, val2 int);
4 CREATE TABLE t4 (val1 int, val2 int);
5 CREATE VIEW v1 AS SELECT val1, val2 FROM t1;
6 CREATE VIEW v2 AS SELECT t1.val1 t1_val1, t1.val2 t1_val2, t2.val1 t2_val1, t2.val2 t2_val2 FROM t1, t2 WHERE t1.val1 = t2.val1;
7 CREATE VIEW v3 AS SELECT t_1.val1 t1_val1, t_1.val2 t1_val2, t_2.val1 t2_val1, t_2.val2 t2_val2 FROM t1 t_1, t2 t_2 WHERE t_1.val1 = t_2.val1;
8 CREATE VIEW v4 AS SELECT v_2.t1_val1, t_3.val1 FROM v2 v_2, t3 t_3 WHERE v_2.t1_val1 = t_3.val1;
9 INSERT INTO t1 SELECT i, i FROM (SELECT generate_series(1, 10000) i) t;
10 INSERT INTO t2 SELECT i, i FROM (SELECT generate_series(1, 1000) i) t;
11 INSERT INTO t3 SELECT i, i FROM (SELECT generate_series(1, 100) i) t;
12 INSERT INTO t4 SELECT i, i FROM (SELECT generate_series(1, 10) i) t;
13 CREATE INDEX t1_val1 ON t1 (val1);
14 CREATE INDEX t2_val1 ON t2 (val1);
15 CREATE INDEX t3_val1 ON t3 (val1);
16 CREATE INDEX t4_val1 ON t4 (val1);
21 \set t1_oid `psql contrib_regression -tA -c "SELECT oid FROM pg_class WHERE relname = 't1'"`
22 \set t2_oid `psql contrib_regression -tA -c "SELECT oid FROM pg_class WHERE relname = 't2'"`
23 \set t3_oid `psql contrib_regression -tA -c "SELECT oid FROM pg_class WHERE relname = 't3'"`
24 \set t4_oid `psql contrib_regression -tA -c "SELECT oid FROM pg_class WHERE relname = 't4'"`
25 --SET enable_bitmapscan TO off;
26 --SET enable_hashagg TO off;
27 --SET enable_tidscan TO off;
28 --SET enable_sort TO off;
29 --SET enable_indexscan TO off;
30 --SET enable_seqscan TO off;
31 --SET enable_material TO off;
32 --SET enable_hashjoin TO off;
33 --SET enable_mergejoin TO off;
34 --SET enable_nestloop TO off;
35 SET join_collapse_limit TO 1;
36 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val1 = t2.val1;
38 ------------------------------------------------------------------------------
39 Merge Join (cost=0.00..90.08 rows=1000 width=16)
40 Merge Cond: (t1.val1 = t2.val1)
41 -> Index Scan using t1_val1 on t1 (cost=0.00..318.26 rows=10000 width=8)
42 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
45 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val2 = t2.val2;
47 ------------------------------------------------------------------
48 Hash Join (cost=27.50..220.00 rows=1000 width=16)
49 Hash Cond: (t1.val2 = t2.val2)
50 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
51 -> Hash (cost=15.00..15.00 rows=1000 width=8)
52 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
55 EXPLAIN SELECT * FROM t1 CROSS JOIN t2 CROSS JOIN t3 CROSS JOIN t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
57 ------------------------------------------------------------------------------------------
58 Merge Join (cost=1.27..2.83 rows=1 width=32)
59 Merge Cond: (t1.val1 = t4.val1)
60 -> Merge Join (cost=0.00..15.03 rows=10 width=24)
61 Merge Cond: (t1.val1 = t3.val1)
62 -> Merge Join (cost=0.00..90.08 rows=1000 width=16)
63 Merge Cond: (t1.val1 = t2.val1)
64 -> Index Scan using t1_val1 on t1 (cost=0.00..318.26 rows=10000 width=8)
65 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
66 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
67 -> Sort (cost=1.27..1.29 rows=10 width=8)
69 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
72 EXPLAIN SELECT * FROM t4 CROSS JOIN t3 CROSS JOIN t2 CROSS JOIN t1 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
74 ---------------------------------------------------------------------------------------
75 Nested Loop (cost=1.27..13.30 rows=10 width=32)
76 -> Merge Join (cost=1.27..7.38 rows=10 width=24)
77 Merge Cond: (t3.val1 = t2.val1)
78 -> Merge Join (cost=1.27..2.68 rows=10 width=16)
79 Merge Cond: (t3.val1 = t4.val1)
80 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
81 -> Sort (cost=1.27..1.29 rows=10 width=8)
83 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
84 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
85 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
86 Index Cond: (val1 = t2.val1)
89 EXPLAIN SELECT * FROM t2 CROSS JOIN t3 CROSS JOIN t4 CROSS JOIN t1 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
91 ----------------------------------------------------------------------------------------
92 Nested Loop (cost=1.27..2.12 rows=1 width=32)
93 -> Merge Join (cost=1.27..1.52 rows=1 width=24)
94 Merge Cond: (t2.val1 = t4.val1)
95 -> Merge Join (cost=0.00..19.58 rows=100 width=16)
96 Merge Cond: (t2.val1 = t3.val1)
97 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
98 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
99 -> Sort (cost=1.27..1.29 rows=10 width=8)
101 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
102 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
103 Index Cond: (val1 = t2.val1)
106 CREATE EXTENSION pg_hint_plan;
107 SELECT pg_add_hint('nest(' || :t1_oid || ',' || :t2_oid || ')');
113 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val1 = t2.val1;
115 ------------------------------------------------------------------------
116 Nested Loop (cost=0.00..607.00 rows=1000 width=16)
117 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
118 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
119 Index Cond: (val1 = t2.val1)
122 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val2 = t2.val2;
124 ------------------------------------------------------------------
125 Nested Loop (cost=0.00..150162.50 rows=1000 width=16)
126 Join Filter: (t1.val2 = t2.val2)
127 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
128 -> Materialize (cost=0.00..20.00 rows=1000 width=8)
129 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
132 SELECT pg_add_hint('hash(' || :t1_oid || ',' || :t2_oid || ')');
138 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val1 = t2.val1;
140 ------------------------------------------------------------------
141 Hash Join (cost=27.50..220.00 rows=1000 width=16)
142 Hash Cond: (t1.val1 = t2.val1)
143 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
144 -> Hash (cost=15.00..15.00 rows=1000 width=8)
145 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
148 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val2 = t2.val2;
150 ------------------------------------------------------------------
151 Hash Join (cost=27.50..220.00 rows=1000 width=16)
152 Hash Cond: (t1.val2 = t2.val2)
153 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
154 -> Hash (cost=15.00..15.00 rows=1000 width=8)
155 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
158 SELECT pg_add_hint('merge(' || :t1_oid || ',' || :t2_oid || ')');
164 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val1 = t2.val1;
166 ------------------------------------------------------------------------------
167 Merge Join (cost=0.00..90.08 rows=1000 width=16)
168 Merge Cond: (t1.val1 = t2.val1)
169 -> Index Scan using t1_val1 on t1 (cost=0.00..318.26 rows=10000 width=8)
170 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
173 EXPLAIN SELECT * FROM t1, t2 WHERE t1.val2 = t2.val2;
175 --------------------------------------------------------------------
176 Merge Join (cost=874.21..894.21 rows=1000 width=16)
177 Merge Cond: (t1.val2 = t2.val2)
178 -> Sort (cost=809.39..834.39 rows=10000 width=8)
180 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
181 -> Sort (cost=64.83..67.33 rows=1000 width=8)
183 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
186 SELECT pg_clear_hint();
192 EXPLAIN SELECT * FROM t1, t2, t3 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1;
194 ------------------------------------------------------------------------------------
195 Merge Join (cost=5.32..6.85 rows=10 width=24)
196 Merge Cond: (t1.val1 = t3.val1)
197 -> Merge Join (cost=0.00..90.08 rows=1000 width=16)
198 Merge Cond: (t1.val1 = t2.val1)
199 -> Index Scan using t1_val1 on t1 (cost=0.00..318.26 rows=10000 width=8)
200 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
201 -> Sort (cost=5.32..5.57 rows=100 width=8)
203 -> Seq Scan on t3 (cost=0.00..2.00 rows=100 width=8)
206 EXPLAIN SELECT * FROM t1, t2, t3 WHERE t1.val2 = t2.val2 AND t2.val2 = t3.val2;
208 ----------------------------------------------------------------------------
209 Hash Join (cost=24.25..207.75 rows=10 width=24)
210 Hash Cond: (t1.val2 = t2.val2)
211 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
212 -> Hash (cost=23.00..23.00 rows=100 width=16)
213 -> Hash Join (cost=3.25..23.00 rows=100 width=16)
214 Hash Cond: (t2.val2 = t3.val2)
215 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
216 -> Hash (cost=2.00..2.00 rows=100 width=8)
217 -> Seq Scan on t3 (cost=0.00..2.00 rows=100 width=8)
220 SELECT pg_add_hint('nest(' || :t1_oid || ',' || :t2_oid || ',' || :t3_oid || ')');
226 SELECT pg_add_hint('nest(' || :t1_oid || ',' || :t3_oid || ')');
232 --SELECT pg_add_hint('no_merge(' || :t1_oid || ',' || :t3_oid || ')');
233 EXPLAIN SELECT * FROM t1, t2, t3 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1;
235 ----------------------------------------------------------------------------------
236 Nested Loop (cost=5.32..70.60 rows=10 width=24)
237 -> Merge Join (cost=5.32..11.40 rows=100 width=16)
238 Merge Cond: (t2.val1 = t3.val1)
239 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
240 -> Sort (cost=5.32..5.57 rows=100 width=8)
242 -> Seq Scan on t3 (cost=0.00..2.00 rows=100 width=8)
243 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
244 Index Cond: (val1 = t2.val1)
247 EXPLAIN SELECT * FROM t1, t2, t3 WHERE t1.val2 = t2.val2 AND t2.val2 = t3.val2;
249 ------------------------------------------------------------------------
250 Nested Loop (cost=27.50..1722.25 rows=10 width=24)
251 Join Filter: (t1.val2 = t3.val2)
252 -> Hash Join (cost=27.50..220.00 rows=1000 width=16)
253 Hash Cond: (t1.val2 = t2.val2)
254 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
255 -> Hash (cost=15.00..15.00 rows=1000 width=8)
256 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
257 -> Materialize (cost=0.00..2.50 rows=100 width=8)
258 -> Seq Scan on t3 (cost=0.00..2.00 rows=100 width=8)
261 SELECT pg_clear_hint();
267 EXPLAIN SELECT * FROM t1, t2, t3, t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
269 ------------------------------------------------------------------------------------------
270 Nested Loop (cost=1.27..1.70 rows=1 width=32)
271 -> Merge Join (cost=1.27..1.42 rows=1 width=24)
272 Merge Cond: (t1.val1 = t4.val1)
273 -> Merge Join (cost=0.00..90.08 rows=1000 width=16)
274 Merge Cond: (t1.val1 = t2.val1)
275 -> Index Scan using t1_val1 on t1 (cost=0.00..318.26 rows=10000 width=8)
276 -> Index Scan using t2_val1 on t2 (cost=0.00..43.25 rows=1000 width=8)
277 -> Sort (cost=1.27..1.29 rows=10 width=8)
279 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
280 -> Index Scan using t3_val1 on t3 (cost=0.00..0.27 rows=1 width=8)
281 Index Cond: (val1 = t1.val1)
284 SELECT pg_add_hint('no_merge(' || :t1_oid || ',' || :t2_oid || ')');
290 EXPLAIN SELECT * FROM t1, t2, t3, t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
292 ------------------------------------------------------------------------------------------
293 Nested Loop (cost=1.27..1.80 rows=1 width=32)
294 -> Merge Join (cost=1.27..1.51 rows=1 width=24)
295 Merge Cond: (t1.val1 = t4.val1)
296 -> Merge Join (cost=0.00..18.43 rows=100 width=16)
297 Merge Cond: (t1.val1 = t3.val1)
298 -> Index Scan using t1_val1 on t1 (cost=0.00..318.26 rows=10000 width=8)
299 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
300 -> Sort (cost=1.27..1.29 rows=10 width=8)
302 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
303 -> Index Scan using t2_val1 on t2 (cost=0.00..0.27 rows=1 width=8)
304 Index Cond: (val1 = t1.val1)
307 SET enable_mergejoin TO off;
308 EXPLAIN SELECT * FROM t1, t2, t3, t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
310 ------------------------------------------------------------------------------
311 Nested Loop (cost=1.23..11.11 rows=1 width=32)
312 -> Nested Loop (cost=1.23..10.52 rows=1 width=24)
313 -> Hash Join (cost=1.23..3.70 rows=10 width=16)
314 Hash Cond: (t3.val1 = t4.val1)
315 -> Seq Scan on t3 (cost=0.00..2.00 rows=100 width=8)
316 -> Hash (cost=1.10..1.10 rows=10 width=8)
317 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
318 -> Index Scan using t2_val1 on t2 (cost=0.00..0.67 rows=1 width=8)
319 Index Cond: (val1 = t3.val1)
320 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
321 Index Cond: (val1 = t2.val1)
324 SELECT pg_add_hint('no_hash(' || :t3_oid || ',' || :t4_oid || ')');
330 EXPLAIN SELECT * FROM t1, t2, t3, t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
332 ---------------------------------------------------------------------------------------
333 Nested Loop (cost=1.27..10.09 rows=1 width=32)
334 -> Nested Loop (cost=1.27..9.50 rows=1 width=24)
335 -> Merge Join (cost=1.27..2.68 rows=10 width=16)
336 Merge Cond: (t3.val1 = t4.val1)
337 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
338 -> Sort (cost=1.27..1.29 rows=10 width=8)
340 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
341 -> Index Scan using t2_val1 on t2 (cost=0.00..0.67 rows=1 width=8)
342 Index Cond: (val1 = t3.val1)
343 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
344 Index Cond: (val1 = t2.val1)
347 SELECT pg_add_hint('no_nest(' || :t2_oid || ',' || :t3_oid || ',' || :t4_oid || ')');
353 EXPLAIN SELECT * FROM t1, t2, t3, t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
355 ---------------------------------------------------------------------------------------
356 Nested Loop (cost=1.27..2.74 rows=1 width=32)
357 -> Merge Join (cost=1.27..2.15 rows=1 width=24)
358 Merge Cond: (t2.val1 = t4.val1)
359 -> Nested Loop (cost=0.00..81.95 rows=100 width=16)
360 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
361 -> Index Scan using t2_val1 on t2 (cost=0.00..0.67 rows=1 width=8)
362 Index Cond: (val1 = t3.val1)
363 -> Sort (cost=1.27..1.29 rows=10 width=8)
365 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
366 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
367 Index Cond: (val1 = t2.val1)
370 SET join_collapse_limit TO 10;
371 EXPLAIN SELECT * FROM t1 CROSS JOIN t2 CROSS JOIN t3 CROSS JOIN t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
373 ---------------------------------------------------------------------------------------
374 Nested Loop (cost=1.27..2.74 rows=1 width=32)
375 -> Merge Join (cost=1.27..2.15 rows=1 width=24)
376 Merge Cond: (t2.val1 = t4.val1)
377 -> Nested Loop (cost=0.00..81.95 rows=100 width=16)
378 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
379 -> Index Scan using t2_val1 on t2 (cost=0.00..0.67 rows=1 width=8)
380 Index Cond: (val1 = t3.val1)
381 -> Sort (cost=1.27..1.29 rows=10 width=8)
383 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
384 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
385 Index Cond: (val1 = t2.val1)
388 SET join_collapse_limit TO 1;
389 EXPLAIN SELECT * FROM t1 CROSS JOIN t2 CROSS JOIN t3 CROSS JOIN t4 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
391 ------------------------------------------------------------------------------
392 Nested Loop (cost=30.75..229.72 rows=1 width=32)
393 Join Filter: (t1.val1 = t4.val1)
394 -> Hash Join (cost=30.75..227.10 rows=10 width=24)
395 Hash Cond: (t1.val1 = t3.val1)
396 -> Hash Join (cost=27.50..220.00 rows=1000 width=16)
397 Hash Cond: (t1.val1 = t2.val1)
398 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
399 -> Hash (cost=15.00..15.00 rows=1000 width=8)
400 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
401 -> Hash (cost=2.00..2.00 rows=100 width=8)
402 -> Seq Scan on t3 (cost=0.00..2.00 rows=100 width=8)
403 -> Materialize (cost=0.00..1.15 rows=10 width=8)
404 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
407 EXPLAIN SELECT * FROM t2 CROSS JOIN t3 CROSS JOIN t4 CROSS JOIN t1 WHERE t1.val1 = t2.val1 AND t2.val1 = t3.val1 AND t3.val1 = t4.val1;
409 ---------------------------------------------------------------------------------------
410 Nested Loop (cost=1.27..2.74 rows=1 width=32)
411 -> Merge Join (cost=1.27..2.15 rows=1 width=24)
412 Merge Cond: (t2.val1 = t4.val1)
413 -> Nested Loop (cost=0.00..81.95 rows=100 width=16)
414 -> Index Scan using t3_val1 on t3 (cost=0.00..13.75 rows=100 width=8)
415 -> Index Scan using t2_val1 on t2 (cost=0.00..0.67 rows=1 width=8)
416 Index Cond: (val1 = t3.val1)
417 -> Sort (cost=1.27..1.29 rows=10 width=8)
419 -> Seq Scan on t4 (cost=0.00..1.10 rows=10 width=8)
420 -> Index Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=8)
421 Index Cond: (val1 = t2.val1)
424 EXPLAIN SELECT * FROM v2;
426 ------------------------------------------------------------------
427 Hash Join (cost=27.50..220.00 rows=1000 width=16)
428 Hash Cond: (t1.val1 = t2.val1)
429 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
430 -> Hash (cost=15.00..15.00 rows=1000 width=8)
431 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
434 EXPLAIN SELECT * FROM v3 v_3;
436 ----------------------------------------------------------------------
437 Hash Join (cost=27.50..220.00 rows=1000 width=16)
438 Hash Cond: (t_1.val1 = t_2.val1)
439 -> Seq Scan on t1 t_1 (cost=0.00..145.00 rows=10000 width=8)
440 -> Hash (cost=15.00..15.00 rows=1000 width=8)
441 -> Seq Scan on t2 t_2 (cost=0.00..15.00 rows=1000 width=8)
444 EXPLAIN SELECT * FROM v2 v_2, v3 v_3 WHERE v_2.t1_val1 = v_3.t1_val1;
446 ------------------------------------------------------------------------------
447 Nested Loop (cost=55.00..284.45 rows=100 width=32)
448 -> Hash Join (cost=55.00..252.25 rows=100 width=24)
449 Hash Cond: (t1.val1 = t_2.val1)
450 -> Hash Join (cost=27.50..220.00 rows=1000 width=16)
451 Hash Cond: (t1.val1 = t2.val1)
452 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=8)
453 -> Hash (cost=15.00..15.00 rows=1000 width=8)
454 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=8)
455 -> Hash (cost=15.00..15.00 rows=1000 width=8)
456 -> Seq Scan on t2 t_2 (cost=0.00..15.00 rows=1000 width=8)
457 -> Index Scan using t1_val1 on t1 t_1 (cost=0.00..0.31 rows=1 width=8)
458 Index Cond: (val1 = t1.val1)
461 EXPLAIN SELECT * FROM v4 v_4;
463 -----------------------------------------------------------------------------
464 Nested Loop (cost=3.25..82.20 rows=10 width=8)
465 -> Hash Join (cost=3.25..23.00 rows=100 width=8)
466 Hash Cond: (t2.val1 = t_3.val1)
467 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=4)
468 -> Hash (cost=2.00..2.00 rows=100 width=4)
469 -> Seq Scan on t3 t_3 (cost=0.00..2.00 rows=100 width=4)
470 -> Index Only Scan using t1_val1 on t1 (cost=0.00..0.58 rows=1 width=4)
471 Index Cond: (val1 = t2.val1)
474 SET from_collapse_limit TO 1;
475 EXPLAIN SELECT * FROM v4 v_4;
477 ------------------------------------------------------------------------
478 Hash Join (cost=30.75..227.10 rows=10 width=8)
479 Hash Cond: (t1.val1 = t_3.val1)
480 -> Hash Join (cost=27.50..220.00 rows=1000 width=8)
481 Hash Cond: (t1.val1 = t2.val1)
482 -> Seq Scan on t1 (cost=0.00..145.00 rows=10000 width=4)
483 -> Hash (cost=15.00..15.00 rows=1000 width=4)
484 -> Seq Scan on t2 (cost=0.00..15.00 rows=1000 width=4)
485 -> Hash (cost=2.00..2.00 rows=100 width=4)
486 -> Seq Scan on t3 t_3 (cost=0.00..2.00 rows=100 width=4)
489 SELECT pg_enable_log(true);
495 SELECT pg_enable_log(false);