speeding up ALTER ... SET NOT NULL - Mailing list pgsql-general

From Ben Chobot
Subject speeding up ALTER ... SET NOT NULL
Date
Msg-id A09673DF-D000-49CC-A888-5C01360C54CF@silentmedia.com
Whole thread Raw
List pgsql-general
I'm in an unfortunate position of needing to add a unique, not null index to a very large table with heavy churn.
Withouthaving much impact, I can add a NULL column that reads default values from a sequence for new rows, and then do
batchupdates over time to fill in the old values.... but then I hit a big wall of locking when updating that column to
beNOT NULL.  

If I were to make a partial index on my new, sequence-feed column where value is null (concurrently, of course), is
postgressmart enough to use that index when checking existing values for the ALTER command? Or even any index (I'll
haveto make a unique one eventually anyway). 

pgsql-general by date:

Previous
From: Jerry Sievers
Date:
Subject: Re: restoring to different architecture with WAL
Next
From: Ben Chobot
Date:
Subject: Re: Splitting Postgres into Separate Clusters?