"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> Why would there be any speed advantage?
> Is it not faster to add it when all the data is there, rather than
> evaluating it as each row is inserted, like indexes?
I don't see why. There are good algorithmic reasons why bulk-loading
an index is faster than retail insertions --- mainly that btree goes
out of its way to make it so, with a special code path. But I see
no reason why checking a constraint expression is going to be any
faster as a post-pass than when done while loading the data. If
anything, I'd guess it to be slower because you have to re-read the
table.
regards, tom lane