我收集了来自 RDS 的慢查询日志,并将它们放在一个文件中。尝试按照此处的说明pt-query-digest
运行它,但它将整个文件作为单个查询读取。
命令:
pt-query-digest --group-by fingerprint --order-by Query_time:sum collider-slow-query.log > slow-query-analyze.txt
输出,表明它只分析了一个查询:
# Overall: 1 total, 1 unique, 0 QPS, 0x concurrency ______________________
这只是一个简短的片段,其中包含正在分析的文件中的 2 个查询,以演示有许多查询:
2019-05-03T20:44:21.828Z # Time: 2019-05-03T20:44:21.828954Z
# User@Host: username[username] @ [ipaddress] Id: 19
# Query_time: 17.443164 Lock_time: 0.000145 Rows_sent: 5 Rows_examined: 121380
SET timestamp=1556916261;
SELECT wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND wp_posts.ID NOT IN (752921) AND (
wp_term_relationships.term_taxonomy_id IN (40)
) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 5;
2019-05-03T20:44:53.597Z # Time: 2019-05-03T20:44:53.597137Z
# User@Host: username[username] @ [ipaddress] Id: 77
# Query_time: 35.757909 Lock_time: 0.000054 Rows_sent: 2 Rows_examined: 199008
SET timestamp=1556916293;
SELECT post_id, meta_value FROM wp_postmeta
WHERE meta_key = '_wp_attached_file'
AND meta_value IN ( 'family-guy-vestigial-peter-slice.jpg','2015/08/bobs-burgers-image.jpg','2015/08/bobs-burgers-image.jpg' );
为什么它不读取所有查询?我的连接有问题吗?