X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7E0F7D91C7 for ; Sun, 25 Sep 2005 00:33:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62744-05 for ; Sun, 25 Sep 2005 03:33:09 +0000 (GMT) Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by svr1.postgresql.org (Postfix) with ESMTP id 6CFB6D9534 for ; Sun, 25 Sep 2005 00:33:08 -0300 (ADT) Received: from [192.168.1.11] ([68.239.68.205]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0INC00MAESJ723G4@vms048.mailsrvcs.net> for pgsql-sql@postgresql.org; Sat, 24 Sep 2005 22:33:08 -0500 (CDT) Date: Sat, 24 Sep 2005 23:34:15 -0400 From: Ferindo Middleton Jr Subject: redundancy in CHECK CONSTRAINTs To: pgsql-sql@postgresql.org Reply-To: fmiddleton@verizon.net Message-id: <43361AB7.2020701@verizon.net> Organization: Sleek Collar MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit User-Agent: Thunderbird 1.4 (Windows/20050908) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.4 required=5 tests=[AWL=-0.350, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376] X-Spam-Level: * X-Archive-Number: 200509/245 X-Sequence-Number: 22792 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