# Pat's Big Deal, and Transaction Coordination

DevFeed: [Pat's Big Deal, and Transaction Coordination](<https://devfeed.tech/articles/pat-s-big-deal-and-transaction-coordination-12550.md>)

Original publisher: [Read original article](<http://brooker.co.za/blog/2024/01/23/big-deal.html>)

Author: Marc Brooker

Published: 2024-01-23T00:00:00Z

Content type: article

Language: en

Sources: [Marc Brooker's](<https://devfeed.tech/sources/marc-brooker-s-blog.md>)

Topics: [Transactions](<https://devfeed.tech/topics/transactions.md>), [synchronization](<https://devfeed.tech/topics/synchronization.md>), [database-consistency](<https://devfeed.tech/topics/database-consistency.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [application](<https://devfeed.tech/tags/application.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [concurrently](<https://devfeed.tech/tags/concurrently.md>), [database](<https://devfeed.tech/tags/database.md>), [deal](<https://devfeed.tech/tags/deal.md>), [developer](<https://devfeed.tech/tags/developer.md>), [don-t](<https://devfeed.tech/tags/don-t.md>), [isolation](<https://devfeed.tech/tags/isolation.md>), [isolation-level](<https://devfeed.tech/tags/isolation-level.md>), [key](<https://devfeed.tech/tags/key.md>), [pat](<https://devfeed.tech/tags/pat.md>), [serializable](<https://devfeed.tech/tags/serializable.md>), [snapshot](<https://devfeed.tech/tags/snapshot.md>), [snapshot-isolation](<https://devfeed.tech/tags/snapshot-isolation.md>), [transaction](<https://devfeed.tech/tags/transaction.md>), [transactions](<https://devfeed.tech/tags/transactions.md>), [updating](<https://devfeed.tech/tags/updating.md>)

## AI overview

The BIG DEAL pairs apps that avoid concurrent updates to the same key with databases that avoid coordinating transactions on disjoint keys, but under snapshot isolation this permits write skew. The excerpt illustrates how two transactions can both commit despite producing an outcome that cannot be ordered serially, potentially allowing an application to oversell warehouse stock. Serializable isolation prevents this anomaly by checking whether keys read by a transaction were changed before commit. That can require tracking broad read and predicate sets and coordinating across many machines; in the chair example, snapshot isolation coordinates around the chosen chair, while serializability may involve every chair. The proposed "serializable New Big Deal" asks apps to avoid updating keys frequently read by concurrent processes and to limit reads of frequently written keys. It simplifies correctness reasoning but can make scalability and performance harder for application programmers. The excerpt frames snapshot isolation's scalability advantage as dependent on applications' read and write patterns.

## Source excerpt

Pat's Big Deal, and Transaction Coordination Working together towards a common goal. I have a lot of opinions about Pat Helland's CIDR'24 paper Scalable OLTP in the Cloud: What's the BIG DEAL?1. Most importantly, I like the BIG DEAL that he proposes: Scalable apps don't concurrently update the same key. Scalable DBs don't coordinate across disjoint TXs updating different keys. In exchange for fulfilling their sides of this big deal2 the application gets a database that can scale6, and the database gets a task to do that allows it to scale. The cost of this scalability, for the application developer, is having to deal with a weird concurrency phenomenon called write skew. In this post, we'll look at write skew, why not preventing it helps databases scale, and how we can alter Pat's big deal to prevent write skew and get serializability. In particular, we'll try answer two big questions: Is Pat's big deal the best deal available? Would a serializable big deal be better for application programmers? Snapshot Isolation The big deal experiences write skew because of the database isolation level that Pat chose: snapshot isolation. Other than this particular weird behavior, the application can pretend that concurrent transactions run in a serial total order, which makes application developer's lives easy. Nobody likes reasoning about concurrency, and reasoning about concurrency while correctly implementing business logic is pretty hard, so that's comforting. There are a lot of ways to talk about these concurrency anomalies in the database literature. Tens, at least. The one I think is most accessible to developers is Martin Kleppmann's Hermitage, a set of minimal tests that illustrate each of the weird things that databases users can experience. The test setup is super simple: create table test (id int primary key, value int); insert into test (id, value) values (1, 10), (2, 20); Next, we make two connections to the database we'll call A and B, and run a transaction through