📐 Mathematical Formula & Derivation
S_{disk} = N_{rows} \times \left( S_{row} + 27_{\text{header}} + N_{idx} \times 32 \right) \times (1 + b_{bloat}) 🔬 Engineering Methodology & Benchmark Analysis
In PostgreSQL, every single row incurs a mandatory 23-byte `HeapTupleHeaderData` plus a 4-byte page item pointer (27 bytes minimum overhead per row before a single column is stored). For narrow tables with 500M rows, tuple headers alone consume 13.5 GB!
Additionally, each B-Tree index adds ~28–36 bytes per row (factoring in the default 90% leaf page fillfactor), and Multi-Version Concurrency Control (MVCC) retains dead tuples until `autovacuum` reclaims space.
🛠️ Step-by-Step Engineering Calculation Guide
- Total Table Row Count (Millions of Rows): Configure "Total Table Row Count (Millions of Rows)" (default benchmark: 50) or select an industry preset.
- Average Raw Column Data per Row (Bytes): Configure "Average Raw Column Data per Row (Bytes)" (default benchmark: 280) or select an industry preset.
- Number of B-Tree / GIN Indexes on Table: Configure "Number of B-Tree / GIN Indexes on Table" (default benchmark: 4) or select an industry preset.
- MVCC Dead-Tuple Bloat & WAL Overhead (%): Configure "MVCC Dead-Tuple Bloat & WAL Overhead (%)" (default benchmark: 25) or select an industry preset.