Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE
Дата
Msg-id 20830.1196281987@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE  ("Daniel Caune" <daniel.caune@ubisoft.com>)
Ответы Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE
Список pgsql-sql
"Daniel Caune" <daniel.caune@ubisoft.com> writes:
> I did the following test, removing all the where-clause from the SELECT statement.  Every statement completes
immediately,i.e. it doesn't block.
 

I think you left out some critical information, like who else was doing
what to the table.

What it looks like to me is that the third and fourth rows in this view
were live according to your transaction snapshot, but were committed
dead as of current time, and so FOR UPDATE wouldn't return them.

> agoratokens=> select id from "Tokens" where id IN (47, 104, 44, 42) limit 3 for update;
> This time, the statement returns the row where id equals to 44.

No, it returns *some* row where id equals 44.  Not necessarily the same
one seen in the seqscan.  (I imagine this query is using an index, and
so would visit rows in a different physical order.)  Printing the ctid
of the rows would confirm or disprove that theory.
        regards, tom lane


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

Предыдущее
От: "Daniel Caune"
Дата:
Сообщение: Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE
Следующее
От: "Daniel Caune"
Дата:
Сообщение: Re: Strang behaviour SELECT ... LIMIT n FOR UPDATE