pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: scott.marlowe <scott.marlowe@ihs.com>
Cc: Sebastien Lemieux <slemieux@elitra.com>
Cc: Postgresql-performance <pgsql-performance@postgresql.org>
Subject: Re: How to efficiently duplicate a whole schema?
Date: Wed, 06 Aug 2003 15:29:23 -0400
Message-ID: <7406.1060198163@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.33.0308061307560.16245-100000@css120.ihs.com>
References: <Pine.LNX.4.33.0308061307560.16245-100000@css120.ihs.com>

"scott.marlowe" <scott.marlowe@ihs.com> 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



view thread (11+ messages)  latest in thread

Message-ID: <7406.1060198163@sss.pgh.pa.us>
Permalink:  ../7406.1060198163@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7406.1060198163@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, scott.marlowe@ihs.com, slemieux@elitra.com
  Subject: Re: How to efficiently duplicate a whole schema?
  In-Reply-To: <7406.1060198163@sss.pgh.pa.us>
  References: <Pine.LNX.4.33.0308061307560.16245-100000@css120.ihs.com> <7406.1060198163@sss.pgh.pa.us>

* 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