--
|
-- src/test/performance/cfs/cfs_perf_report.sql
|
--
|
-- Run after a pgbench pass to emit one row per table with the CFS accounting
|
-- that the harness report is built from:
|
--
|
-- table name, logical size, physical (compressed) size, compression ratio,
|
-- dead bytes / dead pages, sidecar file sizes (.cfp/.cfsmap/.cfsjrn).
|
--
|
-- pg_stat_cfs only lists CFS relations, so plain tables are reported from
|
-- pg_total_relation_size().
|
|
\pset format aligned
|
\pset null '(null)'
|
|
SELECT
|
relname,
|
pg_size_pretty(logical_size) AS logical_size,
|
pg_size_pretty(physical_size) AS physical_size,
|
round(compression_ratio::numeric, 2) AS compression_ratio,
|
dead_pages,
|
pg_size_pretty(dead_bytes) AS dead_bytes,
|
to_char(last_compaction, 'YYYY-MM-DD HH24:MI:SS') AS last_compaction
|
FROM pg_stat_cfs
|
ORDER BY relname;
|
|
-- Physical on-disk footprint, including the CFS sidecar files (.cfp/.cfsmap/
|
-- .cfsjrn) which live next to the main fork and are accounted for by
|
-- pg_total_relation_size() (Stage 12).
|
SELECT
|
relname,
|
pg_size_pretty(pg_relation_size(relid)) AS main_fork,
|
pg_size_pretty(pg_total_relation_size(relid)) AS total_incl_sidecars
|
FROM pg_stat_cfs
|
ORDER BY relname;
|