Crunchy Data
Read post

Postgres 19 Compression: from pglz to LZ4

Postgres 19 is switching its default TOAST compression algorithm from pglz to LZ4. The post covers the history of Postgres compression starting from version 7.0, explains why pglz was originally built (speed, minimal memory, no external dependencies), and details why LZ4 is a better fit for modern hardware — roughly 8× faster compression and better ratios due to a larger 64 kB sliding window. It also walks through Postgres storage strategies (EXTENDED, PLAIN, EXTERNAL, MAIN), the varlena format for variable-length types, the step-by-step compression decision tree Postgres uses when writing rows, and how compression works in B-tree indexes including the 510-byte threshold and the 2704-byte maximum index row size limit.

    #postgresql#compression
Jul 16•9m read time•From crunchydata.com
Post cover image
Table of contents
History of Postgres CompressionTOAST with pglzWhy move from pglz to LZ4?Postgres storage strategiesThe varlena formatThe compression decision treeCompression in indexesThe future of compression in Postgres
6K Impressions
Crunchy Data's image
Crunchy Data

CrunchyData's platform is a central hub for PostgreSQL professionals and database administrators, of...

107 Followers

•

900 Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard