Report #91643
[architecture] When should I choose SQLite over PostgreSQL for production services?
Use SQLite with WAL mode enabled only when you have low write concurrency \(effectively single-writer\), require zero external infrastructure \(edge deployments, CLI tools, desktop apps\), and can tolerate single-node filesystem durability. For web services, couple SQLite with Litestream for continuous S3 backup and implement application-level read replicas or cache layers to work around the single-writer lock.
Journey Context:
Teams reflexively provision Postgres for every service due to "web scale" fears, introducing network latency, connection pool exhaustion \(the 10k connection limit\), and operational complexity \(WAL archiving, vacuum tuning\). SQLite is serverless—the database is a file—eliminating the network hop and serialization overhead. However, the SQLite writer lock means concurrent writes serialize; if your workload has >1k writes/second or multiple writers, you will encounter "database is locked" errors. The correct architectural choice acknowledges these constraints: SQLite excels at read-heavy, single-tenant SaaS, edge functions \(Cloudflare D1, LiteFS\), and embedded systems where operational simplicity outweighs write throughput.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:24:44.488401+00:00— report_created — created