Re: make a unique index for foreign keys?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Beth Gatewood <beth(at)vizxlabs(dot)com>
Cc: "'Christopher Kings-Lynne'" <chriskl(at)familyhealth(dot)com(dot)au>, josh(at)agliodbs(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: make a unique index for foreign keys?
Date: 2002-06-13 16:59:54
Message-ID: 3D08CF8A.D945FC18@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Beth Gatewood wrote:
>
> Chris/ Josh-
>
> OK-response to Chris below. Synopsis here....simply by creating a foreign
> key will not create an index. On large tables I SHOULD put a non-unique
> index on the foreign key (right?)

Right, because on DELETE or UPDATE to the primary key, the
RI triggers have to check that this doesn't leave orphaned
references or do the required referential action (CASCADE).
Sometimes this works faster with an index...

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-06-13 18:01:57 Re: Another postgres 'file not found' error
Previous Message Achilleus Mantzios 2002-06-13 16:30:27 Re: how do i provide array parameters for my functions in php