Re: [HACKERS] 'Waiting on lock' - Mailing list pgsql-patches

From Gregory Stark
Subject Re: [HACKERS] 'Waiting on lock'
Date
Msg-id 87tzpin68g.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: [HACKERS] 'Waiting on lock'  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-patches
"Simon Riggs" <simon@2ndquadrant.com> writes:

> On Tue, 2007-09-25 at 09:16 -0400, Tom Lane wrote:
>> Simon Riggs <simon@2ndquadrant.com> writes:
>> > SQLServer and DB2 have more need of this than PostgreSQL, but we do
>> > still need it.
>>
>> Why?  What does it do that statement_timeout doesn't do better?
>
> If the execution time is negligible, then setting statement_timeout is
> the same thing as setting a lock timeout.

To make this explicit, I think the typical scenario where it would make a
difference is where you're running some large job in a plpgsql function. You
might be processing millions of records but want for a single step of that
process to not wait for a lock. You still want to process all the records you
can though.

So for example if you're updating all the user profiles on your system but
don't want to block on any user-profiles which are locked by active users --
especially if you use database locks for user-visible operations which users
can drag out for long periods of time. (Not saying I agree with that design
but there are arguments for it and people do do it)

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] 'Waiting on lock'
Next
From: Julius Stroffek
Date:
Subject: Re: Optimizer hook