choosing the right locking mode

Поиск
Список
Период
Сортировка
От rihad
Тема choosing the right locking mode
Дата
Msg-id 47F50987.1010603@mail.ru
обсуждение исходный текст
Ответы Re: choosing the right locking mode  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Re: choosing the right locking mode  (Craig Ringer <craig@postnewspapers.com.au>)
Re: choosing the right locking mode  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Given this type query:

         UPDATE bw_pool
         SET user_id=?
         WHERE bw_id=
                 (SELECT MIN(bw_id) FROM bw_pool WHERE user_id IS NULL)
         RETURNING bw_id

The idea is to "single-threadedly" get at the next available empty slot,
no matter how many such queries run in parallel. So far I've been
semi-successfully using LOCK TABLE bw_pool before the UPDATE, but it
deadlocks sometimes. Maybe I could use some less restrictive locking
mode and prevent possible collisions at the same time?

Thanks.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] ANALYZE getting dead tuple count hopelessly wrong
Следующее
От: "William Temperley"
Дата:
Сообщение: Secure "where in(a,b,c)" clause.