From: | Vivek Khera <vivek(at)khera(dot)org> |
---|---|
To: | pgsql general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Foreign key / performance question |
Date: | 2006-03-29 18:12:24 |
Message-ID: | 9A4ED9A7-3705-42FF-A7F9-1A39410841D1@khera.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mar 29, 2006, at 12:35 PM, Nico Callewaert wrote:
> Because from what I understand, for every foreign key, there is an
> index defined. So, all these indexes has to be maintained. Is
> that killing performance ? What's the best practise : defining
> foreign keys or not ?
If your application is 100% perfect and you never do any manual
updates to the DB, then who needs FK's?
Show me that your app is 100% perfect first... which there is no way
you can do unless it is a trivial amount of code.
But just defining FK's won't define an index. You have to do that
manually else suffer performance. However, if the referenced table
is only a few hundred rows or less, there is not much point in an
index on that column for that table.
Personally, I live by FKs since I value my data to be correct.
From | Date | Subject | |
---|---|---|---|
Next Message | Vivek Khera | 2006-03-29 18:16:21 | Re: Flight numbers data |
Previous Message | Vivek Khera | 2006-03-29 18:09:21 | Re: Implementation Suggestions |