Incident Report: December 8th, 2025
A schema migration adding a nullable column to a ~1 billion row PostgreSQL table stalled behind locks held by a long-running query. Waiting connections piled up until PgBouncer exceeded the database connection limit, so backend replicas failed health checks and dropped out of rotation, taking down the dashboard, CLI, login, GitHub deploys and API for about eight minutes. Running deployments stayed up. Railway plans to raise database connection limits, reconfigure PgBouncer to fit within them, and fix the long-running query.
Related posts
- Incident Report: October 28th, 2025
Railway mediumAdeptA schema migration that added an indexed column to a ~1 billion-row Postgres table without `CREATE INDEX CONCURRENTLY` took an exclusive table lock, queuing nearly all backend API queries and taking down Railway's dashboard, CLI, Public API and GitHub webhook deploys for about 40 minutes. Blocked requests piled up until PgBouncer exceeded Postgres's connection limit, exhausting even reserved administrative slots, so engineers could not connect to kill the index build. The outage ended only when the build finished on its own after roughly 30 minutes. Fixes include a CI check that requires `CONCURRENTLY` for every index creation, PgBouncer pool limits capped below Postgres capacity, and per-user connection limits that keep admin access available.
- Incident Report: September 22nd, 2025
Railway mediumAdeptA schema change removing an unused column was partially reverted by a later code change, breaking a core API and leaving Railway's project canvas stuck loading. After a 15-minute fix, the backlog of queued deployments flooded the Control Plane, whose PgBouncer pooler had been silently upgraded several versions when Railway moved off deprecated Bitnami images. The new version consumed abnormal CPU and memory under load, likely from a changed default configuration. Deployments were shed by tier and the database scaled up, but recovery came only after rolling PgBouncer back, which gave a 100x performance improvement. Follow-ups include CI schema compatibility checks, PgBouncer metrics alerting, phased pooler upgrades, and moving Control Plane storage off Postgres.
- PostgreSQL Stories: A simple query with a big problem
Render mediumAdept
A seemingly simple indexed join with LIMIT 1 ran for over four hours on Render's staging PostgreSQL, holding a lock that blocked CREATE OR REPLACE VIEW migrations and stalled deploys. The team traced it by watching oldest-transaction age, querying pg_stat_activity for long-running active queries, and using pg_blocking_pids() to map which backends blocked which migrations. The culprit was an engineer's ad-hoc psql query: pressing Ctrl+C in psql stopped reading results but left the server-side query running. Killing the backend fixed it immediately. Key lessons are to keep transactions short, because they block locks, autovacuum and risk XID wraparound, and to set application_name and inspect usename so queries can be traced to their source.
- The Postgres mistakes we all still make
Neon mediumAdept
Five common Postgres mistakes all eventually show up as connection pressure: opening a connection per request, appending to JSONB columns, holding transactions open across external API calls, nightly bulk DELETEs, and unused indexes. Each comes with a detection query and a fix. In a pgbench test, per-transaction connects hit 1,415 TPS, PgBouncer 31,524, and persistent connections 215,538. The fixes are to pool connections, move accumulating facts into tables to avoid MVCC bloat, keep only SQL inside transactions using idempotency keys plus idle/transaction timeouts, partition and drop instead of DELETE, and drop unused indexes that slow writes and disable HOT updates.
- Incident Report: April 30th, 2025
Railway mediumAdeptRailway's API backend, which serves the dashboard, CLI, Public GraphQL API and GitHub deploy webhooks, went down for roughly four hours after a batch of Kubernetes configuration changes meant to cut dashboard latency. The changes included a modified healthcheck that no longer checked Postgres liveness, so unhealthy pods kept taking traffic and overloaded the database. The root cause was pgbouncer pods that reported healthy but could not serve traffic because the service mesh failed to inject routing information, breaking DNS resolution. Recovery was slowed by selective rollbacks and needed a full pod cycle even after a complete revert, so Railway now staggers config rollouts with rollback plans, reverts fully at the first sign of trouble, and has removed the service mesh from critical paths in favour of simple load balancers.