// sqlite 3.5x

SQLite configuration settings

PRAGMA statements. Most apply to the current connection only and reset when it closes, so apps set them on every open; journal_mode=WAL, page_size and auto_vacuum are stored in the database file.

Inspect what your server runs with

PRAGMA journal_mode;
PRAGMA synchronous;
SELECT * FROM pragma_compile_options WHERE compile_options LIKE 'DEFAULT_%';

Mémoire

Caches, per-query work memory and the ceiling on what the server takes from the OS.

ParamètrePar défautRestartCe que cela fait
cache_size -2000 (about 2MB) Non Page cache size for this connection: positive numbers are pages, negative numbers are KiB.

WAL, redo & durability

What a COMMIT waits for and how the change log is sized and written.

ParamètrePar défautRestartCe que cela fait
journal_mode delete Non How SQLite keeps transactions atomic: a rollback journal or a write-ahead log (WAL).
synchronous 2 (FULL) Non How often SQLite waits for data to reach the disk (fsync).

Checkpoints & recovery

How often dirty pages are flushed and how long crash recovery may take.

ParamètrePar défautRestartCe que cela fait
wal_autocheckpoint 1000 pages Non WAL size, in pages, at which a commit triggers an automatic checkpoint; 0 or less disables it.
journal_size_limit -1 (no limit) Non Bytes of WAL or journal file kept on disk after a checkpoint or commit; -1 keeps everything.

Disk I/O

Flush rates, I/O threads and how the engine talks to the file system.

ParamètrePar défautRestartCe que cela fait
page_size 4096 Non Size of a database page in bytes.
mmap_size 0 (off) Non Bytes of the database file to access through memory-mapped I/O; 0 disables it.

Vacuum, statistics & maintenance

Background cleanup and the statistics the planner relies on.

ParamètrePar défautRestartCe que cela fait
auto_vacuum 0 (NONE) Non Whether free pages are returned to the OS automatically (FULL), on request (INCREMENTAL) or never (NONE).
analysis_limit 0 (no limit) Non Approximate rows ANALYZE examines per index; 0 means all rows.

Query planner

Cost model and plan-shape switches.

ParamètrePar défautRestartCe que cela fait
automatic_index 1 (on) Non Let the planner build a temporary index for a join when none exists.

Timeouts

Limits on statements, lock waits and idle sessions.

ParamètrePar défautRestartCe que cela fait
busy_timeout 0 Non Milliseconds to keep retrying when the database is locked by another connection, instead of failing with SQLITE_BUSY.

Temporary storage

Internal temporary tables, tempdb and spill space.

ParamètrePar défautRestartCe que cela fait
temp_store 0 (DEFAULT, which means file) Non Where temporary tables and indexes go: compile-time default, file or memory.

SQL behavior

Settings that change query results or locking semantics, not just speed.

ParamètrePar défautRestartCe que cela fait
foreign_keys 0 (off) Non Enforce FOREIGN KEY constraints.
defer_foreign_keys 0 (off) Non Postpone foreign key checks to COMMIT for the current transaction.
locking_mode NORMAL Non Whether the connection releases file locks after each transaction (NORMAL) or keeps them (EXCLUSIVE).
recursive_triggers 0 (off) Non Allow triggers to fire other triggers recursively, including themselves.

Security & access

Network exposure and features that widen the attack surface.

ParamètrePar défautRestartCe que cela fait
secure_delete 0 (off) Non Overwrite deleted content with zeros.
trusted_schema 1 (on) Non Whether SQL functions and virtual tables used in the schema (views, triggers, CHECK constraints) are trusted to run.

SQLite configuration FAQ

Why did my PRAGMA stop working?

Most pragmas, including foreign_keys, busy_timeout, cache_size and synchronous, last for one connection. A connection pool or a new process starts with the defaults again, so set them in the code that opens each connection.

Are SQLite defaults the same everywhere?

No. Defaults are compile-time options, and builds differ. The sqlite3 shipped with macOS, for example, reports cache_size 2000 (pages, not KiB), journal_size_limit 32768 and secure_delete FAST, while a stock build reports -2000, -1 and 0. The sqlite3 command-line shell also turns trusted_schema off for its own connections. PRAGMA compile_options shows what your build changed.

Which settings persist in the database file?

journal_mode=WAL (other journal modes do not persist), page_size and auto_vacuum (both need a VACUUM to change on an existing database), user_version and application_id. Everything else is per connection.

The full list is in the SQLite manual. Other engines: PostgreSQL, MySQL, SQL Server, Oracle.

// one client for every engine

Run these queries against your own server

SQLly connects to SQLite and the other engines in this reference from one desktop app on macOS, Windows and Linux, with a results grid you can sort, filter and export.