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

Memória

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

ConfiguraçãoPadrãoRestartO que faz
cache_size -2000 (about 2MB) Não 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.

ConfiguraçãoPadrãoRestartO que faz
journal_mode delete Não How SQLite keeps transactions atomic: a rollback journal or a write-ahead log (WAL).
synchronous 2 (FULL) Não 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.

ConfiguraçãoPadrãoRestartO que faz
wal_autocheckpoint 1000 pages Não WAL size, in pages, at which a commit triggers an automatic checkpoint; 0 or less disables it.
journal_size_limit -1 (no limit) Não 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.

ConfiguraçãoPadrãoRestartO que faz
page_size 4096 Não Size of a database page in bytes.
mmap_size 0 (off) Não 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.

ConfiguraçãoPadrãoRestartO que faz
auto_vacuum 0 (NONE) Não Whether free pages are returned to the OS automatically (FULL), on request (INCREMENTAL) or never (NONE).
analysis_limit 0 (no limit) Não Approximate rows ANALYZE examines per index; 0 means all rows.

Query planner

Cost model and plan-shape switches.

ConfiguraçãoPadrãoRestartO que faz
automatic_index 1 (on) Não Let the planner build a temporary index for a join when none exists.

Timeouts

Limits on statements, lock waits and idle sessions.

ConfiguraçãoPadrãoRestartO que faz
busy_timeout 0 Não 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.

ConfiguraçãoPadrãoRestartO que faz
temp_store 0 (DEFAULT, which means file) Não 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.

ConfiguraçãoPadrãoRestartO que faz
foreign_keys 0 (off) Não Enforce FOREIGN KEY constraints.
defer_foreign_keys 0 (off) Não Postpone foreign key checks to COMMIT for the current transaction.
locking_mode NORMAL Não Whether the connection releases file locks after each transaction (NORMAL) or keeps them (EXCLUSIVE).
recursive_triggers 0 (off) Não Allow triggers to fire other triggers recursively, including themselves.

Security & access

Network exposure and features that widen the attack surface.

ConfiguraçãoPadrãoRestartO que faz
secure_delete 0 (off) Não Overwrite deleted content with zeros.
trusted_schema 1 (on) Não 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.