Re: Locking that will delayed a SELECT

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Locking that will delayed a SELECT
Дата
Msg-id 19055.1034964192@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Locking that will delayed a SELECT  (Ludwig Lim <lud_nowhere_man@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: triggers
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: isAutoIncrement and Postgres