We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
索引不会包含有NULL值的列,IS NULL,IS NOT NULL无法使用索引: 只要列中包含有NULL值都将不会被包含在索引中,复合索引中只要有一列含有NULL值,那么这一列对于此复合索引就是无效的。所以在数据库设计时,尽量使用NOT NULL约束以及默认值。
索引不会包含有NULL值的列,IS NULL,IS NOT NULL无法使用索引:
只要列中包含有NULL值都将不会被包含在索引中,复合索引中只要有一列含有NULL值,那么这一列对于此复合索引就是无效的。所以在数据库设计时,尽量使用NOT NULL约束以及默认值。
有误,可以在包含 NULL 的列上建立索引,但是这就会导致优化器在做索引选择的时候更加复杂,性能下降,因为可为 NULL 的列会使索引、索引统计和值比较都更复杂,比如进行索引统计时,count 会省略值为 NULL 的行。 -- 《小林coding》
实验:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
/main/src/mysql/indexing.md
索引的优化(使用索引的注意事项)
有误,可以在包含 NULL 的列上建立索引,但是这就会导致优化器在做索引选择的时候更加复杂,性能下降,因为可为 NULL 的列会使索引、索引统计和值比较都更复杂,比如进行索引统计时,count 会省略值为 NULL 的行。 -- 《小林coding》
实验:
The text was updated successfully, but these errors were encountered: