Index on email or ID?

From: Date: Wed, 04 Dec 2002 14:23:20 +0000
Subject: Index on email or ID?
Groups: php.db 
Request: Send a blank email to php-db+get-23797@lists.php.net to get a copy of this message
Hi, My website requires subscribed users to login with their email and password, the email is guaranteed to be unique, so this is one key, the other is the AUTO_INCREMENT ID assigned at registration time. In the cookie that I drop at logon time is the email/password combination (security isn't really a major issue)........so I can then use the email as the unique key into the user table. Of course, I could also drop the AUTO_INCREMENT ID at logon time aswell, so instead of having: WHERE email = 'whoever@whereever.com' AND password = 'userpass' I would use: WHERE id = 19 AND email = 'whoever@whereever.com' AND password = 'userpass' Question is, is the index performance on a INT column much greater than that of a VARCHAR column? My guess would be yes. Also, if your thinking about saying "well if ya got the ID, why bother with email and password", well I don't want to make it THAT easy to logon as another user. Just want to gather some opinions. Thanks, Jim.

« previous php.db (#23797) next »