Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Mysql-据库索引总结1-使用索引的注意事项中,“加索引的列设置为 NOT NULL ,而进行全表扫描” #758

Closed
nudt681 opened this issue Apr 28, 2020 · 1 comment
Labels
enhancement New feature or request or suggestion

Comments

@nudt681
Copy link

nudt681 commented Apr 28, 2020

加索引的列设置为 NOT NULL ,否则将导致引擎放弃使用索引而进行全表扫描
经过试验把某一列设置为default null,where是可以走索引

@LiWenGu
Copy link
Contributor

LiWenGu commented Apr 29, 2020

先说结论,你是对的,确实会走索引,文章中描述是有问题的。
另外 index 是否设置 NULL 是不影响性能的

And, in case you’re wondering, allowing NULL values in the index really doesn’t impact performance
来源:高性能MySQL第四章

NULL 值的索引查找流程参考:https://juejin.im/post/5d5defc2518825591523a1db

@LiWenGu LiWenGu mentioned this issue Apr 29, 2020
@Snailclimb Snailclimb added the enhancement New feature or request or suggestion label May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request or suggestion
Projects
None yet
Development

No branches or pull requests

3 participants