Should i really use integer primary IDs?
Posted
by arthurprs
on Stack Overflow
See other posts from Stack Overflow
or by arthurprs
Published on 2010-04-17T21:22:03Z
Indexed on
2010/04/17
21:53 UTC
Read the original article
Hit count: 446
For example, i always generate an auto-increment field for the users table, but i also specifies an UNIQUE index on their usernames.
There is situations that i first need to get the userId for a given username and then execute the desired query. Or use a JOIN in the desired query.
It's 2 trips to the database or a JOIN vs. a varchar index
The above is just an example
There is a real performance benefit on INT over small VARCHAR indexes?
Thanks in advance!
© Stack Overflow or respective owner