Conceptual
Login

TOAST: How PostgreSQL Stores Wide Column Values Out of Line

A row must fit inside an 8 KB page, so when a value is too big, PostgreSQL compresses it and, if that is not enough, moves it into a side table called TOAST and leaves a pointer behind. The good news is that scans over the main table skip those big values entirely unless you ask for them; the bad news is that selecting a large text or JSON column costs extra reads in the side table per row. It is a direct argument for naming the columns you need rather than selecting everything from a table that stores documents.

Questions this Concept answers

  • Why can a scan over a table with huge JSON columns be fast when you do not select those columns?