- "how to disappear" book http://globepequot.com/individual_book_page.php?isbn13=9781599219776 #
- kicked off evening with lovely Emma ladies, and now headed to dinner with @lh and @jenred. #
I’ve been reading some old papers about locking and MVCC in preparation for writing about MVCC in PostgreSQL, and for giving a talk at CouchCamp next week!
I just finished “Locking“, by Jim Gray. He discusses semaphores, and makes the argument for implementing a locking scheduler to handle errors and deadlocks (which he calls interlocks, or a “deadly embrace” – a term I’m sad we’ve stopped using).
An example from the start of the paper illustrates the power of MVCC:
The classic example is an accounting file. Processes reading the file may share it
concurrently. However, a process requesting write access to the file blocks until all processes currently reading have released the file.
A lovely thing about Postgres’ MVCC is that readers (SELECT) don’t require this type of lock, and most writers don’t block readers. For SELECT, the only statements that will block it are those that make changes to tables which move all rows physically around (VACUUM FULL, CLUSTER, REINDEX, TRUNCATE), or make changes to table structure (ALTER TABLE, DROP TABLE).
Have a look at the explicit locking docs for more detail on the lock modes automatically used by PostgreSQL.
I’m playing around with some diagrams for explaining MVCC that I’ll be posting here over the next few days. Not sure if I’ll end up giving up on slides and just use a whiteboard for the talk. I made an illustrated shared buffers deck to go along with Greg Smith’s excellent talk on shared buffers a while back. This is the beginning of a talk that I hope will emulate that.
Here are my first few slides, showing the system-defined columns. The next few slides will describe optimizations PostgreSQL has for managing the side effects of our pessimistic rollback strategy, and reducing IO during vacuuming and index updates.
- RT @personaltelco plugged in another new node at @selenamarie's tonight. yay! #
- bizarre mix of nytimes gibson, autotune parody, horrific BP news and reading database papers from the '80s. #
- '…perhaps the company should issue children with free “training wheels” identities at birth.' @GreatDismal http://nyti.ms/9KjPre #
- 'To set the stage we propose that the universe of the operating system consists of objects of various types' -Jim Gray, icanhaz.com/locking #
- 'This approach is still inadequate because storage required for an object that can be updated remains unbounded.' D Reed, bit.ly/9WsX0z #
- And then I discovered @autotunethenews. #