Re: Non-overlapping updates blocking each other

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Seamus Abshere <seamus(at)abshere(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Non-overlapping updates blocking each other
Date: 2017-10-16 13:24:16
Message-ID: 20171016132416.nado5ot4l6yhyndc@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Did you try using SELECT FOR NO KEY UPDATE instead of SELECT FOR UPDATE?

However:

Seamus Abshere wrote:

> My current theory is that, since the table is not clustered by id, rows
> with very distant ids get stored in the same page, and the whole page is
> locked during an update.

But we only lock one heap page at a time, not many, so it's hard to see
how that would deadlock.

> Or something.

Given your reluctance to share more details, it seems you'd have to do
with that explanation.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-10-16 13:55:54 Re: Non-overlapping updates blocking each other
Previous Message Seamus Abshere 2017-10-16 12:20:37 Re: Non-overlapping updates blocking each other