mysql索引空值吗? [英] Does mysql index null values?

查看:337
本文介绍了mysql索引空值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个mysql表,其中索引的INT列对于90%的行将为0。如果我将这些行更改为使用NULL而不是0,它们是否会被排除在索引之外,使索引缩小约90%?

I have a mysql table where an indexed INT column is going to be 0 for 90% of the rows. If I change those rows to use NULL instead of 0, will they be left out of the index, making the index about 90% smaller?

推荐答案

http://dev.mysql.com /doc/refman/5.0/en/is-null-optimization.html

MySQL可以对col_name IS NULL执行相同的优化,它可以用于col_name = constant_value。例如,MySQL可以使用索引和范围来搜索IS NULL

MySQL can perform the same optimization on col_name IS NULL that it can use for col_name = constant_value. For example, MySQL can use indexes and ranges to search for NULL with IS NULL

这篇关于mysql索引空值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆