On Jul25, 2011, at 22:31 , Achim Domma wrote:
> Am 25.07.2011 um 14:48 schrieb Florian Pflug:
>> A more low-level API is provided by {heap,index}_{beginscan,endscan}, 
>> heap_{insert,update,delete} and index_insert. However, correct handling of 
>> transactions using this API isn't easy - for example, to update a row you'd 
>> first have to find the latest version of that row, then decide if you're 
>> allowed to update it, and finally create a new version.
> 
> I see the problems with the second approach, but that's definitively what I 
> would like to do.

You're in for a lot of work, then. I still suggest that you explain your 
ultimate goals before you embark on your endeavor - people might be able to 
point our easier ways to achieve those.

> But I'm only interested in reading, which will hopefully make it a bit easier.

Maybe. But note that if you want your code to be correct for all transaction 
isolation level, you have to be quite careful even when only reading. 
Especially from postgres 9.1 forward, due to the new true serializability 
feature of that release.

> Could you guide me to a starting point? Assuming my database has a table T 
> with an index I. How do I get access to that index?

I suggest you start by reading nodeIndexScan.c. This is the code the query 
executor uses to implement index scans. However, before you embark on your 
endeavor.

best regards,
Florian Pflug


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to