Orofold Labs

Launching soon

Notes Get in touch

Engineering 4 min read Updated

SQLite or MySQL for a small product

In short

Choose SQLite when one application on one host reads and writes the data and writers can take turns; choose MySQL when many machines or simultaneous writers share it.

A small product needs a database, and the choice is often made out of habit. SQLite and MySQL solve different problems, so the question is not which one is better but which one fits the product. SQLite is a library that keeps a database in a single file close to the application. MySQL is a server that many clients reach over a network. Concurrency and backups do most of the deciding. The advice relies on the SQLite project’s guidance on when to use SQLite and on its write-ahead logging documentation.

SQLite suits storage close to the application

The SQLite project designs the library for storage that is local to an application or device. Its guidance lists several good fits, including embedded devices, desktop tools that use SQLite as their file format, caches, archives and test data. For websites, it says that a site with fewer than 100,000 hits a day should work fine with SQLite. It also notes that server-side storage behind an application server can be faster than a client/server engine. That figure describes traffic, not writes, so check write volume separately.

Choose client/server for shared data and writes

The same guidance points to a client/server database in four situations:

  • Many computers access the same database directly over a network. SQLite’s advice is to avoid this, because network file systems add latency and their file locking can be unreliable, which risks corruption.
  • The site is write-intensive, or busy enough to need several servers.
  • The data approaches terabyte scale, or cannot sensibly sit in one file. SQLite’s stated maximum is 281 terabytes.
  • Many writers must write at the same instant and cannot take turns.

If the product needs any of these, a client/server database such as MySQL is the safer choice. The sources do not give a threshold for switching, so treat the first queueing of writes as the signal to measure, not as a fixed rule.

Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea

Concurrency: many readers, one writer at a time

SQLite allows any number of simultaneous readers, but only one writer at any instant. In practice, writers queue. Each write transaction takes only milliseconds, so a small application with modest write volume rarely notices. Write-ahead logging (WAL) changes the picture for readers: readers and writers can run at the same time, and each reader sees a consistent snapshot. Writers are still one at a time.

Two WAL conditions are worth knowing before you enable it. All processes using the database must be on the same host, because WAL does not work over a network file system. A long-running read can also stop a checkpoint from finishing, so the WAL file can grow. By default SQLite checkpoints when the WAL reaches 1000 pages, and you can change that setting.

Back up the database together with its WAL file

The WAL file is part of the database’s persistent state. If you copy the database file without its WAL file, committed transactions may be lost, or the copy may be corrupted. Keep the two together when you move data. Do not delete a leftover WAL file by hand: the SQLite page says the only safe removal is to open the database with the library and close it again.

A backup counts only once you have restored it. The steps for testing restores are covered in backups you can actually restore. Whichever engine you choose, the queries need the same care, as explained in preventing SQL injection.

A decision checklist

Work through these questions in order:

  1. Is the data separated from the application by a network? If yes, choose client/server. An application server on the same machine as the data may still suit SQLite.
  2. Do many writers need to write at the same moment, unable to queue? If yes, choose client/server.
  3. Could the data approach terabyte scale, or outgrow one file? If yes, choose client/server.
  4. Otherwise, for storage local to the device with low writer concurrency and well under a terabyte of content, SQLite is usually the better fit.

Record the answers and the date. If the answers change, for example when a second server is added, the decision should be reopened rather than assumed. For production configuration details, see SQLite in production for B2B tools.

This article relies on two SQLite project pages. The figures quoted, including the 100,000 hits a day and the 281 terabyte limit, are the ones those pages state. Where the text reasons beyond them, it says so.

Sources and limits

Common questions

Is SQLite fine for a website with modest traffic?
The SQLite project says a site with fewer than 100,000 hits a day should work fine with SQLite. It adds that write-intensive sites, or sites that need several servers, should consider a client/server engine.
How many writers can SQLite handle at once?
SQLite allows unlimited simultaneous readers but only one writer at any instant. Writers queue, and each write transaction takes only milliseconds.
Can I back up only the database file?
Not when WAL is in use. The WAL file is part of the persistent state of the database. If it is separated from the database file, committed transactions might be lost or the database might be corrupted.

Sources

  1. Appropriate Uses For SQLite, SQLite (sqlite.org). Accessed 24 November 2026
  2. Write-Ahead Logging, SQLite (sqlite.org). Accessed 24 November 2026

Further reading

  • Backups you can actually restore

    A backup counts only once you have restored from it, so follow the 3-2-1 rule, keep one copy disconnected and test restores on a schedule.

  • Preventing SQL injection with prepared statements

    Send every user-supplied value to the database as a bound parameter, take table names and sort orders from fixed lists, and give the application only the rights it needs.

  • SaaS architecture for small B2B teams

    A small B2B SaaS rarely needs microservices, but it cannot cut corners on tenant isolation, server-side roles, idempotent billing state and clean onboarding.

Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea

All notes