Re: can we add SKIP LOCKED to UPDATE?

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 德哥 <digoal(at)126(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: can we add SKIP LOCKED to UPDATE?
Date: 2015-11-09 17:25:47
Message-ID: CANP8+j+u02V3RJqRYOKUhVZ4CZE0wNLGmsu282pOh2wz7WevSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9 November 2015 at 17:06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> =?GBK?B?tcK45w==?= <digoal(at)126(dot)com> writes:
> > PostgreSQL 9.5 added skip locked to select for update to improve
> concurrency performance, but why not add it to update sql?
>
> Seems like you'd have unpredictable results from the update then.
>

True, but given the already restricted use case of SKIP LOCKED, the request
makes sense for the following

UPDATE ...
SKIP LOCKED
RETURNING xxx

would be better than

BEGIN

SELECT xxx
FOR UPDATE
SKIP LOCKED

UPDATE

COMMIT

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2015-11-09 17:27:19 Re: Using quicksort for every external sort run
Previous Message Pavel Stehule 2015-11-09 17:23:44 Re: Some questions about the array.