Re: can we add SKIP LOCKED to UPDATE?

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: can we add SKIP LOCKED to UPDATE?
Дата
Msg-id CAMkU=1xXqhDn_kpU1TEHt03oEK=-VdX7u5F7j2E-ekySdvz25Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: can we add SKIP LOCKED to UPDATE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: can we add SKIP LOCKED to UPDATE?
Re: can we add SKIP LOCKED to UPDATE?
Список pgsql-hackers
On Mon, Nov 9, 2015 at 9:06 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 德哥 <digoal@126.com> writes:
>>    PostgreSQL 9.5 added skip locked to select for update to improve concurrency performance, but why not add it to
updatesql?
 
>
> Seems like you'd have unpredictable results from the update then.

But with use of RETURNING, you could at least know what those results
were and so could deal with the unpredictability.

I don't understand Digoal's use case (Google Translate does a poor job
on the linked page), but this would be handy in conjunction with LIMIT
(which also doesn't exist for UPDATE right now).

update work_queue set assigned='Jeff' where assigned is null and
skills_needed <@ '{whining,"breaking things"}'  limit 1 skip locked
returning id, description

In 9.5 you will be able to do it with a subselect, but putting them
directly on the UPDATE would be easier to understand, and perhaps more
efficient to execute.

Cheers,

Jeff



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: PL/Pythonu - function ereport
Следующее
От: Marco Nenciarini
Дата:
Сообщение: pg_receivexlog: spurious error message connecting to 9.3