X-Original-To: pgsql-performance@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 150134764D7 for ; Wed, 14 May 2003 20:02:05 -0400 (EDT) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with ESMTP id 71252-07 for ; Wed, 14 May 2003 20:02:03 -0400 (EDT) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by postgresql.org (Postfix) with ESMTP id 5B28E4764AD for ; Wed, 14 May 2003 20:02:02 -0400 (EDT) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id KAA16022 for ; Thu, 15 May 2003 10:11:30 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3EC2DA46.4070105@oasis.net.au> Date: Thu, 15 May 2003 10:07:34 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: Postgres Performance Subject: Re: constraint with reference to the same table References: <20030514162559.O51040-100000@megazone23.bigpanda.com> <3EC2D7D5.1010404@oasis.net.au> In-Reply-To: <3EC2D7D5.1010404@oasis.net.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/159 X-Sequence-Number: 1938 Hi, Oops - sorry I made a typo on those 2 index's. Wrong: CREATE INDEX business_idx ON business_businesstype (business); CREATE INDEX businesstype_idx ON business_businesstype (businesstype); Right: CREATE INDEX business_idx ON business_businesstype (b_id); CREATE INDEX businesstype_idx ON business_businesstype (bt_id); The table: CREATE TABLE business_businesstype ( b_bt_id serial PRIMARY KEY, b_id integer REFERENCES business ON UPDATE CASCADE ON DELETE CASCADE NOT NULL, bt_id integer REFERENCES businesstype ON UPDATE CASCADE ON DELETE CASCADE NOT NULL ); Thanks Regards Rudi.