test: wal_compression and streaming replication wal size
The purpose of this test to demonstrate the effectiveness of wal_compression on the size of WAL transmitted over streaming replication to standby servers.
Testing scenario itself is pretty simple, we will use pgbench. The default built-in transaction script (also invoked with -b tpcb-like) issues seven commands per transaction over randomly chosen aid, tid, bid and delta
BEGIN;
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
END;
Create test database
psql -U postgres -c "create database test"
Generate data in the test database using pgbench: # 10,000,000 accounts, ~1.5 GiB of data.
pgbench -U postgres -i -s 100 test
Notes: During this test, autovacuum was turned off (do not do so in the production database) to exclude the background load, and track the size of generated and submitted WAL to the standby servers caused solely by queries performed by the pgbench.