SQLite WAL Journal Mode
SQLite WAL Journal Mode is a SQL statement in the SQLite Specific category. SQLite WAL (Write-Ahead Log) mode allows concurrent reads and writes. Much better for multi-process access. The syntax is PRAGMA journal_mode=WAL;. It returns wAL mode journal. A typical example: PRAGMA journal_mode=WAL; -- Changes to wal mode (returns "wal") -- WAL benefits: -- 1. Readers do not block writers -- 2. Writers do not block readers -- 3. Better write performance -- 4. More concurrency -- WAL checkpointing: PRAGMA wal_checkpoint(PASSIVE); -- Checkpoints WAL content into main database -- PRAGMA wal_autocheckpoint = 1000; -- Auto-checkpoint after 1000 pages of WAL growth -- WAL file: .db-wal and .db-shm files accompany the database A close relative is AUTOINCREMENT (SQLite), which sQLite: unlike AUTO_INCREMENT in MySQL, only INTEGER PRIMARY KEY columns auto-increment. AUTOINCREMENT guarantees unique increasing IDs. A close relative is ROWID / _ROWID_, which sQLite: every row has an implicit 64-bit ROWID. INTEGER PRIMARY KEY becomes an alias for ROWID.