News for hackers. Stuff that matters.
Re:Distributed locking with Postgres advisory locks by jasonhansel on Sunday January 23, 2022 @11:31PM (#30053773)
Exactly. IMHO Postgres (and other SQL DBs) should consider making SERIALIZABLE the default (as is specified in ANSI SQL). Otherwise people try to be clever.
Re:Distributed locking with Postgres advisory locks by stubish on Monday January 24, 2022 @07:04AM (#30056602)
A program using SERIALIZABLE transaction isolation is required to handle the inevitable errors on commit and retry the transaction or roll back the operation. In practice, developers rarely do and you end up with webapps spitting out 50x errors under load and people blaming the database because they didn't read the fine print. Which is why some projects like psycopg which did default to SERIALIZABLE transaction isolation ended up switching to READ COMMITTED as a more sensible default. It is rare that people actually need SERIALIZABLE and they rarely want to pay the performance or development costs.
Re:Distributed locking with Postgres advisory locks by skyde on Monday January 24, 2022 @11:26AM (#30059769)
You say it is rare that people need serializable. But I would say majority of code that handle money need to use explicit lock or serializable otherwise they can easily be exploited by hacker to get thing for free.
Re:Distributed locking with Postgres advisory locks by lucian1900 on Monday January 24, 2022 @04:27AM (#30055226)
Not only is that slow, but it raises errors programs aren’t currently handing. It would be incompatible to change.
Re:Distributed locking with Postgres advisory locks by belter on Monday January 24, 2022 @06:10AM (#30056102)
As opposed to the current default, that also raises errors programmers aren’t currently handing :-)
Re:Distributed locking with Postgres advisory locks by lucian1900 on Monday January 24, 2022 @06:27AM (#30056231)
The current default has effect anomalies, but doesn't raise serialization errors.

It's possible to write software that relies on READ COMMITTED and behaves correctly.

Re:Distributed locking with Postgres advisory locks by hgdfadsfwer on Monday January 24, 2022 @05:53AM (#30055953)
ANSI default is READ COMMITTED I believe.