Re: CTID issues and a soc student in need of help - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: CTID issues and a soc student in need of help
Date
Msg-id 20060601133008.GD12689@svana.org
Whole thread Raw
In response to CTID issues and a soc student in need of help  (Tzahi Fadida <tzahi.ml@gmail.com>)
Responses Re: CTID issues and a soc student in need of help
List pgsql-hackers
On Thu, Jun 01, 2006 at 03:33:50PM +0300, Tzahi Fadida wrote:
> The question is, can the CTID field change throughout
> the run of my function due to some other processes working
> on the relation? Or because of command boundaries it is
> pretty much secured inside an implicit transaction?
> The problem wasn't so great if I didn't want to exploit
> indices in the relations (but I do and does), since
> after you issue a SELECT that uses indices, all you can rely on
> is the CTID to uniquely identify a tuple.

The CTID is the location on disk of the tuple, so no, it doesn't change
while you are running.

However, if you're running in isolation mode "read committed", then
someone else could update the tuple while you're looking at it. In this
case the tuple will appear to vanish and the updated version will
appear elsewhere with a new CTID. Whether this is a problem or not
depends on what you're using it for.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Tzahi Fadida
Date:
Subject: CTID issues and a soc student in need of help
Next
From: Tzahi Fadida
Date:
Subject: Re: CTID issues and a soc student in need of help