SELECT compression_type_supported('zstd') AS zstd_supported \gset \if :zstd_supported \else \q \endif CREATE SCHEMA am_zstd; SET search_path TO am_zstd; SET columnar.compression TO 'zstd'; CREATE TABLE test_zstd (a int, b text, c int) USING columnar; INSERT INTO test_zstd SELECT floor(i / 1000), floor(i / 10)::text, 4 FROM generate_series(1, 10000) i; SELECT count(*) FROM test_zstd; count --------------------------------------------------------------------- 10000 (1 row) INSERT INTO test_zstd SELECT floor(i / 2), floor(i / 10)::text, 5 FROM generate_series(1000, 11000) i; SELECT count(*) FROM test_zstd; count --------------------------------------------------------------------- 20001 (1 row) VACUUM VERBOSE test_zstd; INFO: statistics for "test_zstd": storage id: xxxxx total file size: 40960, total data size: 14947 compression rate: 21.91x total row count: 20001, stripe count: 2, average rows per stripe: 10000 chunk count: 9, containing data for dropped columns: 0, zstd compressed: 9 SELECT DISTINCT * FROM test_zstd ORDER BY a, b, c LIMIT 5; a | b | c --------------------------------------------------------------------- 0 | 0 | 4 0 | 1 | 4 0 | 10 | 4 0 | 11 | 4 0 | 12 | 4 (5 rows) -- compare compression rate to pglz SET columnar.compression TO 'pglz'; CREATE TABLE test_pglz (LIKE test_zstd) USING columnar; INSERT INTO test_pglz SELECT * FROM test_zstd; VACUUM VERBOSE test_pglz; INFO: statistics for "test_pglz": storage id: xxxxx total file size: 57344, total data size: 35986 compression rate: 9.10x total row count: 20001, stripe count: 1, average rows per stripe: 20001 chunk count: 9, containing data for dropped columns: 0, none compressed: 3, pglz compressed: 6 -- Other operations VACUUM FULL test_zstd; ANALYZE test_zstd; SELECT count(DISTINCT test_zstd.*) FROM test_zstd; count --------------------------------------------------------------------- 6002 (1 row) TRUNCATE test_zstd; SELECT count(DISTINCT test_zstd.*) FROM test_zstd; count --------------------------------------------------------------------- 0 (1 row) SET client_min_messages TO WARNING; DROP SCHEMA am_zstd CASCADE;