show profiles 详解
By admin
- One minute read - 74 wordshttps://dev.mysql.com/doc/refman/5.7/en/show-profile.html
此功能将在新版本中被移除,性能分析使用新方法来代替。(官方提供了此命令的使用方法, 对于 show profile for query ID / show profile CPU for query ID 结果中每项的说明信息请参考: https://www.cnblogs.com/itcomputer/articles/5056127.html)
Note
These statements are deprecated and will be removed in a future MySQL release. Use the Performance Schema instead; see Chapter 25, MySQL Performance Schema.
对于新版本我们也可以直接查询 INFORMATION_SCHEMA
PROFILING
. See Section 25.20, “The INFORMATION_SCHEMA PROFILING Table”.
例如:
SHOW PROFILE FOR QUERY 2;
SELECT STATE, FORMAT(DURATION, 6) AS DURATION FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID = 2 ORDER BY SEQ;