Pg_squeeze: An extension to fix table bloat
cybertec-postgresql.com
cybertec-postgresql.com
pg_squeeze use of replication slots seems cool because it just tells Postgres to save WAL it already wrote, no 2x amplification.
I wonder if pg_squeeze would work well in a large-scale heavy-writes case. There is a very sad and hard limit of single-threaded walsender that can saturate a single core (depends on CPU and schema / writes complexity; for example, I saw systems where it happened at ~2 WAL/s, or roughly 1-2 TiB of WAL data generated per day). So at some scale, the process might not converge.
Also, we apply changes in the same system, there are 2x writes anyway – though, it happens asynchronously with pg_squeeze, unlike with triggers (though, that "delta" table pg_repack temporarily writes to, it's very light in terms of indexes, and we do only INSERTs, so this amplification is not 2x in terms of IO and timing overhead, right?)
https://github.com/citusdata/cstore_fdw
"Important notice: Columnar storage is now part of Citus
Columnar storage is now part of the Citus extension, which uses the table access method API to give a much more native experience."
As for external extension becoming a contrib module, it's not a frequent event as well:
- Some "1000+ PostgreSQL EXTENSIONs" list https://gist.github.com/joelonsql/e5aa27f8cc9bd22b8999b7de8a...
- Current list of contrib modules – 58 modules https://gitlab.com/postgres/postgres/tree/master/contrib
- Same list 10 years ago, Postgres 9.2 – 53 modules https://gitlab.com/postgres/postgres/tree/REL9_2_STABLE/cont...
If you want to remove existing table bloat you either need a VACUUM FULL (takes an exclusive lock, impacting your regular workload thus autovacuum doesn't do it), or use an extension that does an online version of that, i.e. pg_repack or pg_squeeze.
Edit: Also, to clarify, with table bloat in this context I mean pages in the table that are not actually needed, but were added to the table previously to store data. Existing pages couldn't be used because rows were still marked as dead, i.e. autovacuum hadn't yet gotten around to clean them up before new data came in.
A lot of accumulated dead tuples (row versions marked dead but still present occupying space) are converted to bloat (empty space, gaps) when VACUUM cleans them up.