{"post":{"slug":"postgres-vs-sqlite-2026","title":"Postgres vs SQLite in 2026: the honest comparison for real projects","excerpt":"SQLite is no longer just for embedded devices — it runs production web apps at scale. Here is when to choose it over Postgres in 2026.","category":"code","date":"March 19, 2026","author":"ByteLedger Team","content":"<span class=\"dropcap\">T</span>he conventional wisdom was simple: SQLite for local dev and testing, Postgres for everything real. That line blurred significantly in 2025–2026. SQLite grew up — WAL mode, strict mode, and a wave of hosted services like Turso turned it into a credible production choice for a much wider range of applications. The question is no longer \"when do you graduate from SQLite to Postgres\" but \"which one actually fits your workload?\"\n\n## What changed in 2026\n\n- **SQLite WAL mode is now the default in most wrappers**, delivering much better concurrent read performance — easily 5–10× better than the old journal mode.\n- **Turso (libSQL fork) offers multi-region SQLite replicas** with a synchronization model, making the \"one file per region\" edge architecture viable.\n- **Cloudflare D1 hit general availability** with point-in-time recovery and larger storage limits, removing the main complaints from 2024.\n- **Postgres 17 improved logical replication** and added more JSONB operators; pgvector 0.7 landed HNSW index improvements that make it the default vector store for many AI stacks.\n- **The \"SQLite in production\" discourse peaked** — DHH and the Basecamp team published detailed performance numbers that made the community take SQLite more seriously.\n\n## Architecture differences\n\nSQLite is a **serverless, embedded database**: the library and the data file live inside the process. There is no separate DB server, no network round-trip, no connection pool to manage. This simplicity is both its greatest strength and its hard ceiling.\n\nPostgres is a **client-server database**: a separate process manages data, handles concurrent clients, enforces roles, and exposes a TCP socket. The network hop costs microseconds but buys you everything that requires coordination.\n\n## Head-to-head comparison\n\n| Factor | SQLite 3.47 (WAL) | Postgres 17 |\n| --- | --- | --- |\n| Concurrent reads | High (WAL, many readers) | Very high |\n| Concurrent writes | Low (single writer) | High (MVCC) |\n| Network latency | Zero (in-process) | ~0.1–1 ms local |\n| Replication | Turso/Litestream | Native logical/streaming |\n| Full-text search | FTS5 | tsvector + pg_trgm |\n| Vector search | sqlite-vss (limited) | pgvector (HNSW, IVFFlat) |\n| JSON | JSON1 extension | JSONB (indexed, operators) |\n| Extensions | C extensions only | Rich ecosystem (PostGIS, etc.) |\n| Managed hosting cost | ~$0–$30/mo (Turso free tier) | ~$20–$100+/mo |\n| Multi-region | Turso replicas | Read replicas, Citus |\n\n## When SQLite is the right choice\n\n- **Single-writer web apps** — blogs, portfolios, internal tools, SaaS with sequential writes.\n- **Edge and serverless** — Cloudflare D1 / Turso give you a database with zero cold-start and minimal latency at the edge.\n- **Multi-tenant apps where each tenant gets their own DB** — one SQLite file per tenant, trivially backed up with Litestream.\n- **Local-first apps** — SQLite is the database of the device; no network required.\n\n```python\n# Litestream continuous backup to S3 — a single config line\n# litestream.yml\ndbs:\n  - path: /data/app.db\n    replicas:\n      - url: s3://my-bucket/app.db\n```\n\n## When Postgres is the right choice\n\n- **High write concurrency** — SQLite serializes all writes; Postgres MVCC handles hundreds of concurrent writers.\n- **AI / vector workloads** — pgvector with HNSW indexes is the production standard; sqlite-vss lags.\n- **Complex queries and analytics** — window functions, CTEs, and JSONB operators are more capable in Postgres.\n- **Multi-region with strong consistency** — Postgres streaming replication with failover is battle-tested.\n- **Team of multiple engineers** — roles, row-level security, and audit logging are first-class in Postgres.\n\n```sql\n-- pgvector similarity search with HNSW index (Postgres 17)\nCREATE INDEX ON documents\n  USING hnsw (embedding vector_cosine_ops)\n  WITH (m = 16, ef_construction = 64);\n\nSELECT id, content\nFROM documents\nORDER BY embedding <=> '[0.12, 0.34, ...]'::vector\nLIMIT 10;\n```\n\n## How to pick\n\n1. **Single writer, low ops budget, edge deployment?** → SQLite + Turso or D1.\n2. **Multiple concurrent writers or background jobs?** → Postgres.\n3. **Need pgvector for AI?** → Postgres, no contest.\n4. **Multi-tenant SaaS with per-tenant isolation?** → SQLite per tenant is a great fit.\n5. **Already on Postgres?** → Stay there; migration cost never pays back unless you're hitting hard limits.\n\n## Common mistakes\n\n**Benchmarking SQLite without WAL mode.** The old default (DELETE journal) serializes reads and writes. Always enable WAL before comparing: `PRAGMA journal_mode=WAL;`.\n\n**Using SQLite on a network file system.** File locking is not reliable over NFS or most cloud shared storage. SQLite must live on local disk or in-memory.\n\n**Postgres overkill for a static site.** If your CMS has 500 posts and 10 writes per day, you are paying for connection poolers, PgBouncer, and read replicas that will never carry load.\n\n**Ignoring Litestream.** SQLite without a replication / backup solution is a data loss risk. Litestream is free, trivial to configure, and streams WAL frames to S3 in near-real-time.\n\n## What to skip\n\n- **SQLite for a multi-writer job queue** — advisory locks and `SELECT FOR UPDATE` are Postgres features; you will re-implement them poorly.\n- **Postgres on a $5 VPS for a hobby project** — the memory overhead of a Postgres instance with a connection pool is real; SQLite costs nothing.\n- **\"Hybrid\" setups** where you write to SQLite and sync to Postgres — the sync logic becomes the hardest part of the system.\n\n## FAQ\n\n**Is SQLite actually safe for production?**\nYes, for single-writer workloads. WhatsApp used SQLite as its message store for years. The risks are well-understood: concurrent writes and network-mounted files.\n\n**What about PlanetScale or Neon in 2026?**\nBoth are serverless Postgres. They eliminate operational overhead but add latency and cost at scale. Good middle ground for teams that want Postgres without running a server.\n\n**Can I use SQLite with an ORM?**\nYes — Drizzle, Prisma, and SQLAlchemy all support SQLite. Drizzle is especially clean with `better-sqlite3` for synchronous queries.\n\n**How do I migrate from SQLite to Postgres later?**\n`pgloader` handles most schemas automatically. The main gotchas are strict type casting and `AUTOINCREMENT` vs `SERIAL` semantics.\n\n## Where to go next\n\n- [How to set up a database in 2026](/blog/how-to-set-up-a-database-2026)\n- [How to design a database schema in 2026](/blog/how-to-design-a-database-schema-2026)\n- [Prisma vs Drizzle in 2026](/blog/prisma-vs-drizzle-2026)","hue":312,"metaTitle":"Postgres vs SQLite 2026: Which Database to Choose","metaDescription":"Honest 2026 guide to Postgres vs SQLite. Concurrency, edge deployments, pgvector, and which database fits your actual workload.","keywords":["postgres vs sqlite 2026","sqlite production 2026","postgresql vs sqlite comparison","turso sqlite edge 2026","cloudflare d1 sqlite","pgvector postgres 2026","sqlite wal mode performance","postgres jsonb vs sqlite json","embedded database 2026","database choice for startups 2026"],"tldr":["**SQLite 3.45+ with WAL mode handles thousands of reads/second** — more than enough for most startups and side projects.","**Postgres wins on write concurrency, rich types, and horizontal scale** — any multi-writer or multi-region workload should still use Postgres.","**Turso and Cloudflare D1 bring SQLite to the edge in 2026** — a single SQLite file per tenant is now a legitimate architecture.","**Postgres has pgvector, logical replication, and full JSONB** — features that have no SQLite equivalent for AI and analytics workloads.","**Skip:** choosing Postgres \"for when you scale\" when your app has 200 users and a single writer — you are buying ops complexity you will not need."],"readTime":"5 min read","wordCount":1022},"related":[{"slug":"mongodb-vs-postgres-2026","title":"MongoDB vs Postgres in 2026: which database should you choose?","excerpt":"MongoDB and Postgres have both grown toward each other, but the architectural tradeoffs remain real. Here is the honest 2026 guide to picking the right one.","category":"code","date":"April 7, 2026","author":"ByteLedger Team","readTime":"5 min read","hue":314},{"slug":"sqlite-vs-postgres-2026","title":"SQLite vs Postgres in 2026: which database should you use?","excerpt":"SQLite is a simple file-based database for small apps and prototypes; Postgres is a full server for production. Here is an honest comparison and a clear pick.","category":"code","date":"June 17, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":195},{"slug":"postgres-vs-mysql-2026","title":"PostgreSQL vs MySQL in 2026: which relational database to pick","excerpt":"Both are excellent and both will outlive your startup. The real differences in 2026 are features, extensions, and ecosystem — here is how to choose.","category":"code","date":"February 16, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":308}],"sameCategory":[{"slug":"bazel-build-explained-2026","title":"Bazel Explained: What Hermetic Builds Actually Cost","excerpt":"Bazel delivers reproducible, precisely cached builds and demands that you describe everything. Here is what you get, what it costs, and who should say no.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":145},{"slug":"graphql-federation-2026","title":"GraphQL Federation: One Graph, Many Teams","excerpt":"Federation composes independently-owned subgraphs into a single API. Here is what it solves, the operational cost it adds, and when a simpler gateway is enough.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":300},{"slug":"hermetic-builds-explained-2026","title":"Hermetic Builds Explained: Same Inputs, Same Output","excerpt":"A hermetic build depends only on declared inputs. Here is what that property gives you, the common leaks that break it, and how to move toward it incrementally.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":130},{"slug":"monorepo-tooling-compared-2026","title":"Monorepo Tooling Compared: What You Actually Need","excerpt":"Monorepo tools solve task orchestration and caching, not repository layout. Here is what each tier provides and how to tell when you have outgrown the simple option.","category":"code","date":"August 19, 2026","author":"ByteLedger Team","readTime":"3 min read","hue":150}],"newer":{"slug":"pnpm-vs-yarn-2026","title":"pnpm vs Yarn in 2026: which JavaScript package manager should you use?","excerpt":"pnpm and Yarn Classic both manage Node.js dependencies, but they take very different approaches to disk usage, speed, and monorepo support.","category":"code","date":"March 19, 2026","author":"ByteLedger Team","readTime":"5 min read","hue":310},"older":{"slug":"promises-explained-2026","title":"Promises explained in 2026: states, chaining, and error handling","excerpt":"Promises replaced callback hell and underpin every async JavaScript API. Here is how they work, how to chain them correctly, and where they still trip people up.","category":"code","date":"March 19, 2026","author":"ByteLedger Team","readTime":"5 min read","hue":318}}