I have a users table with the following fields, id, username.The Id is auto-increment with primary key and I am thinking if I should have the username as the Primary key as well.
I have another table, audit_results with username as a foreign key to the users table
What is the deciding factor to determine which of the following relation (There would be millions of users in the users table) would be faster (assuming there will be complicated join queries in future).
- audit_results.username(related to user.username) OR
- audit_results.id(related to user.id)
Does it make any difference with varchar or int datatype as the primary key?


 
    