OSDN Git Service

4804e5f7a0cb6bff958628b6f6356030c793c8b0
[pghintplan/pg_hint_plan.git] / output / ut-fdw.source
1 LOAD 'pg_hint_plan';
2 SET search_path TO public;
3 SET pg_hint_plan.debug_print TO on;
4 SET client_min_messages TO LOG;
5 SET pg_hint_plan.enable_hint TO on;
6 CREATE EXTENSION file_fdw;
7 CREATE SERVER file_server FOREIGN DATA WRAPPER file_fdw;
8 CREATE USER MAPPING FOR PUBLIC SERVER file_server;
9 CREATE FOREIGN TABLE ft1 (id int, val int) SERVER file_server OPTIONS (format 'csv', filename '@abs_srcdir@/data/data.csv');
10 -- foreign table test
11 SELECT * FROM ft1;
12  id | val 
13 ----+-----
14   1 |   1
15   2 |   2
16   3 |   3
17   4 |   4
18   5 |   5
19   6 |   6
20   7 |   7
21   8 |   8
22   9 |   9
23  10 |  10
24 (10 rows)
25
26 \t
27 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
28  Nested Loop
29    Join Filter: (ft_1.id = t1.c1)
30    ->  Nested Loop
31          Join Filter: (ft_1.id = ft_2.id)
32          ->  Foreign Scan on ft1 ft_1
33                Foreign File: @abs_srcdir@/data/data.csv
34          ->  Foreign Scan on ft1 ft_2
35                Foreign File: @abs_srcdir@/data/data.csv
36    ->  Index Scan using t1_i1 on t1
37          Index Cond: (c1 = ft_2.id)
38
39 ----
40 ---- No. S-1-5 object type for the hint
41 ----
42 -- No. S-1-5-6
43 /*+SeqScan(t1)SeqScan(ft_1)SeqScan(ft_2)*/
44 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
45 LOG:  pg_hint_plan:
46 used hint:
47 SeqScan(t1)
48 not used hint:
49 SeqScan(ft_1)
50 SeqScan(ft_2)
51 duplication hint:
52 error hint:
53
54  Nested Loop
55    Join Filter: (t1.c1 = ft_2.id)
56    ->  Hash Join
57          Hash Cond: (t1.c1 = ft_1.id)
58          ->  Seq Scan on t1
59          ->  Hash
60                ->  Foreign Scan on ft1 ft_1
61                      Foreign File: @abs_srcdir@/data/data.csv
62    ->  Foreign Scan on ft1 ft_2
63          Foreign File: @abs_srcdir@/data/data.csv
64
65 ----
66 ---- No. J-1-6 object type for the hint
67 ----
68 -- No. J-1-6-6
69 /*+MergeJoin(ft_1 ft_2)Leading(ft_1 ft_2 t1)*/
70 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
71 LOG:  pg_hint_plan:
72 used hint:
73 MergeJoin(ft_1 ft_2)
74 Leading(ft_1 ft_2 t1)
75 not used hint:
76 duplication hint:
77 error hint:
78
79  Nested Loop
80    Join Filter: (ft_1.id = t1.c1)
81    ->  Merge Join
82          Merge Cond: (ft_1.id = ft_2.id)
83          ->  Sort
84                Sort Key: ft_1.id
85                ->  Foreign Scan on ft1 ft_1
86                      Foreign File: @abs_srcdir@/data/data.csv
87          ->  Sort
88                Sort Key: ft_2.id
89                ->  Foreign Scan on ft1 ft_2
90                      Foreign File: @abs_srcdir@/data/data.csv
91    ->  Index Scan using t1_i1 on t1
92          Index Cond: (c1 = ft_2.id)
93
94 ----
95 ---- No. L-1-6 object type for the hint
96 ----
97 -- No. L-1-6-6
98 /*+Leading(ft_1 ft_2 t1)*/
99 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
100 LOG:  pg_hint_plan:
101 used hint:
102 Leading(ft_1 ft_2 t1)
103 not used hint:
104 duplication hint:
105 error hint:
106
107  Nested Loop
108    Join Filter: (ft_1.id = t1.c1)
109    ->  Nested Loop
110          Join Filter: (ft_1.id = ft_2.id)
111          ->  Foreign Scan on ft1 ft_1
112                Foreign File: @abs_srcdir@/data/data.csv
113          ->  Foreign Scan on ft1 ft_2
114                Foreign File: @abs_srcdir@/data/data.csv
115    ->  Index Scan using t1_i1 on t1
116          Index Cond: (c1 = ft_2.id)
117
118 ----
119 ---- No. R-1-6 object type for the hint
120 ----
121 -- No. R-1-6-6
122 \o results/ut-fdw.tmpout
123 /*+Rows(ft_1 ft_2 #1)Leading(ft_1 ft_2 t1)*/
124 EXPLAIN SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
125 LOG:  pg_hint_plan:
126 used hint:
127 Leading(ft_1 ft_2 t1)
128 Rows(ft_1 ft_2 #1)
129 not used hint:
130 duplication hint:
131 error hint:
132
133 \o
134 \! sql/maskout.sh results/ut-fdw.tmpout
135  Nested Loop  (cost=xxx rows=1 width=xxx)
136    Join Filter: (ft_1.id = t1.c1)
137    ->  Nested Loop  (cost=xxx rows=1 width=xxx)
138          Join Filter: (ft_1.id = ft_2.id)
139          ->  Foreign Scan on ft1 ft_1  (cost=xxx rows=1 width=xxx)
140                Foreign File: @abs_srcdir@/data/data.csv
141                Foreign File Size: 42 b
142          ->  Foreign Scan on ft1 ft_2  (cost=xxx rows=1 width=xxx)
143                Foreign File: @abs_srcdir@/data/data.csv
144                Foreign File Size: 42 b
145    ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
146          Index Cond: (c1 = ft_2.id)
147
148 \! rm results/ut-fdw.tmpout