postgres migration adding a column with a default locks the table
Postgres 15. We ran a migration: ALTER TABLE events ADD COLUMN processed boolean NOT NULL DEFAULT false; on a 50M row table and it locked writes for several minutes. I thought adding a column with a default was fast in modern Postgres. What changed? I want to understand what changed before we run this migration on the larger tables again.
4 replies