BEGIN;
INSERT INTO audit_log(action) VALUES ('start');
UPDATE counters SET value = value + 1 WHERE key = 'jobs';
COMMIT;Wrapping related writes in one transaction improves consistency and often performance.
BEGIN modes, COMMIT and ROLLBACK, savepoints, WAL mode, busy timeouts, and concurrency patterns for SQLite applications.
Control atomic writes and partial rollback behavior.
BEGIN;
INSERT INTO audit_log(action) VALUES ('start');
UPDATE counters SET value = value + 1 WHERE key = 'jobs';
COMMIT;Wrapping related writes in one transaction improves consistency and often performance.
BEGIN IMMEDIATE;Useful when you know the transaction will write and want to fail early if the database is busy.
ROLLBACK;A safety valve when a migration, import, or manual edit goes wrong.
SAVEPOINT import_batch;
INSERT INTO tags(name) VALUES ('sqlite');
ROLLBACK TO import_batch;
RELEASE import_batch;Helpful for large imports or multi-step workflows where one chunk may fail.
Improve write concurrency and handle busy databases gracefully.
PRAGMA journal_mode = WAL;WAL often improves read/write concurrency for app-style workloads.
PRAGMA busy_timeout = 5000;A practical first-line defense against transient `database is locked` failures.
PRAGMA wal_checkpoint(TRUNCATE);Useful in maintenance jobs or after heavy write bursts when you want to reclaim WAL size.
PRAGMA locking_mode;Useful when debugging exclusive vs normal locking behavior.