Deep dive into a 5MB giant SQL with 5000+ UNION ALLs causing OOM at 70GB, exploring plan cache memory consumption, sub-plan overhead, and work_mem limitations
Analyzing a classic case where long transactions caused table bloat and slowed down primary key queries: massive dead tuples couldn't be reclaimed by vacuum, forcing primary key scans to traverse bloated pages and causing CPU spikes