PostgreSQL TOAST
TOAST is PostgreSQL's mechanism for compressing or storing oversized attribute values outside their main table rows.
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