Re: SELECT FOR UPDATE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT FOR UPDATE
Дата
Msg-id 7869.1059138651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SELECT FOR UPDATE  (Thomas Swan <tswan@idigx.com>)
Ответы Re: SELECT FOR UPDATE  (Thomas Swan <tswan@idigx.com>)
Список pgsql-hackers
Thomas Swan <tswan@idigx.com> writes:
> Hypothetically, if I knew the relations that contained the tuples I was 
> locking, I could conceivably visit them in, let's say, alphabetical 
> order or oid order or any predictable order, and then select the rows 
> for update (using oid order or primary key order).  It would be hard to 
> induce a deadlock condition if the locks being acquired where in a 
> consistently reproducible order by all processes. 

Given that this requires programmer discipline anyway, I think it's okay
to leave the whole thing in the hands of the programmer.  My original
comment that the locks are acquired in an unpredictable order wasn't
right --- they are acquired by the executor's top level, therefore
in the order the rows come out of the execution engine, and therefore
you can make the order predictable if you want to.  Just use ORDER BY.
        regards, tom lane


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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: php with postgres
Следующее
От: "Shridhar Daithankar"
Дата:
Сообщение: Re: [PERFORM] hardware performance and some more