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
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general