Re: Waiting on a transaction

From: Doug Bloebaum <blabes(at)gmail(dot)com>
To: Matt Miller <mattm(at)epx(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Waiting on a transaction
Date: 2005-08-16 20:53:10
Message-ID: caa2de8a050816135337e9bf5f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Wow, non-blocking lock failure?

Can I take this chance to say an overdue thanks to the Postgresql
developers? A truly commercial grade feature set in a free
database...

On 8/16/05, Matt Miller <mattm(at)epx(dot)com> wrote:
> On Tue, 2005-08-16 at 12:01 -0700, Bill Moseley wrote:
> > I wondered if my application should set an alarm and timeout
> > with an error if, by odd chance, an update hangs.
>
> Here's a way to handle this under the upcoming 8.1 release:
>
> Before you execute the update you can execute SELECT ... FOR UPDATE
> NOWAIT to select anything (e.g. dummy constant) from the row that you
> want to update. If no error is thrown then you have a lock on your row
> and you can confidently proceed with your update. Otherwise someone has
> that row locked. At that point you can loop and retry if you want.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message George Essig 2005-08-16 20:54:26 New Drupal PostgreSQL Maintainer Wanted
Previous Message Mario Guenterberg 2005-08-16 20:34:41 Re: Adding contrib modules