Re: Order of enforcement of CHECK constraints? - Mailing list pgsql-hackers

From David Rowley
Subject Re: Order of enforcement of CHECK constraints?
Date
Msg-id CAApHDvqcVW8G8JbjDJS3VsvubR62jYkbSg8VJDb4J9nEdxKBxw@mail.gmail.com
Whole thread Raw
In response to Re: Order of enforcement of CHECK constraints?  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
On 24 March 2015 at 17:51, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote:

In case of million inserts or bulk load with constraints on, these few cycles spent in ordering the constraints might be problematic, unless the ordering happens only once for a series of inserts.

 
As far as I can see this sort only occurs when a new relation is loaded into the relcache. Relations are cached in the relcache when they're accessed for the first time in each backend, and the cache will be invalidated when the current backend or another backend perform DDL on that relation. 

Without relcache we'd need to lookup the system catalogs for just about every SQL statement... This would be very slow indeed! 

Regards

David Rowley

pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Abbreviated keys for Numeric
Next
From: Thom Brown
Date:
Subject: Error with index on unlogged table