-1

I did add explain keyword in front of my query but had no idea how to use it for query optimization.

Output looks like : https://drive.google.com/file/d/0B070X_hyTgDbR195REY3Q0E3MVU/view?usp=sharing

Binaya Shrestha
  • 440
  • 3
  • 12
  • for some people your link may not work, and it may not work at all in the future, rendering your question (and its answers) unusable, and also one should not have to see links to understand the question. so maybe add short example output directly to the question. – hoijui Jul 08 '15 at 11:09
  • A link for a link: https://dev.mysql.com/doc/refman/5.0/en/explain-output.html If you wish to actually get help, please provide more information, including: your query, SHOW CREATE TABLE statements for all tables involved, as well as the actual EXPLAIN result pasted (in text, preferably) into your question, rather than linked to elsewhere. – Willem Renzema Jul 08 '15 at 12:55

2 Answers2

1

First line -- a table scan (see NULLs and ALL)

2nd and 4th line -- an index scan ("Using index"), but rather costly since 10K rows needed.

What it does not tell you is whether some other index(es) would be more efficient. Nor does it tell you whether reformulating the query would help. Please provide us with the SELECT so we can help you there, plus tie more things to the EXPLAIN.

More links:
http://myxplain.net/
http://www.sitepoint.com/using-explain-to-write-better-mysql-queries/

Rick James
  • 135,179
  • 13
  • 127
  • 222
0

EXPLAIN is mysql query to use it write like this

EXPLAIN SELECT * FROM table_name;

OR with where or other condition

EXPLAIN SELECT * FROM table_name WHERE id='value';
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459