test-steps-workload-c.txt

text/plain

Filename: test-steps-workload-c.txt
Type: text/plain
Part: 0
Message: Re: row filtering for logical replication
TEST STEPS - Workload case "c"

1. Run initdb pub and sub and start both postgres instances (use the nosync postgresql.conf)

2. Run psql for both instances and create tables x 5
CREATE TABLE test1 (key int, value text, data jsonb, PRIMARY KEY(key, value));
CREATE TABLE test2 (key int, value text, data jsonb, PRIMARY KEY(key, value));
CREATE TABLE test3 (key int, value text, data jsonb, PRIMARY KEY(key, value));
CREATE TABLE test4 (key int, value text, data jsonb, PRIMARY KEY(key, value));
CREATE TABLE test5 (key int, value text, data jsonb, PRIMARY KEY(key, value));

3. create the PUBLISHER on pub instance (e.g. choose from below depending on filter)
-- Allow 100% (no filter)
CREATE PUBLICATION pub_1 FOR TABLE test1, test2, test3, test4, test5;
-- Allow 100%
CREATE PUBLICATION pub_1 FOR TABLE test1 WHERE (key > 0), test2 WHERE (key > 0), test3 WHERE (key > 0), test4 WHERE (key > 0), test5 WHERE (key > 0);
-- Allow 75%
CREATE PUBLICATION pub_1 FOR TABLE test1 WHERE (key > 250000), test2 WHERE (key > 250000), test3 WHERE (key > 250000), test4 WHERE (key > 250000), test5 WHERE (key > 250000);
-- Allow 50%
CREATE PUBLICATION pub_1 FOR TABLE test1 WHERE (key > 500000), test2 WHERE (key > 500000), test3 WHERE (key > 500000), test4 WHERE (key > 500000), test5 WHERE (key > 500000);
-- Allow 25%
CREATE PUBLICATION pub_1 FOR TABLE test1 WHERE (key > 750000), test2 WHERE (key > 750000), test3 WHERE (key > 750000), test4 WHERE (key > 750000), test5 WHERE (key > 750000);
-- Allow %0
CREATE PUBLICATION pub_1 FOR TABLE test1 WHERE (key > 1000000), test2 WHERE (key > 1000000), test3 WHERE (key > 1000000), test4 WHERE (key > 1000000), test5 WHERE (key > 1000000);

4. create the SUBSCRIBER on sub instance
CREATE SUBSCRIPTION sync_sub CONNECTION 'host=127.0.0.1 port=5432 dbname=postgres application_name=sync_sub' PUBLICATION pub_1;

5. On pub side modify the postgresql.conf on the publisher side and restart
\q quit psql
edit synchronous_standby_names = 'sync_sub' 
restart the pub instance

6. Run psql (pub side) and perform the test run.
\i pre_test.sql
\i workload_c.sql
\i post_test.sql
select count(*) from test1;
select count(*) from test2;
select count(*) from test3;
select count(*) from test4;
select count(*) from test5;
TRUNCATE test1, test2, test3, test4, test5;
select count(*) from test1;
select count(*) from test2;
select count(*) from test3;
select count(*) from test4;
select count(*) from test5;

repeat from 6 for each test run.

~~

Repeat from step 1 for each different filter case.