Elegabalus
Programmer
I was always taught in my classes that the best way to create a primary key in a table was to use a unique integer (i.e., an identity). This way, the joins between tables were on an integer, and thus fairly fast.
Now, I'm working on a database that someone else designed, and they are using a concatenation of three char fields (2, 3, and 18 characters) as the primary key. This means, of course, that the foreign keys in the other dozens of tables have to be concatenations of the same fields.
I prefer to use identity fields as primary keys when I'm creating my own tables, but I'm wondering if there are any real downsides to a concatenated primary key.
Is there much of a difference, in terms of speed? Are indexes affected by this?
Any guidance is appreciated.
Now, I'm working on a database that someone else designed, and they are using a concatenation of three char fields (2, 3, and 18 characters) as the primary key. This means, of course, that the foreign keys in the other dozens of tables have to be concatenations of the same fields.
I prefer to use identity fields as primary keys when I'm creating my own tables, but I'm wondering if there are any real downsides to a concatenated primary key.
Is there much of a difference, in terms of speed? Are indexes affected by this?
Any guidance is appreciated.