Quick question regarding HeapTupleHeaderData.t_ctid

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Quick question regarding HeapTupleHeaderData.t_ctid
Date: 2022-06-12 10:42:13
Message-ID: CAJ7c6TOYKPmTOCoSv_7afo1TVt5YQYemNcts7sOaow=uwZKecA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

It's been a while since the last time I explored how PostgreSQL stores
the data on disk, so I decided to refresh my memory. All in all this
topic is well documented, but there is one question that I couldn't
find an answer to quickly.

From README.HOT:

> If an update changes any indexed column, or there is not room on the
> same page for the new tuple, then the HOT chain ends: the last member
> has a regular t_ctid link to the next version and is not marked
> HEAP_HOT_UPDATED.

So t_ctid will point to the newer version of the tuple regardless of
whether HOT is used or not. But I couldn't find an answer to how
t_ctid is used when a tuple is not a part of a HOT chain, or is the
last item in the chain. Which brings a question, maybe it shouldn't
take that much space on disk.

Probably I missed something. Could you please point me to the document
or comments that describe this topic? Or maybe we should add a brief
comment to HeapTupleHeaderData.t_ctid field and/or README.HOT that
would clarify this. For sure this could be learned from the code, but
I believe clarifying this moment in the comments could simplify the
life of the newcomers a bit.

--
Best regards,
Aleksander Alekseev

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-06-12 13:36:13 Re: Add header support to text format and matching feature
Previous Message Dmitry Dolgov 2022-06-12 09:12:53 [RFC] Add jit deform_counter