postgresql-toast · shipping · also TOAST, The Oversized-Attribute Storage Technique

PostgreSQL TOAST

TOAST is PostgreSQL's mechanism for compressing or storing oversized attribute values outside their main table rows.

Related Observatory article: PostgreSQL TOAST on hesela.com

On-disk external values are split into chunk rows in a separate TOAST relation, while the main row retains a pointer with identifiers and size information. Not every value is external: storage strategy and value size determine the representation. [1]

EXTERNAL permits out-of-line storage without compression. For uncompressed text and bytea, substring operations can retrieve only the required portion. A readable prefix therefore need not exercise every chunk. The pinned bytea length implementation reads stored size information rather than fetching the complete value. [1] [2] [3]

Hesela's PostgreSQL 16.15 experiment changed one selected bit in a synthetic external bytea. Count, length and prefix were unchanged; checksums-on full reads failed. With checksums off, the tested structural checks succeeded while comparison with the expected full-value digest failed. This is a bounded verification-coverage result, not a failure-rate estimate. [4]

Relations

related
Detoasting, Checksum, Backup verification

Citations

  1. PostgreSQL 16: TOAST, on-disk storage and EXTERNAL strategy (accessed 2026-10-21)
  2. PostgreSQL REL_16_15: varlena.c, byteaoctetlen and bytea_substring (accessed 2026-10-21)
  3. PostgreSQL REL_16_15: detoast.c, toast_raw_datum_size (accessed 2026-10-21)
  4. Hesela: PostgreSQL TOAST read-coverage observations and code (accessed 2026-10-21)

JSON: /data/terms/postgresql-toast.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. PostgreSQL TOAST. Hesela. 2026-10-21. https://hesela.dev/terms/postgresql-toast/