Query about query optimization

March 6, 2013 in answer

0 votes, 0.00 avg. rating (0% score)

ANSWER:

general approach…
for each query, check the execution plan of the query in mysql via the EXPLAIN-Query.
Then you have to check, if the query uses KEYS and INDICES… if it does not, you need to setup proper indices for your data.

if you have a table of users with a primary-key and a date-of-birth-colum, and you want to query the DOB-Column in WHERE or ORDER-Clause, it should have at least a simple INDEX.

Please consult the MySQL-Manual and all the other Database-Tutorials out there to get to know about indices…

TheHe from http://stackoverflow.com/questions/15263127