Re: Support for 8-byte TOAST values, round two

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, Greg Burd <greg(at)burd(dot)me>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Support for 8-byte TOAST values, round two
Date: 2026-09-22 07:57:54
Message-ID: arI1As2FmhTYSaYZ@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 21, 2026 at 03:39:23PM -0700, Bharath Rupireddy wrote:
> On Mon, Sep 21, 2026 at 4:11 AM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
>> It looks like doc/src/sgml/limits.sgml needs to be updated as well.
>
> Nice catch. Thanks for pointing it out. Please find the attached patch for that.

- values are large enough to require it. Only an 18-byte pointer must remain
- inside the tuple in the table's heap. For shorter length variable-length
- fields, either a 4-byte or 1-byte field header is used and the value is
- stored inside the heap tuple.
+ values are large enough to require it. Only an 18-byte or 22-byte pointer
+ must remain inside the tuple in the table's heap, for a TOAST table using an
+ OID or an OID8 respectively. For shorter length variable-length fields,
+ either a 4-byte or 1-byte field header is used and the value is stored
+ inside the heap tuple.

How about the following instead for this part, slightly tweaked:
"Only an 18-byte or 22-byte TOAST pointer must remain inside the tuple
in the table's heap, depending on whether the TOAST table uses OID or
OID8 values, respectively. For shorter length variable-length fields,
either a 4-byte or 1-byte field header is used and the value is stored
inside the heap tuple."

Typically, this is only an issue for tables containing many terabytes
of data; partitioning is a possible workaround.
+ A TOAST table using an OID8 does not have this issue, as it can store up
+ to 2^64 out-of-line values and new identifiers are assigned without
+ searching for a free one; see <xref linkend="reloption-toast-value-type"/>.

And here, a bit cleaned up:
"A TOAST table using OID8 values does not have this issue as it can
store up to 2^64 out-of-line values. New identifiers are assigned
without searching for a free one.
See <xref linkend="reloption-toast-value-type"/> for details."
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-09-22 07:59:46 Re: Optimize MCV stats for sortable types and utilize sorted-order properties
Previous Message Alexandre Felipe 2026-09-22 07:54:22 Re: aio: worker: Free SMGR objects when idle