Re: Best data Type for Primary Keys

From: Michael Kuznetsov <mvk_at_servocomp.ru>
Date: 29 Nov 2002 09:13:26 -0800
Message-ID: <1543a3e7.0211290913.714233a6_at_posting.google.com>


Hi Dean,

There is well known approach to design database. That is using of surrogate primary keys.

For example you have table CURRENCY with columns CODE and NAME. CODE has values USD, CAD, etc. NAME has values American dollars, Canadian dollars, etc. You can create primary key on the column NAME. But in this approach you should create a column ID as a primary key. It gives additional flexibility to your database. For this proposal NUMBER key is better because you can use a sequence for its generating without useless type conversions.

Performance for varchar and number keys is more or less same if varchar is not very long.

Regards,
Michael
Brainbench MVP for Oracle Programming
http://www.brainbench.com

dean_attewell_at_hotmail.com (Dean Attewell) wrote in message news:<3bda48ba.0211262201.5618d2ea_at_posting.google.com>...
> Is a VARCHAR2 as fast or as better than a NUMBER datatype?
>
> or what is the best datatype to use?
>
> Thanks
> Dean
Received on Fri Nov 29 2002 - 18:13:26 CET

Original text of this message