In PostgreSQL, EXPLAIN or EXPLAIN ANALYZE will show the estimate cost of executing a query. But EXPLAIN in MySQL doesn't provide this information. How can I get the estimate cost without installation of other tools? I'm using MySQL-5.6.16.


2 Answers 2


There isn't much out there for MySQL except the following:

Read these carefully, see what you think ...

  • 1
    Also note that while query cost isn't returned in the basic EXPLAIN command, it is available if instead you use EXPLAIN FORMAT=JSON Jul 2, 2019 at 12:53

In short

  1. Run your SELECT ... query
  2. SHOW STATUS LIKE 'last_query_cost'
  3. if the answer was 0 rerun the query with select SQL_NO_CACHE ... and do step 2 above again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.