Re: make a unique index for foreign keys?

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Beth Gatewood" <beth(at)vizxlabs(dot)com>, <josh(at)agliodbs(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: make a unique index for foreign keys?
Date: 2002-06-14 02:24:05
Message-ID: GNELIHDDFBOCMGBFGEFOCEMBCCAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Chris/ Josh-
>
> OK-response to Chris below. Synopsis here....simply by creating a foreign
> key will not create an index. On large tables I SHOULD put a non-unique
> index on the foreign key (right?)

For large tables, I guess you may as well. You can be more scientific about
it if you you unhash this in your postgresql.conf:

stats_command_string = true
stats_row_level = true
stats_block_level = true

Then you can just use the pg_stat views to see how many sequential scans are
being run over your tables and how expensive they are, etc.

Chris

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-06-14 05:02:20 Re: simple recursive function in plpgsql fails
Previous Message joo 2002-06-14 02:03:58 Re: join question - requesting for a simple C program where it can INSERT data into database as reference