Quick question regarding HeapTupleHeaderData.t_ctid - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Quick question regarding HeapTupleHeaderData.t_ctid
Date
Msg-id CAJ7c6TOYKPmTOCoSv_7afo1TVt5YQYemNcts7sOaow=uwZKecA@mail.gmail.com
Whole thread Raw
Responses Re: Quick question regarding HeapTupleHeaderData.t_ctid  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: [RFC] Add jit deform_counter
Next
From: Andrew Dunstan
Date:
Subject: Re: Add header support to text format and matching feature