Re: Multicolumn foreign keys need useless unique indices? - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: Multicolumn foreign keys need useless unique indices?
Date
Msg-id 1031916438.15720.10.camel@jester
Whole thread Raw
In response to Re: Multicolumn foreign keys need useless unique indices?  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: Multicolumn foreign keys need useless unique indices?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: [OT]Physical sites handling large data
Next
From: Tom Lane
Date:
Subject: Re: Multicolumn foreign keys need useless unique indices?