Re: Receiving many more rows than expected

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: Receiving many more rows than expected
Дата
Msg-id 1399914636896-5803687.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Receiving many more rows than expected  (Vincent de Phily <vincent.dephily@mobile-devices.fr>)
Ответы Re: Receiving many more rows than expected
Список pgsql-general
Did you try rewriting the query to avoid using an IN expression?

UPDATE foo SET processing = 't'
FROM (
SELECT id FROM foo WHERE processing = 'f' ORDER BY id ASC LIMIT 5000 FOR
UPDATE
) src
WHERE foo.id = src.id;

The workaround I mentioned above said that a CTE was needed but I'm thinking
that a simply FROM would be just as effective.  Otherwise:

UPDATE foo SET processing = 't'
FROM (
WITH ids_to_update AS (
SELECT id FROM foo WHERE processing = 'f' ORDER BY id ASC LIMIT 5000 FOR
UPDATE
)
SELECT id FROM ids_to_update
) src
WHERE foo.id = src.id;

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Receiving-many-more-rows-than-expected-tp5803179p5803687.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Vincent de Phily
Дата:
Сообщение: Re: Receiving many more rows than expected
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Question about synchronous replication