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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Hannu Krosing <hannuk(at)google(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, 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-30 23:22:22
Message-ID: ar2ZrnIR6OC14ppI@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 30, 2026 at 12:44:28PM +0200, Hannu Krosing wrote:
> In my insert tests 8-byte TOAST was much faster that 4-byte toast
>
> This resulted in a solid 23% speed-up because it didn't need to verify
> new OIDs against the unique index, despite each toast index entry
> taking up slightly more space (30.1 bytes vs. 21.4 bytes on average)

The speedup is not surprising. Thanks for posting some numbers.

A note about that. Postgres hackers had a meetup two weeks ago in
Tokyo where I have reported the activity of this thread, including the
fact that the new values are not rechecked in the INSERT path.

My opinion, same as upthread, is that a recheck is kind of pointless
because we should never go backwards under normal running conditions
and we would run out of LSNs before we reach the OID8 limit. I did
mention the argument of using pg_resetwal -o to go backwards, leading
to INSERT failures due to duplicates of the TOAST unique index.
Fujii-san had a more biased opinion than mine, mentioning that a
recheck could be a more defensive position, even if it costs in normal
running conditions.

Perhaps my opinion will be overruled in this release cycle, which is
fine, I just want to point out that the API toastid_valueid_exists()
is transparently able to work with a recheck of Oid8 values, so the
value recheck could be plugged in for this case as well, depending on
how the discussion flows. Perhaps there is a bug I am not aware of
yet, that could justify the recheck, of course.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-09-30 23:24:31 Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Previous Message Alex Liapychev 2026-09-30 23:14:14 Re: COMMENTS are not being copied in CREATE TABLE LIKE