Re: UPDATE & LIMIT together?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: UPDATE & LIMIT together?
Дата
Msg-id 200209031839.g83Id9o07705@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: UPDATE & LIMIT together?  (tp <tp@emaze.net>)
Список pgsql-sql
tp wrote:
> Hmm,,
> 
> thanks so far, it helped.
> 
> The query is horrible slow on full tables (>100.000 rows).
> Is there any other solution? I just want to have the 'next 10 entries'
> WHERE state=10 and update state=20.
> (so that on the next request i or another process only gets the 
> new entires in queue).
> 
> 
> My query now looks like:
> UPDATE queue SET state=20 WHERE (id) IN (SELECT id FROM queue LIMIT 10)

Without an ORDER BY, I am not sure what that LIMIT is returning.

I don't know of a faster way.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: tree structures in sql - my point of view (with request of comment from joe celko)
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Update Help