detoasting · shipping · also PostgreSQL detoasting

Detoasting

Detoasting retrieves or expands a PostgreSQL TOAST representation into the value representation needed by an operation.

Related Observatory article: Detoasting on hesela.com

A PostgreSQL variable-length datum can be inline, compressed or represented by an external pointer. Detoasting code follows the relevant representation; slice retrieval can avoid fetching an entire uncompressed external value. The work required depends on the caller and storage form, not merely the existence of a table row. [1] [3]

Operations do not all request the same coverage. The bytea octet-length path uses toast_raw_datum_size, reading external size metadata without reconstructing the payload. A whole-value hash and a small substring ask different questions of that same field. This is an implementation-level distinction, not a recommendation to force every query to read all bytes. [2] [3]

Partial or metadata-only reads should not be counted as complete-value integrity checks. The linked experiment preserves successful-query status separately from an expected-content digest comparison and records read failures as having no digest. [4]

Relations

related
PostgreSQL TOAST, 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/detoasting.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Detoasting. Hesela. 2026-10-21. https://hesela.dev/terms/detoasting/