未知的慢 sql 查询
Unknown slow sql queries
当我浏览 CloudWatch 的日志时,我发现了一些我无法解释的问题
# Time: 190726 1:05:16
# User@Host: company[company] @ [210.10.5.183] Id: 938
# Query_time: 238.040510 Lock_time: 0.000033 Rows_sent: 8988370 Rows_examined: 8988370
use application;
SET timestamp=1564103116;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `dictionary_translations`;
# Time: 190726 1:09:53
# User@Host: company[company] @ [210.10.5.183] Id: 938
# Query_time: 277.528088 Lock_time: 0.000035 Rows_sent: 3223714 Rows_examined: 3223714
SET timestamp=1564103393;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `email_events`;
...
如您所见,这些查询花费了很多时间,必须对其进行优化。
应用程序在 rails 上运行,也许 Active Record 正在做一些同步?
这些查询的 'nature' 是什么?如何优化?
此查询的性质可能是备份数据库时 运行 mysqldump 的结果
当我浏览 CloudWatch 的日志时,我发现了一些我无法解释的问题
# Time: 190726 1:05:16
# User@Host: company[company] @ [210.10.5.183] Id: 938
# Query_time: 238.040510 Lock_time: 0.000033 Rows_sent: 8988370 Rows_examined: 8988370
use application;
SET timestamp=1564103116;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `dictionary_translations`;
# Time: 190726 1:09:53
# User@Host: company[company] @ [210.10.5.183] Id: 938
# Query_time: 277.528088 Lock_time: 0.000035 Rows_sent: 3223714 Rows_examined: 3223714
SET timestamp=1564103393;
SELECT /*!40001 SQL_NO_CACHE */ * FROM `email_events`;
...
如您所见,这些查询花费了很多时间,必须对其进行优化。
应用程序在 rails 上运行,也许 Active Record 正在做一些同步?
这些查询的 'nature' 是什么?如何优化?
此查询的性质可能是备份数据库时 运行 mysqldump 的结果