Do you know a bad candidate primarily for emails compared to incremental numbers?
The email address to be unique in our web application needs system, therefore, I thought of using email address as the primary key. Although my colleague has suggested that string comparison will be slower than integer comparison.
Is this a valid reason not to use email as a primary key?
We are using PostgreSQL
.
The string comparison is slower compared to comparison. However, it does not matter that you retrieve the user from the database using the e-mail address. If you have complex questions with multiple joins then it does not matter.
If you store information about users in multiple tables, then the user will have the foreign key e-mail address in the table. This means that you store the e-mail address multiple times.
Comments
Post a Comment