The Complaint
"SQLite can't handle concurrent writes."
Correct. Only one writer at a time. The others queue. Every Stack Overflow thread about SQLite eventually contains this revelation, delivered with the gravity of someone discovering that water is wet.
The Decision
Hipp did not forget to add concurrent writes. He chose not to.
A single writer means no deadlocks. No lock contention. No transaction ordering puzzles that require a PhD and three cups of coffee to debug. The entire concurrency model fits in your head.
WAL mode (2010) completed the picture: unlimited concurrent readers, one writer, zero interference. Readers never block the writer. The writer never block readers. Rather elegant, that.
The Trade-Off
Honest cost: if your application needs hundreds of concurrent write transactions per second, SQLite is the wrong tool. Hipp says so himself. This is not a limitation he is embarrassed about. It is a boundary he drew deliberately.
The trade-off bought him everything else: one file, zero configuration, no daemon, no DBA, no setup procedure. Cross-platform. Copy the file. It works.
The Proof
- 1 trillion active databases worldwide
- Every Android device. Every iPhone. Every major browser.
- Airbus A350 avionics (DO-178B: the kind where lives depend on it)
- Library of Congress recommended archival format
- 35% faster than raw filesystem I/O for small reads
- 156,000 lines of source. 92 million lines of tests.
- Public domain. Supported until 2050.
The "toy database" runs in more places than every other database engine combined.
The Principle
Every design decision is a trade-off. The mediocre ones try to have everything. The brilliant ones know what to sacrifice.
Hipp sacrificed write concurrency. He gained simplicity so complete that his database became the most deployed software module in history.
One does wonder what we might accomplish if we had the courage to say "no" more often.
Read the full article on vivianvoss.net →
By Vivian Voss — System Architect & Software Developer. Follow me on LinkedIn for daily technical writing.