Unanswered: Using a varchar as a Primary Key VS. using an Identity
Currently, I am using a varchar "UserName" as a primary key instead of an Identity or GUID.
When user's sign up they provide the "UserName" that is used as a PK.
Creating a message board type web application.
UserNames will never change.
UserNames are used extensively as FK's in other Tables.
We want to scale well.
Does anyone know the implications?
I understand Joins are faster on numerical values than strings but we will not be performing many joins.
In my case is it better to use Identity as a PK or is it better to use a varchar for a "Users" table?
I'm used to work with identity columns for almost every tabel, since the key shouldn't have any semantics (which could force the key to be changed), it must be unique of cource, and such a key is compact.
On special occasions, however, I do not follow this golden rule. As you describe, your key will not change, it is unique, and you don't expect any join troubles; so I don't see problems to design your database this way.
Make everything as simple as possible, but not simpler! - A. Einstein
DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool