Re: Foreign Key Columns And Indices

From: Jan Wieck <janwieck(at)Yahoo(dot)com>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Foreign Key Columns And Indices
Date: 2001-02-06 12:57:45
Message-ID: 200102061257.HAA01022@jupiter.greatbridge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephan Szabo wrote:
>
> On Mon, 5 Feb 2001, Christopher Kings-Lynne wrote:
>
> > Just a quick question, when a column of a table is defined to be a foreign
> > key, is it implicitly indexed, or does one still need to explicitly CREATE
> > INDEX?
>
> The foreign key columns are not currently implicitly indexed but you may
> wish to index them if you're using a referential action other than no
> action or restrict.

You'd probably want to index them either way, because even
"NO ACTION" and "RESTRICT" mean that a scan for existing
references is done on updates/deletes to the PK.

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 #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Ansley 2001-02-06 13:16:06 RE: PL/PGSQL function with parameters
Previous Message Oleg Bartunov 2001-02-06 11:49:42 little bug in current CVS