Re: SELECT FOR UPDATE locks whole table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT FOR UPDATE locks whole table
Дата
Msg-id 13898.1039215624@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT FOR UPDATE locks whole table  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Список pgsql-sql
"D'Arcy J.M. Cain" <darcy@druid.net> writes:
> We have the following query:
> SELECT certificate_id
>     INTO TEMP TABLE x_certs
>     FROM certificate
>     WHERE cert_status = 0 AND
>         certificate_id BETWEEN 1111 AND 2222 AND
>         client_id IN (1, 2, 3)
>     ORDER BY certificate_id
>     FOR UPDATE;

> Is there any reason that this query should lock the entire certificate
> table?

It should only lock the selected rows ... and does, in a quick test
here.  Would you provide the test case that makes you think it's doing
otherwise?
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Joel Burton
Дата:
Сообщение: Re: Accent-insensitive
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Rules/Trigges Trade-offs