SQLite to Postgres in 6 days: 87GB→38GB, p99 363ms→51ms, 24M rows moved 3 times

JeremyCMorgan · x · 2026-12-01

Agent Swarm co-founder Taras Yarema logs a six-day AI-agent-driven migration from SQLite to PostgreSQL. SQLite was a deliberate early choice (single file, easy deploys), but the database grew to 87 GB, single long statements stalled the API, and every in-process SQLite driver on Bun blocks the event loop. Founders set four rules on one call: keep both engines (DATABASEURL switches, default unchanged), keep raw SQL behind a thin storage interface with no ORM, no phased plan — one goal for the swarm, and all E2E tests must pass on both engines. Results: 24M rows copied three times, production cutover at 01:44 with the first error at 01:46, disk usage 87 GB→38 GB, p99 latency at 5x load 363 ms→51 ms. Surprises included 9,423 stored values Postgres rejected and a hidden 64 MB shared-memory cap in the prod container.

Original post →

More from coding & agent

coding & agent channel →