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 19055.1034964192@sss.pgh.pa.us
Whole thread Raw
In response to Re: Locking that will delayed a SELECT  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
List pgsql-sql
Ludwig Lim <lud_nowhere_man@yahoo.com> writes:
> *** For clarification ***

>    In the SQL command reference of PostgreSQL:
>    in SELECT statement section :
>      "The FOR UPDATE clause allows the SELECT
> statement to perform exclusive locking of selected
> rows"

Hmm.  That is a misstatement: FOR UPDATE only locks the selected row(s)
against other updates (ie UPDATE, DELETE, SELECT FOR UPDATE), so it's
not "exclusive" in the usual sense of the word: readers can still see
the row.  I'll fix that for 7.3, but meanwhile you might care to read
the 7.3 development docs' discussion of concurrency, which is (IMHO
anyway) more accurate than what was there before:

http://developer.postgresql.org/docs/postgres/mvcc.html

Note in particular that table-level locks and row-level locks are two
independent features.  Updates acquire an appropriate table-level lock
and then acquire row locks on the rows they are updating.
        regards, tom lane


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: triggers
Next
From: Josh Berkus
Date:
Subject: Re: isAutoIncrement and Postgres