@@ -207,3 +207,79 @@ order by
207
207
l_linestatus;
208
208
-- Seq time: 1490.143 ms
209
209
-- Par time: 396.329 ms
210
+
211
+
212
+ -- Access through FDW
213
+
214
+ create foreign table lineitem_fdw (
215
+ l_shipdate date not null ,
216
+ l_quantity float4 not null ,
217
+ l_extendedprice float4 not null ,
218
+ l_discount float4 not null ,
219
+ l_tax float4 not null ,
220
+ l_returnflag " char" not null ,
221
+ l_linestatus " char" not null
222
+ ) server vops_server options (table_name ' vops_lineitem' );
223
+
224
+ select
225
+ l_returnflag,
226
+ l_linestatus,
227
+ sum (l_quantity) as sum_qty,
228
+ sum (l_extendedprice) as sum_base_price,
229
+ sum (l_extendedprice* (1 - l_discount)) as sum_disc_price,
230
+ sum (l_extendedprice* (1 - l_discount)* (1 + l_tax)) as sum_charge,
231
+ avg (l_quantity) as avg_qty,
232
+ avg (l_extendedprice) as avg_price,
233
+ avg (l_discount) as avg_disc,
234
+ count (* ) as count_order
235
+ from
236
+ lineitem_fdw
237
+ where
238
+ l_shipdate <= ' 1998-12-01'
239
+ group by
240
+ l_returnflag,
241
+ l_linestatus
242
+ order by
243
+ l_returnflag,
244
+ l_linestatus;
245
+
246
+ select
247
+ sum (l_extendedprice* l_discount) as revenue
248
+ from
249
+ lineitem_fdw
250
+ where
251
+ l_shipdate between ' 1996-01-01' and ' 1997-01-01'
252
+ and l_discount between 0 .08 and 0 .1
253
+ and l_quantity < 24 ;
254
+
255
+ create foreign table lineitem_projection_fdw (
256
+ l_shipdate date not null ,
257
+ l_quantity float4 not null ,
258
+ l_extendedprice float4 not null ,
259
+ l_discount float4 not null ,
260
+ l_tax float4 not null ,
261
+ l_returnflag " char" not null ,
262
+ l_linestatus " char" not null
263
+ ) server vops_server options (table_name ' vops_lineitem_projection' );
264
+
265
+ select
266
+ l_returnflag,
267
+ l_linestatus,
268
+ sum (l_quantity) as sum_qty,
269
+ sum (l_extendedprice) as sum_base_price,
270
+ sum (l_extendedprice* (1 - l_discount)) as sum_disc_price,
271
+ sum (l_extendedprice* (1 - l_discount)* (1 + l_tax)) as sum_charge,
272
+ avg (l_quantity) as avg_qty,
273
+ avg (l_extendedprice) as avg_price,
274
+ avg (l_discount) as avg_disc,
275
+ count (* ) as count_order
276
+ from
277
+ lineitem_projection_fdw
278
+ where
279
+ l_shipdate <= ' 1998-12-01'
280
+ group by
281
+ l_returnflag,
282
+ l_linestatus
283
+ order by
284
+ l_returnflag,
285
+ l_linestatus;
0 commit comments