Postgres
Renaming a column without downtime: expand, migrate, contract
ALTER TABLE ... RENAME COLUMN takes a millisecond and breaks every running pod. A step-by-step expand and contract rename in Postgres, with the trigger we use.
Database engineer
Ilse looks after Postgres for a payments team: migrations, indexes, vacuum and the queries nobody wants to own. She writes about EXPLAIN output and schema changes that do not take the site down.
ALTER TABLE ... RENAME COLUMN takes a millisecond and breaks every running pod. A step-by-step expand and contract rename in Postgres, with the trigger we use.
We added an index to fix a 1.2 second query and the plan did not change. Here is how EXPLAIN ANALYZE told us why, and the partial index that worked.
Webhook providers deliver at least once, so your handler will see duplicates. A unique key and one transaction in Postgres make that harmless.