开发者

username/password in separate table or user table?

i'm running a social network site and i currently have most main user data (real nam开发者_如何学Goe, username, email, password, gender, etc) in a user table. Design-wise, would there be an performance improvement in moving the username+password to a separate table ?

I'm using mysql.


Authentication queries which only need username and password will run slightly faster, due to the smaller size of the table.

However, if you create a composite index on (username, password_hash), it will be even faster, since the queries like this:

SELECT  password_hash
FROM    users
WHERE   username = 'myusername'

will only need the index to run (it will show using index in the plan).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜