Re: Locking that will delayed a SELECT - Mailing list pgsql-sql

From Tom Lane
Subject Re: Locking that will delayed a SELECT
Date
Msg-id 17217.1034949478@sss.pgh.pa.us
Whole thread Raw
In response to Re: Locking that will delayed a SELECT  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: Locking that will delayed a SELECT
Re: Locking that will delayed a SELECT
List pgsql-sql
Achilleus Mantzios <achill@matrix.gatewaynet.com> writes:
>> The problem is solved
>> 
>> a) Using SERIALIZABLE XACTION ISOLATION LEVEL
>> b) in T2 using "select for update" instead of select. That way T2's
>> queries will wait untill T1's statements commit or rollback.

ISTM that SERIALIZABLE mode will not solve this problem, since by
definition you want T2 to see results committed after T2 has started.

A simple answer is to have T1 grab an ACCESS EXCLUSIVE lock on some
table to block T2's progress.  If that locks out third-party
transactions that you'd rather would go through, you can probably use
a lesser form of lock --- but then both T1 and T2 will have to cooperate
since each will need to explicitly take a lock.


I gave a presentation at the O'Reilly conference this year that covered
some of these issues.  Looks like you can still get the slides from
http://conferences.oreillynet.com/cs/os2002/view/e_sess/2681
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Can I create working trigger on view
Next
From: Tom Lane
Date:
Subject: Re: TRIGGERed INSERTS