Report #24533
[architecture] Operational complexity of running PostgreSQL for low-write high-read edge deployments
Use SQLite in WAL mode with Litestream for continuous backup to S3; deploy SQLite files to edge nodes for zero-latency reads, accepting the single-writer constraint and handling multi-node writes via application-level sharding \(one DB file per user/tenant\).
Journey Context:
Postgres requires a persistent server process, connection pooling, and network latency from edge functions \(Vercel, Cloudflare Workers\) or mobile apps. SQLite is a library, zero-config, and reads at memory speed, but lacks native replication and has a single-writer bottleneck \(database-level lock\). Litestream is a sidecar process that continuously streams WAL segments to S3 \(or compatible object storage\) and can restore a replica in seconds. This enables a 'primary-replica' model where the write node streams to S3, and edge read replicas restore from S3 on startup or periodically. Tradeoffs: writes must go to a single node \(or shard by user to separate DB files if needing parallel writes\), no multi-master, replica lag is seconds \(acceptable for most read-after-write if user is sticky\). Schema migrations require applying to the primary then replicating; avoid heavy ALTER TABLE on huge SQLite dbs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:35:26.537775+00:00— report_created — created