Re: Lock contention, docs vs. reality

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Roland Turner <raz(dot)cbfgterfdy(dot)bet(at)raz(dot)cx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Lock contention, docs vs. reality
Date: 2007-04-23 05:36:18
Message-ID: 20070422223337.S58490@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 22 Apr 2007, Roland Turner wrote:

> I'm working with 7.4, but the 8.2 docs[1] have the same apparent error:
>
> ROW SHARE
>
> Conflicts with the EXCLUSIVE and ACCESS EXCLUSIVE lock modes.
>
> The SELECT FOR UPDATE and SELECT FOR SHARE commands acquire a
> lock of this mode on the target table(s) (in addition to ACCESS
> SHARE locks on any other tables that are referenced but not
> selected FOR UPDATE/FOR SHARE).
>
> If that conflict list were correct, then ROW SHARE wouldn't conflict
> with itself, much less with ROW EXCLUSIVE (required to prevent
> INSERT/UPDATE/DELETE); commonsense dictates that it should conflict with
> both, and experiment demonstrates that it actually does so.

The list in question revolves around table-level locks. Those statements
mentioned also take out locks on affected rows. You should be able select
for update one row while updating a different row in the same table.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-04-23 06:10:47 Re: can't start tsearch2 in 8.2.4
Previous Message A. Kretschmer 2007-04-23 05:35:53 Re: Postgresql Help