Re: [PERFORM] Indexing foreign keys

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [PERFORM] Indexing foreign keys
Date: 2003-01-28 21:23:08
Message-ID: 020301c2c715$03cef290$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

> > In fact, I can't imagine a situation where you would NOT want a FK
> > indexed. I guess there must be one, or else I'm sure the developers
> > would have already added auto-creation of indexes to the FK creation, as
> > well.
>
> Any case where the pk table is small enough and the values are fairly
> evenly distributed so that the index isn't very selective. You end up not
> using the index anyway because it's not selective and you pay the costs
> involved in keeping it up to date.

Or you want an index on two or more fields that includes the FK as the
primary field. No sense in making two indexes.

Greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Gamache 2003-01-28 21:27:31 Re: 7.3 LOCK TABLE problem
Previous Message Michelle Murrain 2003-01-28 20:42:08 Re: How do I unsubscribe?

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-01-28 22:41:00 Re: inefficient query plan with left joined view
Previous Message Andreas Pflug 2003-01-28 19:31:46 Re: inefficient query plan with left joined view