Should I 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 23:33 UTC
Read the original article Hit count: 265

For example, I always generate an auto-increment field for the users table, but I also specify a UNIQUE index on their usernames. There are 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.

Should I use integer primary IDs?

Is there a real performance benefit on INT over small VARCHAR indexes?

© Stack Overflow or respective owner

Related posts about sql

Related posts about database