my sites dont need use ID at all, then I am trying to manage user by username.
Assume my sites is abc.com, then access to user profile by URL: abc.com/user1
So if you want to view all info of that user, you can get by Model User ( Laravel Framework):
$user = User::find(user1); $email = $user->email; $sex = user1->sex;
Second method, if use ID as primary key, but my project no need to use id at all.
$id=User::where(username=user1)->id; $user = $User::find($id); $email = $user->email; $sex = user1->sex;
As you can see, First method is faster than second, because "Username" field has indexed. Should i use username for primary key in this situation? I use MySQL.