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

Re: Predicate locking

From: Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Predicate locking
Date: 2011-04-27 09:24:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
27.04.2011 17:45, Nicolas Barbier:
> 2011/4/27 Vlad Arkhipov<arhipov(at)dc(dot)baikal(dot)ru>:
>> I'm currently need predicate locking in the project, so there are two ways
>> to get it by now: implement it by creating special database records to lock
>> with SELECT FOR UPDATE or wait while they will be implemented in Postgres
>> core. Is there something like predicate locking on the TODO list currently?
> I assume you want ("real", as opposed to what is in<  9.1 now)
> SERIALIZABLE transactions, in which case you could check:
> <URL:>
> Nicolas
Not sure about the whole transaction, I think it degrades the 
performance too much as transactions access many tables. Just wanted 
SELECT FOR UPDATE to prevent inserting records into a table with the 
specified condition. It seems to be very typical situation when you have 
a table like
CREATE TABLE timetable (start_ts TIMESTAMP, end_ts TIMESTAMP)
and before insertion in this table want to guarantee that there is no 
overlapped time intervals there. So, first you need to lock the range in 
the table, then to check if there are any records in this range.
In my case this table is the only for which I need such kind of locking.

In response to


pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2011-04-27 09:38:14
Subject: Re: Predicate locking
Previous:From: Nicolas BarbierDate: 2011-04-27 08:45:58
Subject: Re: Predicate locking

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