C.W.K.
Stream
Lesson 07 of 10 · published

SQLite vs PostgreSQL vs MySQL

~15 min · sqlite, comparison, postgres, mysql

Level 0Scout
0 XP0/80 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Three databases, three different jobs

The three databases are often discussed as if they're competitors. They're not — they answer different questions.

PropertySQLitePostgreSQLMySQL
ArchitectureIn-process libraryClient/serverClient/server
DeploymentOne fileDaemon + configDaemon + config
Concurrent writersOne at a time (per file)Many, MVCCMany, MVCC
Concurrent readersUnlimited (WAL mode)UnlimitedUnlimited
TypingDynamic (or STRICT 3.37+)Strict, rich typesStrict, fewer types
ReplicationAdd-on (Litestream/LiteFS/Turso)Built-in streamingBuilt-in (binlog)
JSONJSON1 + JSONB (3.45+)JSONB nativeJSON native
Full-text searchFTS5 built-intsvectorFULLTEXT (InnoDB)
Auth modelFile systemRoles + RLSUser accounts
Best fitApp's data layerMulti-tenant systemsWeb app DB tier
Principle: Choose by deployment shape, not by feature checklist. If your data must live where many machines can reach it, you need a server. If your data can live where the code runs, SQLite removes an entire tier of operational concern.

Modern SQLite has closed most of the feature gap with Postgres for app-level workloads — JSON, FTS, window functions, CTEs, generated columns, partial indexes, expression indexes, UPSERT, RETURNING. What it does not close is the multi-writer-across-machines gap, and it does not pretend to.

Code

Same SQL, three different engines·sql
-- All three databases happily run this exact statement
CREATE TABLE users (
  id    INTEGER PRIMARY KEY,
  email TEXT UNIQUE NOT NULL,
  name  TEXT NOT NULL
);

INSERT INTO users(email, name) VALUES ('alice@x.com', 'Alice');

SELECT id, email, name FROM users WHERE name = 'Alice';

-- The differences show up in the deployment story, not the SQL.

External links

Exercise

Write a one-page decision memo: 'should we use SQLite, Postgres, or MySQL for X?' Pick a real or hypothetical service. Decide based on deployment shape (single-machine vs multi-server), write concurrency, replication needs, and operational cost. Defend the choice in three bullet points.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.