Re: Transaction settings: nowait

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "durumdara *EXTERN*" <durumdara(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Transaction settings: nowait
Date: 2009-05-06 15:28:11
Message-ID: b42b73150905060828w6b8ccd20n389b95ae02b326b8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/5/6 Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>:
> durumdara wrote:
>> In FireBird the transactions have these settings:
>>
>>
>> SET TRANSACTION
>>    [NAME hostvar]
>>    [READ WRITE | READ ONLY]
>>    [ [ISOLATION LEVEL] { SNAPSHOT [TABLE STABILITY]
>>                          | READ COMMITTED [[NO] RECORD_VERSION] } ]
>>    [WAIT | NO WAIT]
>>    [LOCK TIMEOUT seconds]
>> And this is the important thing:
>>
>>
>> [WAIT | NO WAIT]
>>    [LOCK TIMEOUT seconds]
>> If set wait and timeout, the Firebird is waiting for the
>> locked resource (record) for X seconds before it show deadlock error.
>>
>> But when you set no wait, the deadlock error immediately
>> shown by the server.
>>
>> I wanna ask that if I want to avoid the full deadlocks.
>>
>> For. example: I forget to make commit, or rollback on
>> exception then all resources I used (updated) is locked.
>>
>> If I use nowait, the clients immediately get the error
>> message, and they are are not sitting deafly and blindly
>> before the screen, waiting for what will happen.
>>
>> So: have PGSQL same mechanism like nowait?

'select...for update' has a nowait clause, as does 'lock'. also
advisory locks, using pg_try_advisory_lock.

another tactic is to send queries asynchronously and fire a cancel
based on client driven logic.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christophe 2009-05-06 15:31:57 Re: XML -> PG ?
Previous Message Merlin Moncure 2009-05-06 15:24:45 Re: PGSQL x iptables