MySQL has provided profiler tools since 5.0.37, which is often useful for performance debugging. The primary purpose of profiler is to display the consumption of resources in the entire process of executing an SQL statement. The parser can better show the performance bottleneck of poor SQL statements. The following describes how to use profiler. Step 1: Enable profilermysql> set profiling = 1; query OK, 0 rows affected (0.04 Sec) ii. display the profile information of multiple queries saved in the current system mysql> show profiles; empty set (0.00 Sec) III. Execute the query statement mysql> select singer. sinaid, name from 't_wpp_pending_singer 'singer left join 'T_ wpp_pending_status 'status on Singer. sinaid = status. sinaid
Where status = 1 limit 50;
4. Execute the command and then display the profile information mysql> show profiles;
5. display the profile of the first query. mysql> show profile for query 1;
6. display the profile summary and CPU usage of the first query. mysql> show profile CPU, block Io for query 1;
7. Disable profilermysql> set profiling = 0; query OK, 0 rows affected (0.00 Sec)