X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0327BD1C975 for ; Wed, 6 Aug 2003 19:29:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 68346-04 for ; Wed, 6 Aug 2003 16:28:24 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 0DCE9D1C92F for ; Wed, 6 Aug 2003 16:29:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h76JTOSa007407; Wed, 6 Aug 2003 15:29:24 -0400 (EDT) To: "scott.marlowe" Cc: Sebastien Lemieux , Postgresql-performance Subject: Re: How to efficiently duplicate a whole schema? In-reply-to: References: Comments: In-reply-to "scott.marlowe" message dated "Wed, 06 Aug 2003 13:09:47 -0600" Date: Wed, 06 Aug 2003 15:29:23 -0400 Message-ID: <7406.1060198163@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/110 X-Sequence-Number: 2927 "scott.marlowe" writes: > On Wed, 6 Aug 2003, Tom Lane wrote: >> One obvious question is whether you have your foreign keys set up >> efficiently in the first place. As a rule, the referenced and >> referencing columns should have identical datatypes and both should >> be indexed. (PG will often let you create foreign key constraints >> that don't meet these rules ... but performance will suffer.) > Is this one of those things that should spit out a NOTICE when it happens? > I.e. when a table is created with a references and uses a different type > than the parent, would it be a good idea to issue a "NOTICE: parent and > child fields are not of the same type" I could see doing that for unequal data types, but I'm not sure if it's reasonable to do it for lack of index. Usually you won't have created the referencing column's index yet when you create the FK constraint, so any warning would just be noise. (The referenced column's index *is* checked for, since we require it to be unique.) regards, tom lane