Re: Index on email or ID?

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

 



the id is definitely better.  although creating an index on the email and
potentially the password would help.  I had a table that was indexed off of
a random unique string and when i got to about 50000+ rows updates were
taking about 4 seconds.

you can authenticate with the email and password, but then i would run all
updates based on the ID, and if you need to be sure of authentication,
store them in session variables and use them when you need them.

if you want to keep it the way you have it, i'd just add indexes on those
fields.

i'm sure there are better ways but, .....

hth
jeff


                                                                                                                    
                    "Jim"                                                                                           
                    <jimyt@yahoo.c       To:     php-db@lists.php.net                                               
                    om>                  cc:                                                                        
                                         Subject:      Index on email or ID?                                
                    12/04/2002                                                                                      
                    09:23 AM                                                                                        
                                                                                                                    
                                                                                                                    




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





-- 
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