Re: oracle sequence numbers

From: Bernard Peek <bap_at_shrdlu.com>
Date: Wed, 15 Jan 2003 10:44:48 +0000
Message-ID: <i9plrlcguTJ+Ew+1_at_diamond9.demon.co.uk>


In message <2388939.1042587191_at_dbforums.com>, helen_fearman <member22597_at_dbforums.com> writes
>
>What are the main pros and cons of using oracle sequence numbers for
>primary keys in situations where good unique candidate keys exist and
>which could be designated as primary keys? Is there an accepted "best
>practice"?

Many people automatically use sequence numbers when they create tables. My strongly held belief is that you should always use a real primary key if you can. If you use a sequence number as a surrogate you often need to write additional code to maintain the 1:1 mapping between the real primary key and the surrogate. This may eat up any performance savings you get from using shorter keys, and will introduce an additional source of error.

-- 
Bernard Peek
bap_at_shrdlu.com
www.diversebooks.com: SF & Computing book reviews and more.....

In search of cognoscenti
Received on Wed Jan 15 2003 - 11:44:48 CET

Original text of this message