Skip to content
Navigation

Type at least two characters. Search covers page titles, headings, tags and database names.

↑ ↓ to navigateEnter to openEsc to close0 pages
Embeddedbeginner

SQLite

In-process relational engine storing an entire database in a single file, with WAL journaling and no server to operate.

2 min readBeginnerUpdated Edit this page

What it is

A relational database implemented as a library that runs inside the application process. No server, no network protocol, no configuration file — the entire database is one file. It is in the public domain and is almost certainly the most widely deployed database in existence.

Architecture

B-trees in fixed-size pages within a single file, with either a rollback journal or a write-ahead log. In WAL mode readers do not block the writer and the writer does not block readers, but there is still exactly one writer at a time.

Best use cases

  • Application-local storage: desktop, mobile, browser, embedded devices.
  • Edge deployments where running a server is impractical.
  • Read-heavy web services with a single writer — more viable than its reputation suggests.
  • As an application file format: transactional, queryable and self-describing.
  • Test fixtures, where an in-memory database gives fast isolated tests.

When not to use it

  • Sustained concurrent writes from many clients.
  • Any deployment requiring access from more than one host.
  • Anything needing replication or built-in access control.

Data model

Standard SQL with dynamic typing by default; STRICT tables (3.37+) enforce column types. Full-text search is available through the FTS5 extension.

Consistency and transactions

Fully ACID. Three transaction types — deferred, immediate and exclusive — where the choice matters: a read-then-write transaction must use BEGIN IMMEDIATE, or a lock upgrade can fail with SQLITE_BUSY that no busy timeout resolves.

Scaling model

Vertical only, and further than expected: with WAL mode and appropriate pragmas, SQLite serves substantial read traffic. Write throughput is bounded by the single-writer model.

Replication

None in core SQLite. Third-party projects provide it; treat any such arrangement as a dependency to evaluate on its own terms.

Backup and recovery

The backup API or the .backup command, both of which take a consistent copy of a live database. A text dump is portable across versions.

Monitoring

Nothing reports on an embedded database unless the application does. Emit file size, query duration, SQLITE_BUSY counts, integrity check results and backup age from the application itself.

Common mistakes

Production checklist

See Production Considerations.