Using foreign keys is a really, really good idea. Programs can't be
trusted (and what about running sql queries ad hoc). Even with a really
big database I wouldn't get rid of the keys, just time to move to a
bigger better machine/configuration.
From: David Felio [mailto:david@stripped]
Sent: Thursday, February 21, 2002 11:19 AM
Subject: foreign keys to what end?
I have a MySQL InnoDB table for ACH (checking account) transactions that
includes, among other fields, the below:
trans_id (PRIMARY KEY)
All of the above fields (except the primary key) are related to other
tables that describe the customer type, transaction type, etc. or have
valid values for routing number, status, etc. Should all of these be set
as foreign keys, or should some of referential integrity be done
programmatically? How do you draw the line between how many foreign keys
are too many, or is there no such thing? Should things like this always
handled by foreign keys instead of error checking in the program? The
indexing along would seem to get fairly large in the transactions table
I set them all up as foreign keys.
Information Network of Arkansas