Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: Nikita Malakhov <hukutoc(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value
Date: 2023-07-07 08:30:15
Message-ID: 20230707173015.001c89f5a3f6f5cdacead169@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 7 Jul 2023 17:21:36 +0900
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:

> Hi Nikita,
>
> On Wed, 5 Jul 2023 17:49:20 +0300
> Nikita Malakhov <hukutoc(at)gmail(dot)com> wrote:
>
> > Hi!
> >
> > I like the idea of having a standard function which shows a TOAST value ID
> > for a row. I've used my own to handle TOAST errors. Just, maybe, more
> > correct
> > name would be "...value_id", because you actually retrieve valueid field
> > from the TOAST pointer, and chunk ID consists of valueid + chunk_seq.
>
> Thank you for your review!
>
> Although, the retrieved field is "va_valueid" and it is called "value ID" in the
> code, I chose the name "..._chunk_id" because I found the description in the
> documentation as followings:
>
> -------------
> Every TOAST table has the columns chunk_id (an OID identifying the particular TOASTed value), chunk_seq (a sequence number for the chunk within its value), and chunk_data (the actual data of the chunk). A unique index on chunk_id and chunk_seq provides fast retrieval of the values. A pointer datum representing an out-of-line on-disk TOASTed value therefore needs to store the OID of the TOAST table in which to look and the OID of the specific value (its chunk_id)
> -------------
> https://www.postgresql.org/docs/devel/storage-toast.html
>
> Here, chunk_id defined separately from chunk_seq. Therefore, I wonder
> pg_column_toast_chunk_id would be ok. However, I don't insist on this
> and I would be happy to change it if the other name is more natural for users.

I attached v2 patch that contains the documentation fix.

Regards,
Yugo Nagata

>
> Regards,
> Yugo Nagata
>
> >
> > --
> > Regards,
> > Nikita Malakhov
> > Postgres Professional
> > The Russian Postgres Company
> > https://postgrespro.ru/
>
>
> --
> Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
>
>

--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
v2_pg_column_toast_chunk_id.patch text/x-diff 3.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kumar, Sachin 2023-07-07 09:16:01 RE: Initial Schema Sync for Logical Replication
Previous Message Yugo NAGATA 2023-07-07 08:21:36 Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value