Blogmark

Concurrent locks and MultiXacts in Postgres

via jbranchaud@gmail.com

https://blog.danslimmon.com/2023/12/11/concurrent-locks-and-multixacts-in-postgres/
PostgreSQL MultiXact Database Locks

When multiple transactions have no exclusive locks on the same row, the database needs a way of tracking that set of transactions beyond the single xmax value that initially locks the row.

Postgres creates a MultiXact. A MultiXact essentially bundles together some set of transactions so that those transactions can all lock the same row at the same time. Instead of a transaction ID, a new MultiXact ID is written to the row’s xmax.