File: multicorn_planner_test.sql

package info (click to toggle)
postgresql-multicorn 1.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 864 kB
  • ctags: 611
  • sloc: ansic: 2,690; python: 1,829; sql: 645; makefile: 93; sh: 29
file content (42 lines) | stat: -rw-r--r-- 1,400 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
SET client_min_messages=NOTICE;
CREATE EXTENSION multicorn;
CREATE server multicorn_srv foreign data wrapper multicorn options (
    wrapper 'multicorn.testfdw.TestForeignDataWrapper'
);
CREATE user mapping for postgres server multicorn_srv options (usermapping 'test');

-- Test for two thing: first, that when a low total row count, 
-- a full seq scan is used on a join.
CREATE foreign table testmulticorn (
    test1 character varying,
    test2 character varying
) server multicorn_srv options (
    option1 'option1'
);

explain (costs off) select * from testmulticorn;

explain (costs off) select * from testmulticorn m1 inner join testmulticorn m2 on m1.test1 = m2.test1;

explain (costs off) select * from testmulticorn m1 left outer join testmulticorn m2 on m1.test1 = m2.test1;

DROP foreign table testmulticorn;

-- Second, when a total row count is high 
-- a parameterized path is used on the test1 attribute.
CREATE foreign table testmulticorn (
    test1 character varying,
    test2 character varying
) server multicorn_srv options (
    option1 'option1',
    test_type 'planner'
);

explain (costs off) select * from testmulticorn;

explain (costs off) select * from testmulticorn m1 inner join testmulticorn m2 on m1.test1 = m2.test1;

explain (costs off) select * from testmulticorn m1 left outer join testmulticorn m2 on m1.test1 = m2.test1;


DROP EXTENSION multicorn cascade;