how can i optimize a sql query to get the best performance and monitoring it, i want to compare two or more querys performance
Asked
Active
Viewed 60 times
0
-
Possible duplicate of [How do I obtain a Query Execution Plan?](http://stackoverflow.com/questions/7359702/how-do-i-obtain-a-query-execution-plan) – Juan Carlos Oropeza Nov 08 '16 at 18:47
-
Also some MySQL index [**TIPS**](http://mysql.rjweb.org/doc.php/index_cookbook_mysql) – Juan Carlos Oropeza Nov 08 '16 at 18:48
-
Thanks, that what i want to refer some TIPS or a way to analyze it. – César Villaseñor Apr 06 '17 at 23:17
1 Answers
1
There are so many things you can do to optimize your sql query.
Following are the few tips:-
- Look at the execution plan of your query.
- Turn on IO statistics on and see the reads, writes
- Make sure you are not casting a column on the table instead you should cast the variable being passed in.(Only valid if you are passing in parameters)
- Make sure you are joining on clustered indexes or Indexes are properly set on columns in table.
- Avoid wildcard characters in the start of the expression. For example:- like "%abc%"

Nirjhar Vermani
- 1,215
- 8
- 17