Index on email or ID?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux