List:General Discussion« Previous MessageNext Message »
From:adam nelson Date:February 21 2002 7:03pm
Subject:RE: foreign keys to what end?
View as plain text  
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.

-----Original Message-----
From: David Felio [mailto:david@stripped] 
Sent: Thursday, February 21, 2002 11:19 AM
To: mysql@stripped
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)
cust_type
routing_num
status
site_id
payment_type
auth_type
trans_type
trace_num

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
up
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
be
handled by foreign keys instead of error checking in the program? The
indexing along would seem to get fairly large in the transactions table
if
I set them all up as foreign keys.

David Felio
Software Developer
Information Network of Arkansas
http://www.AccessArkansas.org


Thread
foreign keys to what end?David Felio21 Feb
  • RE: foreign keys to what end?adam nelson21 Feb