// 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_%';

Speicher

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

EinstellungStandardRestartWas es bewirkt
cache_size -2000 (about 2MB) Nein 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.

EinstellungStandardRestartWas es bewirkt
journal_mode delete Nein How SQLite keeps transactions atomic: a rollback journal or a write-ahead log (WAL).
synchronous 2 (FULL) Nein 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.

EinstellungStandardRestartWas es bewirkt
wal_autocheckpoint 1000 pages Nein WAL size, in pages, at which a commit triggers an automatic checkpoint; 0 or less disables it.
journal_size_limit -1 (no limit) Nein 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.

EinstellungStandardRestartWas es bewirkt
page_size 4096 Nein Size of a database page in bytes.
mmap_size 0 (off) Nein 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.

EinstellungStandardRestartWas es bewirkt
auto_vacuum 0 (NONE) Nein Whether free pages are returned to the OS automatically (FULL), on request (INCREMENTAL) or never (NONE).
analysis_limit 0 (no limit) Nein Approximate rows ANALYZE examines per index; 0 means all rows.

Query planner

Cost model and plan-shape switches.

EinstellungStandardRestartWas es bewirkt
automatic_index 1 (on) Nein Let the planner build a temporary index for a join when none exists.

Timeouts

Limits on statements, lock waits and idle sessions.

EinstellungStandardRestartWas es bewirkt
busy_timeout 0 Nein 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.

EinstellungStandardRestartWas es bewirkt
temp_store 0 (DEFAULT, which means file) Nein 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.

EinstellungStandardRestartWas es bewirkt
foreign_keys 0 (off) Nein Enforce FOREIGN KEY constraints.
defer_foreign_keys 0 (off) Nein Postpone foreign key checks to COMMIT for the current transaction.
locking_mode NORMAL Nein Whether the connection releases file locks after each transaction (NORMAL) or keeps them (EXCLUSIVE).
recursive_triggers 0 (off) Nein Allow triggers to fire other triggers recursively, including themselves.

Security & access

Network exposure and features that widen the attack surface.

EinstellungStandardRestartWas es bewirkt
secure_delete 0 (off) Nein Overwrite deleted content with zeros.
trusted_schema 1 (on) Nein 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.