mysql 输出解释怎么看_如何解释MySQL EXPLAIN的输出?
发布日期:2021-06-24 17:07:56 浏览次数:2 分类:技术文章

本文共 720 字,大约阅读时间需要 2 分钟。

我想从entrytable中选择列文本的内容.

EXPLAIN SELECT text

FROM entrytable

WHERE user = 'username' &&

`status` = '1' && (

`status_spam_user` = 'no_spam'

|| (

`status_spam_user` = 'neutral' &&

`status_spam_system` = 'neutral'

)

)

ORDER BY datum DESC

LIMIT 6430 , 10

该表有三个指数:

> index_user(用户)

> index_datum(datum)

> index_status_mit_spam(status,status_spam_user,status_spam_system)

EXPLAIN结果是:

id select_type table type possible_keys key key_len ref rows Extra

1 SIMPLE entrytable ref index_user,index_status_mit_spam index_user 32 const 7800 Using where; Using filesort

> might_keys是MySQL可能想要使用的索引并键入MySQL实际使用的索引吗?

>为什么不使用索引index_status_mit_spam?在查询中,列的顺序与索引中的顺序相同,…

>为什么索引index_datum不用于ORDER BY?

>如何优化表索引或查询? (上面的查询需要最多3秒钟,表中有大约一百万个条目)

转载地址:https://blog.csdn.net/weixin_34007963/article/details/113304320 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:sql获取某列出现频次最多的值_「纯干货」业务sql语句写法集锦(带例子)
下一篇:mysql function 1064_mysql 创建 function 错误 1064解决方案

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月11日 05时09分43秒