Should I use database foreign keys and indexes

From: Carl <carl.stottlemyer_at_lmco.com>
Date: 10 Jul 2002 14:13:46 -0700
Message-ID: <bc814416.0207101313.442eea0f_at_posting.google.com>



I recently had a discussion with several web application developers where I work about the use of foreign keys and table indexes.

I always thought that they were both basic elements of relational database modeling and should be included in all of your database designs. I was suprised that they felt that foreign keys and indexes add unnecessary complexity to a database and that they never use foreign key constraints and rarely use indexes as a primary key. I would like to know your thoughts on using foreign keys and indexes in a database. The pros and cons I have thought of thus far are:

Foreign Keys Constraints:
  Pro:

     Provide referential integrity
  Con:

     May have to disable when you are doing mass updates

Table Indexes as Primary Key:
  Pro:

     Unique reference to the table so that a change to a datafield doesn't require a change to all tables that reference it   Con:

     May have to do a table join to search on a particular table field

Please add any comments you have.

Thanks,

    Carl Received on Wed Jul 10 2002 - 23:13:46 CEST

Original text of this message