--
|
-- src/test/performance/cfs/cfs_perf_setup.sql
|
--
|
-- Shared schema for the CFS pgbench performance harness
|
-- (see pgbench_readonly.sh / pgbench_readwrite.sh). Creates four identical
|
-- tables populated with the same compressible workload, differing only in
|
-- their CFS storage policy:
|
--
|
-- perf_plain no compression (baseline)
|
-- perf_lz4_1 CFS, lz4, level 1
|
-- perf_zstd_1 CFS, zstd, level 1
|
-- perf_zstd_3 CFS, zstd, level 3
|
--
|
-- The data shape is deliberately repetitive text so that compression yields a
|
-- measurable ratio; tune :rows and :payload_len from the harness scripts.
|
|
-- Drop previous run if the script is re-run idempotently.
|
DROP TABLE IF EXISTS perf_plain;
|
DROP TABLE IF EXISTS perf_lz4_1;
|
DROP TABLE IF EXISTS perf_zstd_1;
|
DROP TABLE IF EXISTS perf_zstd_3;
|
|
CREATE TABLE perf_plain (id int primary key, payload text);
|
CREATE TABLE perf_lz4_1 (id int primary key, payload text) WITH (algorithm = 'lz4', level = 1);
|
CREATE TABLE perf_zstd_1 (id int primary key, payload text) WITH (algorithm = 'zstd', level = 1);
|
CREATE TABLE perf_zstd_3 (id int primary key, payload text) WITH (algorithm = 'zstd', level = 3);
|
|
-- Identical payload for every table: a moderately compressible text blob.
|
INSERT INTO perf_plain SELECT g, repeat(md5(g::text), :payload_len / 32) FROM generate_series(1, :rows) g;
|
INSERT INTO perf_lz4_1 SELECT * FROM perf_plain;
|
INSERT INTO perf_zstd_1 SELECT * FROM perf_plain;
|
INSERT INTO perf_zstd_3 SELECT * FROM perf_plain;
|
|
-- Make sure every page is on disk in its final (compressed) form.
|
CHECKPOINT;
|
ANALYZE;
|