Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UserName or guid UserID?

Tags:

sql

guid

When saving data in different sql tables, is it best to use the GUID userID or simply use the username? is there a performance difference when using guid?

like image 637
zsharp Avatar asked Jan 24 '09 23:01

zsharp


2 Answers

Use the guid. It is the system internal identifier for your users. This then allows the ability to change usernames if people wish.

This then fits nicely with the concept of an internal ID that means something to your system, versus the external ID that means something to your users.

like image 144
Neil Barnwell Avatar answered Oct 14 '22 03:10

Neil Barnwell


I saw a lot of discussions about performance in GUID vs. INT (auto increment). But I could recommend you use GUID.

Hm.. Are you asking about field used as primary or about using/not a relations (insert a GUID into a table having another table with GUID and user name associations) ?

like image 34
abatishchev Avatar answered Oct 14 '22 03:10

abatishchev