append.sql

application/sql

Filename: append.sql
Type: application/sql
Part: 0
Message: Re: Asynchronous Append on postgres_fdw nodes.
CREATE EXTENSION postgres_fdw;
create table pt (id integer, payload integer) partition by hash(id);
CREATE SERVER srv FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'postgres');
CREATE USER MAPPING FOR CURRENT_USER SERVER srv;
create foreign table ft_1 partition of pt for values with (modulus 2, remainder 0) server srv options (table_name 'pt_1');
create foreign table ft_2 partition of pt for values with (modulus 2, remainder 1) server srv options (table_name 'pt_2');
create table pt_1 (id integer, payload integer);
create table pt_2 (id integer, payload integer);
INSERT INTO pt SELECT s, s/20 FROM generate_series(1, 10000) s;
SELECT * FROM pt LIMIT 10;