Re: Multicolumn foreign keys need useless unique indices?

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Antti Haapala <antti(dot)haapala(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multicolumn foreign keys need useless unique indices?
Date: 2002-09-13 11:27:17
Message-ID: 1031916438.15720.10.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2002-09-13 at 04:27, Christopher Kings-Lynne wrote:
> > AFAIK, the extra index only slows down my inserts - it basically contains
> > no usable information...
>
> Not 100% true. It will speed up cascade delete and update...
>
> > shouldn't the presence of _primary_key_ in
> > multicol foreign key be enough to decide whether the whole key is unique
> > or not?
>
> Hmmm - thinking about it, I don't see why postgres would need the entire
> thing to be unique...can't think of a reason at the moment. Stephen?

If it's not all unique, you cannot be guaranteed there is a single row
with those values in the referenced table.

--
Rod Taylor

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephane Bortzmeyer 2002-09-13 12:06:01 Re: An opportunity to prove PostgreSQL and our requirement of Case Study info [EUreg #11]
Previous Message Shridhar Daithankar 2002-09-13 11:04:51 [OT]Physical sites handling large data