pgsql: Minimize footprint of TOAST_MAX_CHUNK_SIZE in heap and amcheck c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Minimize footprint of TOAST_MAX_CHUNK_SIZE in heap and amcheck c
Date: 2026-09-03 22:54:12
Message-ID: E1x2GJv-00000003NAM-20Q3@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Minimize footprint of TOAST_MAX_CHUNK_SIZE in heap and amcheck code

This refactoring eases a little bit a follow-up change to add support
for 8-byte TOAST value IDs, as the maximum chunk size allowed for a
single chunk of TOASTed data depends on the size of varatt_external, its
value ID being part of it.

It is worth noting that TOAST_MAX_CHUNK_SIZE resolves as a uintptr_t, so
the previous calculations were in 64-bit unsigned arithmetic. These are
now done in int32, which still works the same way due to an external
TOAST value being bounded to 1GB.

Author: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Reviewed-by: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Discussion: https://postgr.es/m/CALj2ACVnO6jjs5aRx3dSOBy9LV7=iakPBR1eOvoeB8rL8Q47zg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2b3d11aaed891958f24aed05bf454524d603b6ea

Modified Files
--------------
contrib/amcheck/verify_heapam.c | 13 +++++++++----
src/backend/access/heap/heaptoast.c | 20 ++++++++++++--------
2 files changed, 21 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Richard Guo 2026-09-04 01:36:29 pgsql: Disallow joins whose lateral references need an unformable outer
Previous Message Peter Geoghegan 2026-09-03 21:37:15 pgsql: Add non-MVCC index scan test module.