Re: CHECK constraints in pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CHECK constraints in pg_dump
Date: 2003-02-26 14:54:08
Message-ID: 29444.1046271248@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2003-02-26 17:26:20 Can pessimistic locking be emulated?
Previous Message Tom Lane 2003-02-26 14:48:14 Re: autocommit off mode, how does it work?