2

Possible Duplicate:
Is there a REAL performance difference between INT and VARCHAR primary keys?

I am looking to create an effective table that is supposed to be very big. I want to ease the server's work load as much as I can.

In a MYSQL query, should I search a certain row by looking for a user ID (number) or a username (string)?

What is the fastest?

Thanks a lot for your help

Regards

Community
  • 1
  • 1
eric01
  • 909
  • 3
  • 8
  • 20
  • 3
    Simple google search found: http://stackoverflow.com/questions/332300/is-there-a-real-performance-difference-between-int-and-varchar-primary-keys – Mike Purcell Mar 05 '12 at 23:12

1 Answers1

2

MySQL is faster when working with integers, and furthermore faster when working with an integer in which has and index -- exactly what user_id's are meant for! :)

usually an ID row would look like this:

create table `table_name` (
`id` int unsigned not null auto_increment primary key
...
Ben Ashton
  • 1,385
  • 10
  • 15