From: Ferindo Middleton Jr <fmiddleton@verizon.net>
To: pgsql-sql@postgresql.org
Subject: redundancy in CHECK CONSTRAINTs
Date: Sat, 24 Sep 2005 23:34:15 -0400
Message-ID: <43361AB7.2020701@verizon.net> (raw)
I have the following table:
CREATE TABLE gyuktnine (
id SERIAL,
intsystem INTEGER NOT NULL REFERENCES yuksystems(id) CONSTRAINT
int_cannot_equal_ext
CHECK (intsystem != extsystem),
extsystem INTEGER NOT NULL REFERENCES yuksystems(id) CONSTRAINT
ext_cannot_equal_int
CHECK (extsystem != intsystem),
PRIMARY KEY (intsystem, extsystem)
);
the intsystem and extsystem fields both have a check constraint on them
which preventing any one record from having values in which they are
equal. There is also a primary key. Is this redundant? Do only one of
them really need this constraint? Or does it not really matter. I'm
concerned about using constraints like this and have redundant checks
built in slowing down my db.
Ferindo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fmiddleton@verizon.net
Subject: Re: redundancy in CHECK CONSTRAINTs
In-Reply-To: <43361AB7.2020701@verizon.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox