39.6 pg_repack: Online Bloat Removal Without Full Locks
Alright, let’s talk about the big gun in your anti-bloat arsenal: pg_repack. You’ve met VACUUM, you know its limitations. It cleans up dead rows, but it leaves that gaping, reusable free space behind, like a teenager’s bedroom that’s been “tidied” by just shoving everything under the bed. The table and its indexes are still physically large on disk, consuming precious I/O and cache memory. To truly reclaim that space and get the table physically compact again, you historically had to use CLUSTER or VACUUM FULL, both of which require a full table lock that brings your writes to a grinding, screaming halt. Not ideal for a 24/7 application.