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

From: Hannu Krosing <hannuk(at)google(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nikhil Kumar Veldanda <veldanda(dot)nikhilkumar17(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: Support for 8-byte TOAST values (aka the TOAST infinite loop problem)
Date: 2025-07-21 00:15:27
Message-ID: CAMT0RQTkWU_3d8okmpFh6AyBucHFENkvRsuKQrYzaZsb_QiSoQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have been evolving details for Direct TOAST design in
https://wiki.postgresql.org/wiki/DirectTOAST

The top level goals are

* 8-byte TOAST pointer - just (header:1, tag:1 and TID:6)
* all other info moved from toast pointer to actual toast record(s),
so heap rows are smaller and faster.
* all extra fields are bytea with internal encoding (maybe will create
full new types for these, or maybe just introspection functions are
enough)
the reasons for this are
- PostgresSQL arrays add 20 byte overhead
- bytea gives other freedoms in encoding for minimal space usage

No solution yet for va_toastrelid , but hope is
- to use some kind of mapping and find one or two free bits somewhere
(tid has one free),
- or add a 12-byte toast pointer just for this.
- or to make sure that CLUSTER and VACUUM FULL can be done without
needing va_toastrelid. I assume it is there for clustering the TOAST
which will be not possible separately from the main heap with direct
toast tid pointers anyway.

Please take a look and poke holes in it !

On Sun, Jul 20, 2025 at 10:28 AM Nikhil Kumar Veldanda
<veldanda(dot)nikhilkumar17(at)gmail(dot)com> wrote:
>
> Hi,
>
> > v26-0014-Design-to-extend-the-varattrib_4b-and-toast-poin.patch:
> > Design proposal covering varattrib_4b, TOAST pointer layouts, and
> > related macro updates.
> > v26-0015-Implement-Zstd-compression-no-dictionary-support.patch: Plain
> > ZSTD (non dict) support and few basic tests.
>
> Sending v27 patch with a small update over v26 patch.
>
> v27-0014-Design-to-extend-the-varattrib_4b-and-toast-poin.patch:
> Design proposal covering varattrib_4b, TOAST pointer layouts, and
> related macro updates.
> v27-0015-Implement-Zstd-compression-no-dictionary-support.patch: Plain
> ZSTD (non dict) support and few basic tests.
>
> > --
> > Nikhil Veldanda
>
> --
> Nikhil Veldanda

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2025-07-21 00:59:04 Re: index prefetching
Previous Message Hannu Krosing 2025-07-21 00:03:45 Re: Horribly slow pg_upgrade performance with many Large Objects