I recently had to run something like:
alter table pgbench_accounts add locked text check (locked != 'unlocked');
And was surprised that it took several minutes to complete as it
scanned the whole table.
The new column is going to start out as NULL in every row, so there is
no need to validate the check constraint by reading the table as it
can be proven from first principles. Correct?
Is there a reason such an improvement would be unwanted or not
feasible? If not, I will add as a To-Do item.
Cheers,
Jeff