PostgreSQL Locking Revealed
blog.nordeus.com
blog.nordeus.com
We do have fragmentation within a block. Our records on the heap are about 150 bytes, so maybe 30 rows per 4K page. In the pathological case where there is 1 row per page due to fragmentation, queries have to fetch 30x the number of blocks, which is a killer on a spinny disk.
One downside is that you need enough free space on your disk to hold the packed copy of the table, so you need to run it before your disk gets too full. The last couple of times we've waited too long, so we've had to move the data to a larger host before we could repack it.
The trade is you are essentially always running with your database as fully serialized writes.
That's a high price to pay. It's easy to do updates serially, and complex to do them concurrently.
The downside to SERIALIZABLE is that conflicts become visible failures to the client, so you have to handle them and retry. Datomic solves this by serialising through the function you pass, but at great latency cost.
I use those for tasks that should only have one copy running on a cluster, but any machine in the cluster can run.
[1] http://www.postgresql.org/docs/current/static/pgrowlocks.htm...
https://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9....