MySQL: Using SQL Query Profiler finds total execution time and CPU information of the Queries

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:

Check the execution time for each query:

Check the execution time for second query only:

Check the CPU information for second query only:

The Result:

MySQL CPU SQL Profiler

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of