Re: make a unique index for foreign keys? - Mailing list pgsql-sql

From Christopher Kings-Lynne
Subject Re: make a unique index for foreign keys?
Date
Msg-id GNELIHDDFBOCMGBFGEFOCEMBCCAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: make a unique index for foreign keys?  ("Beth Gatewood" <beth@vizxlabs.com>)
List 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



pgsql-sql by date:

Previous
From: "joo"
Date:
Subject: Re: join question - requesting for a simple C program where it can INSERT data into database as reference
Next
From: Tom Lane
Date:
Subject: Re: simple recursive function in plpgsql fails