Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem) - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem)
Date
Msg-id CAMFBP2oHjJjTvp2a-ty9eZA=Shq9DVTNEdae9UGamZ7y=cK7XQ@mail.gmail.com
Whole thread Raw
In response to Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem)  (Andres Freund <andres@anarazel.de>)
Responses Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem)
List pgsql-hackers
On Fri, Aug 8, 2025 at 4:03 PM Andres Freund <andres@anarazel.de> wrote:
I'm not convinced that the global counter, be it a 32 or a 64 bit, approach
has merit in general, and I'm rather sure it's the wrong thing for toast
values. There's no straightforward path to move away from the global counter
for plain oids, but I would suggest simply not using the global oid counter
for toast IDs.

A large portion of the cases I've seen where toast ID assignments were a
problem were when the global OID counter wrapped around due to activity on
*other* tables (and/or temporary table creation). If you instead had a
per-toast-table sequence for assigning chunk IDs, that problem would largely
vanish.

That's been my experience as well. I was actually toying with the idea of simply switching from OIDs to per-table counters when I came across this, specifically to address the problem of OID wraparound induced performance problems. 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Making type Datum be 8 bytes everywhere
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: cfbot mistakenly reports that a rebase is needed