← Lessons

quiz vs the machine

Silver1100

Databases

The Embedded Database SQLite

A full SQL engine that runs inside your application, not a server.

4 min read · intro · beat Silver to climb

The Embedded Database SQLite

An embedded database runs as a library linked into your program rather than as a separate server process. SQLite is the most widely deployed example, living inside phones, browsers, and countless desktop apps.

No server, one file

With a client server database your app opens a network connection to a running service. With SQLite there is no service: the engine is code inside your app, and the whole database is a single file on disk.

  • There is no network round trip, so reads are very fast.
  • Setup is trivial since there is nothing to install or run.
  • Backups are as simple as copying the file.

Concurrency tradeoffs

Because it is a file, write concurrency is limited; by default one writer holds a lock at a time. A write ahead log mode lets readers continue while a write proceeds, improving throughput. SQLite shines for single user or read heavy workloads, not high write concurrency across many clients.

Key idea

An embedded database like SQLite links a full SQL engine into your app and stores everything in one file, trading write concurrency for zero setup and local speed.

Check yourself

Answer to earn rating on the learn ladder.

1. How does SQLite differ from a client server database?

2. What is a main limitation of an embedded file based database?