How to identify queries that do not use Dexes?

Asked

Viewed 22 times

1

After a long time I decided to check the state of the database, even with everything working normal. I used the mysqltuner.pl to verify.


At one point there is the following information:

[!!] Joins performed without indexes: 8915215
[OK] Temporary tables created on disk: 0% (6K on disk / 19B total)

My point is:

How can I quickly identify which JOINS are not using Dexes?

  • Have you used EXPLAIN

  • @Maniero The problem is figuring out which to use. They are many different queries (with JOIN different), I have no idea of the origin of these 8915215. Using EXPLAIN would you have to run each one individually in each query, or is there a way to use EXPLAIN in a "history" of queries that have already been used? . I saw about the slow_query_log, but the information I find is conflicting (it doesn’t necessarily record what it doesn’t use).

  • Well, maybe that gave me an idea. I thought I’d have to add EXPLAIN manually to each one. But think about it, you can modify the source code there database/sql and then run two queries, one normal (so the code doesn’t stop) and the other with the EXPLAIN (Alá EXPLAIN + query) and this second print and run all tests. Gambiarras das gambiarras, it does not cost to try, but must have a better solution.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.