MySQL 跟踪慢速更新语句

标签 mysql performance

我很好奇如何实际记录/找出缓慢的 UPDATE 语句。

我知道有 slow_query_log 选项,但我发现在此文件中没有 UPDATE 语句(即 UPDATEDELETEINSERT)包含在日志文件中。

有人建议使用二进制日志,但不知何故,当我尝试在从属数据库中读取此日志时,大多数 UPDATE 语句都显示 0 秒。

最佳答案

我宁愿在应用程序中执行此操作,但否则 mysql 二进制日志是我能想到的此类信息的唯一来源。

但是您应该使用主站二进制日志,因为从站将包含它落后于主站的时间。这是 dev.mysql.com 的摘录

exec_time is the time spent executing the event, on a master server. On a slave, it is the difference of the end execution time on the slave minus the beginning execution time on the master. The difference serves as an indicator of how much replication lags behind the master

关于MySQL 跟踪慢速更新语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19104692/

相关文章:

c# - Xamarin 表单应用程序的性能改进

MySQL LOAD DATA INFILE 不起作用,并且接收表没有约束

java - Tomcat org.apache.catalina.connector.requestfacade.getsession()占用CPU资源超过44.7%

algorithm - 我们什么时候必须考虑运行时的常量

javascript - document.write 非常慢,除了在 Firefox 中

c++ - OpenGL 执行非常缓慢

python - 如何设置SQLAlchemy方言?

mysql - 如何合并 SQL SELECT 字段

php - 从数据库中填充选中的单选按钮

java - mysql jdbc 即使在 rewriteBatchedStatements = true 之后也不批处理查询