← Graph

Immediate Transactions

concept 3 connections

SQLite transaction mode (BEGIN IMMEDIATE) that tries to acquire the write lock when the transaction starts, rather than deferring lock acquisition until the first write statement. SQLite's default deferred mode presumes most transactions are read-only and only grabs the lock on first write, which means if the lock can't be acquired the transaction must error immediately to preserve its snapshot. For Rails applications — which wrap every write in a transaction and use a multi-connection pool — deferred mode causes constant SQLite3::BusyException errors under concurrency. Immediate mode lets SQLite's built-in retry mechanism queue the BEGIN itself, dramatically reducing spurious 500s. Configured via `default_transaction_mode: immediate` in database.yml (sqlite3-ruby ≥ 1.6.9).

category
pattern
about
Immediate Transactions concept
First performance fix demonstrated in the talk.
about
Immediate Transactions concept
The takeaway is about configuring immediate-mode transactions.
concept Immediate Transactions
related_to
SQLite tool
Immediate Transactions is a SQLite transaction mode.

Provenance

Read by
1 extraction