Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check performance of mysql query?

I have been learning query optimization, increase query performance and all but in general if we create a query how can we know if this is a wise query.

I know we can see the execution time below, But this time will not give a clear indication without a good amount of data. And usually, when we create a new query we don't have much data to check.

I have learned about clauses and commands performance. But is there is anything by which we can check the performance of the query? Performance here is not execution time, it means that whether a query is "ok" or not, without data dependency.

As we cannot create that much data that would be in live database.

like image 399
Anand Singh Avatar asked Aug 20 '15 11:08

Anand Singh


People also ask

How do I know which query is taking more time in MySQL?

Run the 'show processlist;' query from within MySQL interactive mode prompt. (Adding the 'full' modifier to the command disables truncation of the Info column. This is necessary when viewing long queries.) Pro: Using the full modifier allows for seeing the full query on longer queries.


1 Answers

As mentioned above, Right query is always data-dependent. Up to some level you can use the below methods to check the performance

  1. You can use Explain to understand the Query Execution Plan and that may help you to correct some stuffs. For more info : Refer Documentation Optimizing Queries with EXPLAIN

  2. You can use Query Analyzer. Refer MySQL Query Analyzer

like image 159
Arun Palanisamy Avatar answered Oct 26 '22 12:10

Arun Palanisamy