Re: Should I use database foreign keys and indexes
From: David Cressey <david_at_dcressey.com>
Date: Thu, 11 Jul 2002 14:40:23 GMT
Message-ID: <rNgX8.9$Jd4.917_at_petpeeve.ziplink.net>
Date: Thu, 11 Jul 2002 14:40:23 GMT
Message-ID: <rNgX8.9$Jd4.917_at_petpeeve.ziplink.net>
--Received on Thu Jul 11 2002 - 16:40:23 CEST
> What I meant by a table index being a: "Unique reference to the table
> so that a change to a datafield doesn't require a change to all tables
> that reference it" Is that if you have a table that uses business
> data as a primary key and the business data changes then you have to
> update the business data in all tables that might reference it.
Your definition of "index" is not the common one. It sounds like you are trying to define "primary key", but I'm not sure. In common parlance, an index is a data structure that facilitates rapid access to one or more table rows, given part of the contents found there. Primary keys are usually indexed, but indexes can be built on columns that are not primary keys.
> In general do you use foreign keys and indexes?
In the same vein, I'm taking this to mean "foreign keys and primary keys." Forgive me if I'm misunderstanding you. If you are building a relational database, you use foreign key references to primary key values all the time, whenever you need to represent data relationships. If you are building a non relational database, and plan on storing it in a relational DBMS, you are going to have a certain amount of difficulty. Good luck.
>
> - Carl (Software Engineer)
>