Microsoft SQL Server Profiler is one of the important tool which is useful to find different events and statues of the running queries on Microsoft SQL Server.
Do we have anything like SQL Profiler in MySQL?
I have found this question on many forums and many of MySQL professionals are curious about SQL Profiler in MySQL.
MySQL has SQL Profiler which is built into the database server and you can enable/disable via the MySQL client utility.
Before executing any queries you can enable SQL Profiler and it is only for your particular session.
Internally, it creates one profiling table into INFORMATION_SCHEMA database and when you disconnect with MySQL client, it destroys this table.
Enable SQL Profile at session level:
Execute sample query:
SELECT *FROM table_one;
SELECT *FROM table_two;
Check the execution time for each query:
Query_ID Duration Query
1 0.00355325 SELECT *FROM table_one
2 0.00051850 SELECT *FROM table_two
Check the execution time for second query only:
SHOW PROFILE FOR QUERY 2;
Check the CPU information for second query only:
SHOW PROFILE CPU FOR QUERY 2;
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.