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.