Skip site navigation (1) Skip section navigation (2)

Re: CTID issues and a soc student in need of help

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tzahi Fadida <tzahi(dot)ml(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CTID issues and a soc student in need of help
Date: 2006-06-01 13:30:08
Message-ID: 20060601133008.GD12689@svana.org (view raw or flat)
Thread:
Lists: 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(at)svana(dot)org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-06-01 13:35:43
Subject: Re: [PATCH] Improve EXPLAIN ANALYZE overhead by sampling
Previous:From: Mark WoodwardDate: 2006-06-01 12:52:59
Subject: Re: Possible TODO item: copy to/from pipe

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group