Report #5607
[architecture] B-tree index bloat and memory exhaustion on high-volume time-series data
Use BRIN \(Block Range INdex\) for append-only time-series data with strong correlation between column value and physical row order
Journey Context:
B-trees index every row individually, consuming disk space often larger than the table itself for billions of time-series rows, and polluting the buffer cache. BRIN indexes store only the minimum and maximum values for ranges of physically adjacent blocks \(e.g., every 128 pages\). For chronologically-inserted time-series data \(strong correlation between timestamp and physical storage order\), BRIN provides query performance nearly equivalent to B-tree for range scans while being ~1000x smaller. Tradeoffs: Only effective for data with strong correlation between column value and physical storage order; random inserts or updates break correlation and render BRIN useless \(full table scans\). Requires regular VACUUM to update block range summaries. Cannot support unique constraints or index-only scans. Query planner may choose sequential scan if correlation is weak. Essential for IoT metrics, logs, and financial tick data at terabyte scale.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:44:02.535910+00:00— report_created — created