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

From Tzahi Fadida
Subject CTID issues and a soc student in need of help
Date
Msg-id 1149165230.7657.24.camel@llord
Whole thread Raw
Responses Re: CTID issues and a soc student in need of help  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Hi,
I am a Google soc student and in need of some help 
with PostgreSQL internals:

My C function can run (and already running)
for a very very long time on some
inputs and reiterate on relations using SPI.
Basically, I open portals and cursors to relations. 
Also note that I always open the
relations in READ ONLY mode using SPI.
A big no no is that some data in the relations
would change since that would just ruin everything.

I have a great need to identify a tuple uniquely so
my prototype uses the CTID field for that purpose.
Btw, this identification is required by the algorithm
and primary keys are just wasteful and will slow the process
considerably (not to mention some relations don't have primary keys).

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 other solution is to temporarily duplicate the relations but
this is less appealing (plus it's already working great with CTIDs).

-- 
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS:  see at
http://members.lycos.co.uk/my2nis/spamwarning.html



pgsql-hackers by date:

Previous
From: "Mark Woodward"
Date:
Subject: Re: Possible TODO item: copy to/from pipe
Next
From: Martijn van Oosterhout
Date:
Subject: Re: CTID issues and a soc student in need of help