Username and User ID in relational table -


i've seen many databases use both username (string) user_id (int) in user table, though both fine candidate keys themselves.

what advantages of having both instead of having username? i'd figure using user_id find rows faster using username. question of performance?

if entries indexed both fields shouldn't make difference use 1 or other search (even though if id incremental can make cool tricks using id obtain users created after date faster using creation_date non-indexed field, example).

if need make list of users, shorter in bytes using ids.

also purpose of "anonymity", though times it's trivial find associated username id.

the important me can have more 1 username same id if want, , change username associated id, can useful, in facebook when started **embarrasingusernamehere** , grandma/gf/boss adds or, here in stackexchange, when **anotherembarrasignusername** , few years later wanna show how solving problems potential employer.

so, in few words: username easier remember humans userid allows few cool things. pretty same ip/domain thing on internet.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -