You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
SQLite is a self-contained, serverless, zero-configuration, transactional SQL database engine embedded directly into your application. Rather than running as a separate server process, SQLite reads and writes directly to ordinary files on disk. This simplicity makes it the most widely deployed database engine in the world — found in every smartphone, web browser, desktop application, and billions of IoT devices.
Traditional databases like PostgreSQL or MySQL run as a background server daemon. Your application connects to that server over a network socket, authenticates, sends queries, and receives results. SQLite takes a completely different approach: the entire database — tables, indexes, data — lives in a single file on disk. Your application links the SQLite library directly and calls functions to execute SQL. There is no network round-trip, no authentication handshake, and no separate process to manage.
This serverless design has profound implications:
# SQLite databases are everywhere:
# - Every Android and iOS app (via the built-in SQLite library)
# - Firefox, Chrome, and Safari (browser history, bookmarks, cookies)
# - macOS and iOS system daemons
# - Python's standard library (the sqlite3 module ships with Python)
# - Electron desktop apps (VS Code, Slack, Discord all use SQLite internally)
# - Embedded firmware and IoT devices
SQLite is optimised for different workloads than PostgreSQL or MySQL. It excels when:
Client-server databases excel when:
Every SQLite database is stored in a single file using a documented, cross-platform binary format. The file begins with a 100-byte header that identifies it as an SQLite database. The rest of the file is divided into fixed-size pages (default 4 096 bytes). Tables and indexes are stored as B-trees spread across these pages. Because the format is stable and well-documented, SQLite files written today will be readable by software decades from now — the developers consider it a long-term archival format.
Despite its simplicity, SQLite is fully ACID-compliant:
SQLite achieves durability through a write-ahead log (WAL) or a rollback journal written to disk before the main database file is modified.
SQLite is the right choice for local, embedded, single-process storage. Its combination of zero configuration, a portable single-file format, full SQL support, and ACID guarantees makes it uniquely suited to the scenarios where it dominates. Understanding when to use SQLite versus a client-server database is the foundation of choosing the right tool for any project.