Orofold Labs

Launching soon

Notes Get in touch

Engineering 4 min read Updated

SQLite in production (WAL) for B2B tools vs. Postgres

In short

For single-node B2B portals and internal tools with moderate write volume, SQLite in WAL mode eliminates database network hops and ops overhead; switch to PostgreSQL once multi-node writes or heavy write concurrency appear.

Many internal portals, partner dashboards, and B2B back-office tools run on a single application server yet carry the operational weight of a separate database cluster. When configured properly in Write-Ahead Logging (WAL) mode, SQLite often delivers lower read latency and far simpler operations than PostgreSQL—until specific architectural limits are crossed.

Why WAL mode makes SQLite viable in production

In its legacy rollback-journal mode, SQLite blocks readers while a write commits and blocks writers while reads are active. Enabling Write-Ahead Logging (WAL) changes that concurrency model: readers do not block writers, and a writer does not block readers. Changes append to a separate WAL file and are periodically merged back into the main database via checkpointing.

Because SQLite runs inside the application process rather than over a TCP socket, there is zero network round-trip per query. That makes multi-query page rendering—common in permission checks and B2B tables—remarkably fast, provided your schema has proper database indexes.

Where SQLite beats PostgreSQL

As noted in the SQLite Appropriate Uses guide, embedded local storage shines when simplicity and read speed matter most:

  • Zero separate server to patch or pool: No connection poolers, no daemon memory tuning, and no TCP authentication surface between app and database.
  • Predictable read performance: Local memory-mapped reads eliminate network jitter on complex joins and admin filters.
  • Trivial staging and backups: Replicating a production snapshot for debugging or running consistent online backups takes a single atomic backup command.

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

SQLite (WAL) vs. PostgreSQL for B2B workloads

DimensionSQLite in WAL modePostgreSQL
Write concurrencySingle writer at a time; fast when transactions stay shortRow-level MVCC locking supports many concurrent writers
Deployment topologySingle host with local NVMe or SSD storageDedicated DB server supporting multiple app nodes
Query network latencyZero; in-process function callsNetwork round-trip per statement over TCP or Unix socket
Operational footprintMinimal; single database file plus WALRequires connection pooling, vacuum tuning, and daemon ops
Access controlEnforced by the application layerGranular database roles, row-level security, and schemas

Hard limits where PostgreSQL wins

SQLite is not a universal replacement for a client-server database. Move to PostgreSQL’s MVCC architecture as soon as your workload hits any of these structural boundaries:

  1. Multiple application nodes: SQLite cannot safely share a writable file over NFS or network mounts because WAL relies on local POSIX locks and shared memory. Horizontal scaling across several web servers requires a networked database.
  2. Heavy concurrent writes: If background workers, webhooks, and users all write continuously for long transactions, the single-writer lock becomes a queue bottleneck and triggers busy timeouts.
  3. Long-running analytics inside the write path: Unbounded read transactions can delay WAL checkpointing, causing the WAL file to grow until reads finish and slowing subsequent reads.
  4. Strict database-level isolation: When compliance or multi-team workflows require per-role database permissions, row-level security policies, or extensions such as PostGIS, PostgreSQL provides those primitives natively.

Before migrating prematurely, verify whether write contention is simply caused by overly broad transactions or missing indexes; batching writes inside short transactions often keeps SQLite fast well beyond initial expectations. For a broader comparison including MySQL, see SQLite or MySQL.

In production SQLite, always enable WAL mode, configure a sensible busy timeout, keep write transactions short, and test backup restoration regularly. Treat the database file as local-disk-only state.

Production checklist

Common questions

What does WAL mode change for SQLite concurrency in production?
Write-Ahead Logging allows concurrent readers to proceed without blocking the single active writer, and lets writes commit without waiting on active read transactions.
Can SQLite run safely on a shared network filesystem like NFS?
No. SQLite relies on reliable POSIX file locking and memory-mapped shared state in WAL mode, which network filesystems frequently break; keep the database file on local disk.
When should a B2B tool choose PostgreSQL over SQLite?
Choose PostgreSQL when you need multiple application servers writing to one database, high concurrent write throughput, fine-grained role permissions, or specialised extensions.

Sources

  1. Write-Ahead Logging, SQLite Documentation. Accessed 24 November 2026
  2. Appropriate Uses For SQLite, SQLite Documentation. Accessed 24 November 2026
  3. PostgreSQL Concurrency Control, PostgreSQL Documentation. Accessed 24 November 2026

Further reading

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