SQLite basics: choose when an embedded database fits
SQLite is an embedded relational database that runs inside an application's process instead of as a separate database server. It usually stores data in one local file, which keeps setup simple, and it supports transactions. However, only one write transaction can run against a database file at a time. If many computers need to write directly to the same network-hosted file, or the service needs high write concurrency, consider a client/server DBMS. This guide uses official SQLite documentation reviewed on 23 November 2026 to explain the trade-offs and basic concurrency model.
What does “serverless” mean for SQLite?
Typical client/server databases such as PostgreSQL or MySQL run a separate server process that accepts connections and executes SQL. SQLite has no intermediary database-server process. The application process that issues SQL includes the SQLite library and reads and writes the database file through the operating system's filesystem. Here, “serverless” means that the database engine runs in the same process as the application; it does not mean that a managed cloud database merely hides its servers. SQLite is serverless
This design removes a separate server installation, service lifecycle, and network connection management. An application opens a database file and runs SQL. A single file can also be convenient to move or retain. But processes that can access the file invoke the engine directly; there is no central database server between clients and the file to enforce connection and access policies. File permissions and backup procedures still need to be managed by the application and operating system.
When is SQLite a good fit?
SQLite is especially suitable for data stored close to an application or device: a desktop application's document, offline data on a phone, settings or state on a small device, a local cache, or test and teaching data. In these cases, the application issuing SQL and the data are on the same device. A database file can also act as a portable data container. Copying a file while it is actively changing does not automatically ensure a consistent backup, so use SQLite's backup API or another backup procedure that the application has verified. Appropriate uses for SQLite
Choose based on where the data and SQL-running code live, write contention, and operational needs—not on a single traffic number.
| Situation | SQLite is more likely to fit when | Consider client/server when |
|---|---|---|
| Desktop or mobile app | Data is on the same device and separated per device | Many app instances need direct access to a shared remote file |
| Web application | One app server uses a local database file and writes are short and infrequent | Several web servers share data or write requests overlap often |
| Offline capability | A device reads and writes without a network and syncs later through app logic | The server must coordinate shared data and user permissions centrally |
| Data and operations | A single-file backup and recovery process is manageable | File size, failure domains, centralized operations, or administration are more demanding |
SQLite's guidance warns about latency and locking implementations on network filesystems and recommends against simultaneous direct access to one database file from many networked computers. If data is on a separate server or many clients write at once, a client/server DBMS can coordinate access centrally. Conversely, a web app does not have to reject SQLite just because it has many end users if its application server and database file share a host and the app mediates access. Check actual write patterns and filesystem behavior. Choosing the right database engine
How do transactions protect file-based data?
SQLite implements ACID transactions. Changes in one transaction appear to happen completely or not at all; SQLite's documentation describes atomic commits even across application crashes, operating-system crashes, and power failures. In the traditional rollback-journal mode, SQLite keeps information needed to restore the original database. In write-ahead logging (WAL) mode, it first appends changes to a separate log file and later transfers them to the main database file during a checkpoint. SQLite is transactional · Isolation in SQLite
The following illustrative example can be run in the sqlite3 shell, but it was not run for this article.
CREATE TABLE IF NOT EXISTS inventory (
product_id INTEGER PRIMARY KEY,
quantity INTEGER NOT NULL CHECK (quantity >= 0)
);
BEGIN IMMEDIATE;
UPDATE inventory
SET quantity = quantity - 1
WHERE product_id = 42 AND quantity > 0;
-- The application must verify that exactly one row changed before inserting an order.
COMMIT;BEGIN IMMEDIATE requests a write transaction up front, avoiding a later read-to-write upgrade conflict in some workflows. It can still return SQLITE_BUSY if another writer is active. Keep transactions short and use a bounded wait-and-retry policy rather than retrying indefinitely. If the update affects zero rows, the product is absent or the stock condition failed; the application must not add the order. It should end the transaction appropriately and report the stock problem. The SQL comments do not supply this application-side checking and error handling, so do not treat the snippet as a complete production procedure. SQLite transactions
How does WAL change concurrency?
In rollback-journal mode, reads from other connections may be paused briefly while a write is applied to the database file. WAL mode leaves the original database file in place and appends changes to a -wal file. Readers can use a consistent older snapshot while the writer appends changes. A checkpoint later transfers committed log content into the main file. WAL can therefore let reads and a write overlap, but each database still has only one writer at a time; writers take turns. WAL operation and limits · SQLite isolation
WAL requires the participating processes to run on the same host and does not work over a network filesystem. Do not assume that copying only the database file while ignoring -wal, -shm, or checkpoint state is a safe backup. WAL can create companion files like these:
PRAGMA journal_mode = WAL;This is an example, not a recommendation to enable WAL in every application. First confirm that all file users run on the same host, the backup process supports WAL, and long-running read transactions will not interfere with checkpointing. WAL's better read/write overlap does not provide the multi-writer model of a server database.
When should you move from SQLite to another DBMS?
Compare client/server systems when an operational requirement makes one of these conditions important:
Multiple application servers on different hosts must share the same central data directly.
Write transactions often collide, and serialized writers cause repeated latency or `SQLITE_BUSY` errors.
You need server-side user authentication and authorization, central connection management, replication, or high-availability operations.
Distributing, retaining, and recovering one database file no longer fits the failure-recovery or growth plan.
Migration is more than copying a file into another database product. Validate SQL syntax, data types, indexes and constraints, transaction boundaries, concurrency assumptions, backup, and recovery on the target. Measure the real read/write pattern, then test representative queries and recovery steps. SQLite may remain useful as a local cache or offline store synchronized explicitly with a central database, but the application must define conflict resolution and synchronization. This article does not perform a migration or measure performance.
Scope and sources
This conceptual selection guide is based on official SQLite documentation about its serverless model, appropriate uses, transactions, isolation, and WAL, reviewed on 23 November 2026. Installation, language-specific libraries, full schema design, and a production migration are outside scope. SQL is illustrative and was not executed or benchmarked.
[SQLite is serverless](https://www.sqlite.org/serverless.html)
[Appropriate uses for SQLite](https://www.sqlite.org/whentouse.html)
[SQLite is transactional](https://www.sqlite.org/transactional.html)
[SQLite transactions](https://www.sqlite.org/lang_transaction.html)
[Isolation in SQLite](https://www.sqlite.org/isolation.html)
[Write-Ahead Logging](https://www.sqlite.org/wal.html)