如何进行性能分析profiling

38次阅读
没有评论

共计 1125 个字符,预计需要花费 3 分钟才能阅读完成。

如何进行性能分析 profiling,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

使用 mysql 自带的工具 profiling

1. 查看是否打开
mysql show variables like %pro%
+—————————+——-+
| Variable_name             | Value |
+—————————+——-+
| have_profiling            | YES   |
| profiling                 | OFF   |
| profiling_history_size    | 15    |
| protocol_version          | 10    |
| proxy_user                |       |
| slave_compressed_protocol | OFF   |
| stored_program_cache      | 256   |
+—————————+——-+
7 rows in set (0.00 sec)

2. 默认是关闭的
打开它
set profiling=1;

3. 使用
 select * from corp_base_par where res_date=330000 limit 1;

mysql show profiles;
+———-+————+———————————————————–+
| Query_ID | Duration   | Query                                                     |
+———-+————+———————————————————–+
|        1 | 0.00008975 | set  profiling=1                                          |
|        2 | 0.00088450 | select * from corp_base_par where res_date=330000 limit 1 |
+———-+————+———————————————————–+
2 rows in set (0.00 sec)

显示了 这条 sql 的具体消耗时间

看完上述内容,你们掌握如何进行性能分析 profiling 的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注丸趣 TV 行业资讯频道,感谢各位的阅读!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计1125字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)