Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Primary Key Question

Re: Primary Key Question

From: Mark D Powell <markp7832_at_my-deja.com>
Date: Fri, 18 Aug 2000 14:51:37 GMT
Message-ID: <8njihf$uok$1@nnrp1.deja.com>

In article <8nh6bd$8it$1_at_nnrp1.deja.com>,   sybrandb_at_my-deja.com wrote:
> In article <399BFF7E.57D5C654_at_yahoo.com>,
> Tim Ringwood <tringwood_at_e2gotech.com> wrote:
> > I was told early on in the world of DBA stuff that a primary key
 should
> > normally
> > be a sequence number I generate. At times I have use two keys from
 other
> > tables
> > when the table in question is a join table. The person I am now
 working
> > with
> > doesn't think you need a sequence number if the table in question is
 an
> > "end node".
> > (I don't know the correct term, but a table in which isn't refrenced
 by
> > any other
> > table). Instead the primary key is made up off user inputed data in
> > combination
> > of sequence numbers from other tables (at times having 4 fields
 making
> > up the
> > primary key). How do people feel about this? Hot debate here!
> >
> > thanks for any feedback!
> >
> > tim
> > tringwood_at_yahoo.com
> >
> >
> IMO, you use a sequence when there is no appropiate candidate primary
> key, or it is made up of many columns, or it is made up of long
 varchar
> data. Many designers use sequences indiscriminately. This results in
> the creation of extra indexes, as one never ever searches on that
> primary key.
> Example:
> The system I am currently working on (I didn't design it), has tables
> logging changing. The overall definition of those table is
> primary key (sequence number)
> foreign key (to the table to be logged)
> timestamp
> column name
> old value
> new value
>
> In this case the combination of the foreign key and the timestamp
 would
> have constituted a proper primary key, and the sequence number is used
> nowhere.
>
> Hth,
>
> --
> Sybrand Bakker, Oracle DBA
>
> All standard disclaimers apply
> ----------------------------------------------------------------------
>

I agree with Sybrand. It is my preference to use Business attributes or combinations of them to make up the primary key where possible. I believe you should look at each table and its relationships before making a decision. The use of business fields is particuliarly importandt where end-user reporting tools are in use.

--
Mark D. Powell  -- The only advice that counts is the advice that
 you follow so follow your own advice --


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Aug 18 2000 - 09:51:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US