Re: Primary Key of a table

From: Austin Moseley <\"moseba_at_audv55.aud.alcatel.com'>
Date: 1996/04/02
Message-ID: <4jpvqa$ffo_at_news01.aud.alcatel.com>#1/1


amit_at_ix.netcom.com(Amit Bansal) wrote:
>In <4jebm3$5p_at_dlsn31.dal.mobil.com> Jay Mehta
><jvmehta_at_mra.ffx.mobil.com> writes:
>>
>>One of the consultant I worked with recommends only numeric primary
>key.
 

>
>Is the suggestion to use a dummy numeric key generated using a sequnce
>everytime a record is inserted in the table ?
>
>I think in the complex situations where the number of columns in a table
>which forms the primary key exceeds 4-5 and the key is used as a
>Foreign key in other tables then probably should go for a dummy numeric
>key. Otherwise we should use the table coulmns in the PK.

Don't expect your Oracle sequence to return sequential numbers. Due to shutdowns and other interruptions, the sequences may have gaps. I have not seen a sequence reuse a number, though.

In General, the Pk should be THE primary key. If you develop an effective numeric primary key, its a waste of space and time anyway, since you will still have to reference the TRUE Pk - especially if you have large tables. This assumes the TRUE pk is fairly static.

If it is not static, or it can possibly have duplicates, like names or cities or phone numbers, or you have 2 or more foreign keys on it ( and your tables are big), then you would want to try the numeric PK.

-Austin Received on Tue Apr 02 1996 - 00:00:00 CEST

Original text of this message