Re: Indexing foreign keys

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: PgSQL Performance ML <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Indexing foreign keys
Date: 2003-01-28 15:15:09
Message-ID: 1043766909.9899.132.camel@haggis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

On Mon, 2003-01-27 at 23:46, Matt Mello wrote:
> Ron Johnson wrote:
> > When you say "I created an index on those 2 fields", so you mean on
> > the fields in the 400K row table, or on the keys in the "fact tables"
> > that the 400K row table?
> >
> > Also, in IFX, could the creation of the foreign indexes have implicitly
> > created indexes?
> > The reason I ask is that this is what happens in Pg when you create a
> > PK.
> >
>
> The 400K row table has 2 fields that are FK fields. The already-indexed
> PK fields that they reference are in another table. I just recently
> added indexes to the 2 FK fields in the 400K row table to get the speed
> boost.
>
> Yes. In IFX, when you create a FK, it seems to create indexes
> automatically for you, just like PG does with PK's.
>
> 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.

When I took my brain out of 1st gear, it was "Doh!": I realized that
I was thinking backwards...

--
+---------------------------------------------------------------+
| Ron Johnson, Jr. mailto:ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA http://members.cox.net/ron.l.johnson |
| |
| "Fear the Penguin!!" |
+---------------------------------------------------------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-01-28 15:19:23 Re: Status of tablespaces
Previous Message Tom Lane 2003-01-28 14:58:49 Re: Using RSYNC for replication?

Browse pgsql-performance by date

  From Date Subject
Next Message Andreas Pflug 2003-01-28 16:50:58 inefficient query plan with left joined view
Previous Message Curt Sampson 2003-01-28 10:54:50 Re: 7.3.1 New install, large queries are slow