Please do share you thoughts why one is preferable over other.
It depends on what you do.
See, an index is only used "left to right". So, an indes on UserID; UserName is useless if I select filtering by UserName ONLY.
Generally, I would assume three indices here:
- Uniuqe Index, Clustered in UserID, as Primary Key.
- Unique Index on UserName, non clustered.
- Unique Index on UserEMail, non clustered.
The reason is totally not for Performance but:
- You will Need the first as Primary key for forein key relationships.
- You Need the other two to handle unique constraints properly - there is no way to do that without indices.
In Addition, you Need flexibility to seek by UserName AND UserEMail, which means that it is not possible to Combine them only.
Performance really enters last here - for performacne e reasons all of These indices may contain all additional fields (not as part of the index but as included columns. But really, there is no other sensible way to have this table work unless you alow multiple registrations for the same user.