Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary keys and foreign keys
Message
De
18/08/2003 19:41:22
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Titre:
Primary keys and foreign keys
Divers
Thread ID:
00821248
Message ID:
00821248
Vues:
54
Hi,

When I have chosen character primary keys, usually I've made them small to save space but to a great extent out of just being used to doing it that way, I guess this is a mentality from the times when space was an issue. But nowadays in certain applications space is not an issue. As an example of what I'm talking about:

Let's say you have an "ORDER" table:

nOrder_id int
nAmount money
cStatus_id char(3) -- foreign key

and I have an "STATUS"s table:

cStatus_id char(3) -- primary key
cDescription -- Status Description

now, my question would be, if space is not an issue, why not increase the size of "cStatus_id" so the entire description can fit in, provided the description is not humongous of course, ex:, instead of "COM" use "COMPLETED", "PEN" use "PENDING","INTRA" use "IN TRANSIT" etc. This is more readable for an administrator or programmer and it makes the programming easier for the programmer.

What considerations would you have? Maybe speed? or not any noticeable speed difference as having smaller keys?

Cons, pros?

Thanks.
Thanks.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform