In different modules, what are the resources (time) used for SQL execution.
How to analyze the execution time of a SQL statement in MySQL
1. First, you need to see whether profiling is turned on. Turning it on allows MySQL to collect the resources used during SQL execution.
profiling=0 means off, profiling needs to be set to 1
2. Then execute a SQL query
select * from nodeinfo;
3. View all profiles generated by the current session:
If you want to get the execution time of the last query, you can use
Of course, you can also query the executed Query ID, such as
show profile for query 1;
After version 8.0 (you can use select version() to check the version of MySQL), MySQL no longer supports cached queries. Once the data table is updated, the cache will be emptied, so only the data table is static or there are few data tables When changes occur, the use of cached queries is valuable.