One Alter Two Outcomes
orders holds 412 million rows. Two migrations ship in the same release against PostgreSQL:
-- A
ALTER TABLE orders ADD COLUMN currency text NOT NULL DEFAULT 'USD';
-- B
ALTER TABLE orders ADD COLUMN imported_at timestamptz NOT NULL DEFAULT clock_timestamp();
A returned in 12 ms. B has held ACCESS EXCLUSIVE for forty minutes and every query against orders is queued behind it. What is different about B?
Sign in to answer questions and track your progress
Sign In