New comment by asa400 in "SQLite concurrency and why you should care about it"
zeroclarkthirty.com·1d·
Discuss: Hacker News
Flag this post

SQLite has some surprising behavior regarding transactions that bites almost everyone who attempts to use SQLite with multiple concurrent connections.

the problem

If a connection is in an active write transaction, any other connection attempting to upgrade a read transaction to a write transaction will fail immediately with a surprising database is locked error. This happens regardless of what PRAGMA busy_timeout is set to!

understanding why

In SQLite, all query interactions happen in transactions of some kind, whether in a read transaction (select) or a write transaction (insert|update|delete). 1.

SQLite allows for many concurrent readers but only 1 writer at a time. This invariant is enforced with locks, w…

Similar Posts

Loading similar posts...