Re: Is there a known bug with SKIP LOCKED and "tuple to be locked was already moved to another partition due to concurrent update"?

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Kamil Dziedzic <kamil(at)dziedzic(dot)es>
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Is there a known bug with SKIP LOCKED and "tuple to be locked was already moved to another partition due to concurrent update"?
Date: 2021-03-12 16:22:31
Message-ID: CAHOFxGoRmMf=hOkeZ+=iFGJ8=FwSud=gG-StQGF==Wy51ZsoQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

https://www.postgresql-archive.org/CPU-hogged-by-concurrent-SELECT-FOR-UPDATE-SKIP-LOCKED-td6150480.html

David Rowley on 20 Aug 2020-
"When updates occur in a non-partitioned table we can follow item
pointer chains to find the live row and check if the WHERE clause
still matches to determine if the row should be updated, or in this
case just locked since it's a SELECT FOR UPDATE. However, with
partitioned table, a concurrent UPDATE may have caused the row to have
been moved off to another partition, in which case the tuple's item
pointer cannot point to it since we don't have enough address space,
we only have 6 bytes for a TID. To get around the fact that we can't
follow these update chains, we just throw the serialization error,
which is what you're getting. Ideally, we'd figure out where the live
version of the tuple is and check if it matches the WHERE clause and
lock it if it does, but we've no means to do that with the current
design."

Moving data between partitions is supported, but maybe another partitioning
design is better suited for high concurrency use cases.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kamil Dziedzic 2021-03-12 16:30:23 Re: Is there a known bug with SKIP LOCKED and "tuple to be locked was already moved to another partition due to concurrent update"?
Previous Message Francesco De Angelis 2021-03-12 13:39:13 Re: Fwd: different execution time for the same query (and same DB status)