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_%';
No setting matched. Try a topic such as memory, log or timeout.
Memoria
Caches, per-query work memory and the ceiling on what the server takes from the OS.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
cache_size |
-2000 (about 2MB) |
No | 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.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
journal_mode |
delete |
No | How SQLite keeps transactions atomic: a rollback journal or a write-ahead log (WAL). |
synchronous |
2 (FULL) |
No | 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.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
wal_autocheckpoint |
1000 pages |
No | WAL size, in pages, at which a commit triggers an automatic checkpoint; 0 or less disables it. |
journal_size_limit |
-1 (no limit) |
No | 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.
Vacuum, statistics & maintenance
Background cleanup and the statistics the planner relies on.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
auto_vacuum |
0 (NONE) |
No | Whether free pages are returned to the OS automatically (FULL), on request (INCREMENTAL) or never (NONE). |
analysis_limit |
0 (no limit) |
No | Approximate rows ANALYZE examines per index; 0 means all rows. |
Query planner
Cost model and plan-shape switches.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
automatic_index |
1 (on) |
No | Let the planner build a temporary index for a join when none exists. |
Timeouts
Limits on statements, lock waits and idle sessions.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
busy_timeout |
0 |
No | 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.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
temp_store |
0 (DEFAULT, which means file) |
No | 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.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
foreign_keys |
0 (off) |
No | Enforce FOREIGN KEY constraints. |
defer_foreign_keys |
0 (off) |
No | Postpone foreign key checks to COMMIT for the current transaction. |
locking_mode |
NORMAL |
No | Whether the connection releases file locks after each transaction (NORMAL) or keeps them (EXCLUSIVE). |
recursive_triggers |
0 (off) |
No | Allow triggers to fire other triggers recursively, including themselves. |
Security & access
Network exposure and features that widen the attack surface.
| Ajuste | Predeterminado | Restart | Lo que hace |
|---|---|---|---|
secure_delete |
0 (off) |
No | Overwrite deleted content with zeros. |
trusted_schema |
1 (on) |
No | 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.
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.