mysql - Are multiple indices needed for multiple where clauses? -
I have a query like this:
SELECT * from users where the user name = 'Test' and some = 'test'
I'm thinking that both columns are necessary for the index for optimization. Does MySQL first find all the user names with all the "tests", and then searches for those results for some columns with 'exam'? Or does it happen together?
Yes, you should combine each column and column that appears in the WHERE section, it is efficient Should be an indicator for search
You take it away for primary key areas because the index is created due to a preference declaration key. Other columns require that you index them.
So you have an index for the username and the name of the email.
If the user name should be unique, its own index might be. / P>
Comments
Post a Comment