gpt4 book ai didi

MySQL 解释 : how to calculate total examined rows?

转载 作者:行者123 更新时间:2023-11-28 23:14:58 27 4
gpt4 key购买 nike

我在下面有一个解释结果,问题是如何计算检查的总行数?请详细解释一下~(先问问题~如有错误请指正,不胜感激)

id  select_type type    possible_keys   key_len rows  
1 PRIMARY ALL 1423656
1 PRIMARY eq_ref PRIMARY 8 1
1 PRIMARY ref 152 1
1 PRIMARY ALL 138
1 PRIMARY ALL 1388
1 PRIMARY ALL 1564
3 DERIVED ALL 1684
3 DERIVED eq_ref PRIMARY 8 1
2 DERIVED ALL 141

最佳答案

来自手册:https://dev.mysql.com/doc/refman/5.7/en/explain-output.html

rows (JSON name: rows)

The rows column indicates the number of rows MySQL believes it must examine to execute the query.

For InnoDB tables, this number is an estimate, and may not always be exact.

您的一个表有 140 万个非常高的数字,但 possible_keys 列是空的。这意味着这是一个急需索引的表。

要检查的行数很大,就是这个意思。 Mysql 需要读取所有这些行才能为您提供结果。

如果您发布了您的表和查询,我们本可以帮助您弄清楚这些索引应该是什么。

关于MySQL 解释 : how to calculate total examined rows?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44283741/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com