- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个查询,根据我的慢查询日志,它有点慢......
Query_time: 8.408943 Lock_time: 0.000119 Rows_sent: 1 Rows_examined: 2911766
但是,当我在其前面使用 EXPLAIN
运行查询时,我没有得到相同的结果...
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY forum range PRIMARY PRIMARY 4 NULL 3 Using where; Using temporary; Using filesort
1 PRIMARY category ref PRIMARY,forum_id forum_id 4 source_forum.forum.id 2
1 PRIMARY board ref PRIMARY,category_id category_id 4 source_forum.category.id 4 Using where
1 PRIMARY topic ref PRIMARY,board_id board_id 4 source_forum.board.id 58
1 PRIMARY post ref PRIMARY,topic_id,trash topic_id 4 source_forum.topic.id 16 Using where
3 DEPENDENT SUBQUERY post index topic_id created 4 NULL 1 Using where
2 DEPENDENT SUBQUERY group_assoc ref board_id,group_id board_id 4 source_forum.board.id 4 Using where
正在使用的最高行数是 56...
更新
我的查询:
SELECT
COUNT(id) AS num
FROM (
SELECT topic.*,
(SELECT created FROM post WHERE topic_id = topic.id ORDER BY created DESC LIMIT 1) AS lastpost
FROM topic
WHERE board_id = 6 AND
NOT EXISTS( SELECT id FROM topic_read_assoc WHERE topic_id = topic.id AND member_id = 489 )
) tab
WHERE last_post_time > 1288032259;
解释扩展
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 440 100.00 Using where
2 DERIVED topic ref board_id board_id 4 429 100.00 Using where
4 DEPENDENT SUBQUERY topic_read_assoc ref topic_id,member_id topic_id 4 source_forum.topic.id 6 100.00 Using where
3 DEPENDENT SUBQUERY post index topic_id created 4 NULL 1 1600.00 Using where
过滤是什么意思?
最佳答案
您能否也发布查询和 SHOW CREATE TABLE
语句?
58 确实不高,但是您正在使用临时表和文件排序。由于您所有的类型都是 ref 而不是 eq_ref,因此您必须将这些值相乘:3*2*4*58*16*1*4 = 89k rows joined(查看检查的行 - 一些表可能已被完全扫描 - 请参阅在何处使用
评论)
你能发布一个EXPLAIN EXTENDED
和SHOW WARNINGS
吗?
关于mysql - 无法复制慢速查询日志 rows_examined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4126460/
我有一个查询,根据我的慢查询日志,它有点慢...... Query_time: 8.408943 Lock_time: 0.000119 Rows_sent: 1 Rows_examined: 2
我在 mysql_slow_queries 日志中有一个查询,如下所示: 查询时间:4.642323 锁定时间:1.821996 已发送行数:14 已检查行数:27099 SET TIMESTAMP=
我有一个 MySQL 慢查询日志,显示相同的查询在几分钟内运行了两次。在此期间,表中没有添加任何内容,任何记录的关键字段也没有更改。为什么检查的行数会不同? # Time: 130615 11:35:
我正在为自己开发的应用构建一些配置文件信息。我希望调试页面显示发送的查询以及检查了多少行,而不假设 slow_log 已打开,更不用说解析它了。 回到 2006 年,我想要的是 not possibl
来自 mysql-slow-log 的日志: 查询时间:11.632750 锁定时间:1.317329 已发送行数:851 已检查行数:1649439 select record.name, dept
我正在尝试简单地“合并”12 个表的所有行。所有表加起来有 115 行。但是,如果我运行下面的查询,则在使用“explain”时会得到以下内容,并且在设置为“log-queries-not-using
当重构我的 entries 表并将 source 列拉入一个单独的 sources 表时,我正在执行更新,您可以看到在下面的 slow_query_log 中。 entries 表有 2 到 300
我有一个数据库,其中列出了相当不错的服务器(四核至强 2.0Ghz、16GB RAM、SSD 驱动器)。该数据库有大约 180,000 个列表。服务器上还没有流量,我只是用大量列表对其进行测试,以确保
我是一名优秀的程序员,十分优秀!