{
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-21",
  "advantages": [],
  "limitations": [],
  "slug": "detoasting",
  "term": "Detoasting",
  "aliases": [
    "PostgreSQL detoasting"
  ],
  "definition": "Detoasting retrieves or expands a PostgreSQL TOAST representation into the value representation needed by an operation.",
  "note": "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. [toast] [size]\n\nOperations 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. [length] [size]\n\nPartial 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. [hesela-toast]",
  "related": [
    "postgresql-toast",
    "checksum",
    "backup-verification"
  ],
  "citations": [
    {
      "id": "toast",
      "title": "PostgreSQL 16: TOAST, on-disk storage and EXTERNAL strategy",
      "url": "https://www.postgresql.org/docs/16/storage-toast.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "length",
      "title": "PostgreSQL REL_16_15: varlena.c, byteaoctetlen and bytea_substring",
      "url": "https://github.com/postgres/postgres/blob/7d3e000c5961a544302072058a1184e9a588837b/src/backend/utils/adt/varlena.c",
      "accessed": "2026-10-21"
    },
    {
      "id": "size",
      "title": "PostgreSQL REL_16_15: detoast.c, toast_raw_datum_size",
      "url": "https://github.com/postgres/postgres/blob/7d3e000c5961a544302072058a1184e9a588837b/src/backend/access/common/detoast.c",
      "accessed": "2026-10-21"
    },
    {
      "id": "hesela-toast",
      "title": "Hesela: PostgreSQL TOAST read-coverage observations and code",
      "url": "https://hesela.dev/datasets/postgresql-toast-read-coverage/",
      "accessed": "2026-10-21"
    }
  ]
}
