SQL's Design Flaws: How Concurrency Bugs Undermine Database Correctness
By
ingve
The bagel they save for the regulars. Don't skim, savour.
Summary
This article critiques SQL and relational database design, arguing that they make it easy to introduce serious concurrency bugs. Using a textbook money-transfer procedure as an example, the author demonstrates how seemingly reasonable SQL code can contain critical bugs related to atomicity, concurrency, and transaction isolation. The article warns against using SQL when correctness is paramount, highlighting fundamental design flaws that can lead to data corruption or money disappearing in production systems.
Key quotes
· 3 pulledThe design of SQL and relational database systems makes it easy to accidentally introduce serious concurrency bugs.
The code looks completely reasonable, but it has several critical bugs.
First, if this procedure aborts midway through, we might transfer money from Alice's account without transferring any to Bob.
You might also wanna read
Three Years In: A Senior Engineer's Reflection on AI's Impact on the Software Development Role
A senior engineer reflects on the long-term sustainability of AI tools in software development, three years into deep organizational adoptio
Three Years In: A Senior Engineer's Reflection on AI's Impact on the Software Development Role
A senior engineer reflects on the long-term sustainability of AI tools in software development, three years into deep organizational adoptio
Bijou64: A variable-length integer encoding that's both correct and accidentally fast
This article describes the development of bijou64, a variable-length integer (varint) encoding created for the Subduction CRDT sync protocol
Bijou64: A variable-length integer encoding that's both correct and accidentally fast
This article describes the development of bijou64, a variable-length integer (varint) encoding created for the Subduction CRDT sync protocol
Domain Expertise, Not Code, Is the True Competitive Advantage in Software
The article argues that true competitive advantage ("moat") in software has always been domain expertise—deep understanding of the business
A Formal Proof That Jira Is Turing-Complete via Minsky Machine Implementation
This article provides a formal proof that Jira (Atlassian's project-tracking tool) is Turing-complete by demonstrating how to build a Minsky
