Re: CHECK constraints in pg_dump - Mailing list pgsql-hackers

From Tom Lane
Subject Re: CHECK constraints in pg_dump
Date
Msg-id 29444.1046271248@sss.pgh.pa.us
Whole thread Raw
In response to Re: CHECK constraints in pg_dump  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: CHECK constraints in pg_dump
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: autocommit off mode, how does it work?
Next
From: "Merlin Moncure"
Date:
Subject: Can pessimistic locking be emulated?