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

From Aleksander Alekseev
Subject Re: Quick question regarding HeapTupleHeaderData.t_ctid
Date
Msg-id CAJ7c6TOOV6ASi-tUx1-hfrhXW_btCZTv8zYkBhLUTCqrJAxOaQ@mail.gmail.com
Whole thread Raw
In response to Re: Quick question regarding HeapTupleHeaderData.t_ctid  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Quick question regarding HeapTupleHeaderData.t_ctid  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers
Hi Tom,

> > Which brings a question, maybe it shouldn't
> > take that much space on disk.
>
> How would you make it optional?  In particular, what are you going to
> to when it's time to update a row (and therefore insert a ctid link)
> and the page is already completely full?

In other words, if I have an ItemPointer to an old tuple and try to
UPDATE it, t_ctid allows me to find the next page with another HOT
chain and, if possible, add a new tuple to that HOT chain. And
although there are newer versions of the tuple they are not
necessarily alive, e.g. if the corresponding transactions were
aborted, or they are running and it's not clear whether they will
succeed or not. I didn't think about this scenario.

It also explains why t_ctid can't be variable in size depending on
whether it points to a tuple in the same page or in the different one.
Next time we change t_ctid its size may change which will require
resizing the tuple, and the whole story becomes very complicated.

I think I get it now. Many thanks!

Just to clarify, is t_ctid used for anything _but_ HOT?

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Quick question regarding HeapTupleHeaderData.t_ctid
Next
From: Aleksander Alekseev
Date:
Subject: Re: Quick question regarding HeapTupleHeaderData.t_ctid