Re: Left lateral join with for update and skip locked

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Benjamin Börngen-Schmidt <benjamin(at)boerngen-schmidt(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Left lateral join with for update and skip locked
Date: 2015-03-18 13:43:18
Message-ID: 12129.1426686198@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?UTF-8?B?QmVuamFtaW4gQsO2cm5nZW4tU2NobWlkdA==?= <benjamin(at)boerngen-schmidt(dot)de> writes:
> The Lateral statement does return a result, which I do not expect. I
> returns an end point multiple times for diverent start points. Why? I
> thought, that the selected point by the lateral is locked by the FOR
> UPDATE and if the lateral selects a point that is already locked it will
> be skipped by the SKIP LOCKED.

It sounds like you think SKIP LOCKED means to skip rows locked by your own
transaction. That's not what it does, AFAIK. It skips rows you couldn't
get a lock on without waiting ... but if you already have a lock, that's
fine.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-03-18 14:06:44 Re: Future directions for inheritance-hierarchy statistics
Previous Message Kouhei Kaigai 2015-03-18 13:33:59 Re: Custom/Foreign-Join-APIs (Re: [v9.5] Custom Plan API)