{
  "slug": "postgresql-toast-read-coverage",
  "title": "PostgreSQL TOAST: which checks reach the value?",
  "summary": "A controlled one-bit change survives row counts, length and prefix reads; page checksums and trusted payload comparisons reveal different coverage boundaries.",
  "published": "2026-10-21",
  "updated": "2026-10-21",
  "method": "Three executions of the same PostgreSQL 16.15 harness on synthetic uncompressed bytea values; separate checksum-on/off clusters, clean controls and a one-bit offline mutation.",
  "limits": [
    "One payload and selected bit on one Linux host, not a corruption-frequency estimate or exhaustive campaign.",
    "No compressed values, concurrency, restore operation, power loss or hardware failure was tested.",
    "The third execution repeats the same harness; it is not independent peer review."
  ],
  "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": "amcheck",
      "title": "PostgreSQL 16: amcheck, verify_heapam and verification limits",
      "url": "https://www.postgresql.org/docs/16/amcheck.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "pgamcheck",
      "title": "PostgreSQL 16: pg_amcheck, relation selection and TOAST-pointer exclusions",
      "url": "https://www.postgresql.org/docs/16/app-pgamcheck.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "pgchecksums",
      "title": "PostgreSQL 16: pg_checksums, clean-shutdown requirement",
      "url": "https://www.postgresql.org/docs/16/app-pgchecksums.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": "fast08",
      "title": "Bairavasundaram et al. An Analysis of Data Corruption in the Storage Stack. FAST 2008, sections 2.2, 3.2 and 4.5",
      "url": "https://static.usenix.org/events/fast08/tech/full_papers/bairavasundaram/bairavasundaram_html/index.html",
      "accessed": "2026-10-21"
    }
  ]
}
