To-Do item: skip table scan for adding column with provable check constraints - Mailing list pgsql-hackers

From Jeff Janes
Subject To-Do item: skip table scan for adding column with provable check constraints
Date
Msg-id CAMkU=1z5vXZ8Txd9_8hvNFovtbGuP4VTitFRN59XDncEHVGtJA@mail.gmail.com
Whole thread Raw
Responses Re: To-Do item: skip table scan for adding column with provable check constraints  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: David Christensen
Date:
Subject: Re: [PATCH] Add EXPLAIN (ALL) shorthand
Next
From: "Tsunakawa, Takayuki"
Date:
Subject: Re: foreign table batch inserts