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.
Asked
Active
Viewed 2.0k times
2 Answers
10
In short
- Run your
SELECT ...query SHOW STATUS LIKE 'last_query_cost'- if the answer was 0 rerun the query with
select SQL_NO_CACHE ...and do step 2 above again
Ruan Malan N
- 311
- 3
- 3
5
There isn't much out there for MySQL except the following:
- EXPLAIN EXTENDED followed by SHOW WARNINGS
- SHOW PROFILES (Older Releases of MySQL)
- MySQL PERFORMANCE_SCHEMA
Read these carefully, see what you think ...
RolandoMySQLDBA
- 182,700
- 33
- 317
- 520
-
1Also note that while query cost isn't returned in the basic EXPLAIN command, it is available if instead you use EXPLAIN FORMAT=JSON – Anarkopsykotik Jul 02 '19 at 12:53