pg_regresql: truly portable PostgreSQL statistics

The previous article showed that PostgreSQL 18 makes optimizer statistics portable, but left one gap open: It&#x27;s not worth trying to inject relpages as the planner checks the actual file size and scales it proportionally. The planner doesn&#x27;t trust pg_class.relpages . It calls smgrnblocks() to read the actual number of 8KB pages from disk. Your table is 74 pages on disk but…