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

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

问题描述

我意识到在堆栈溢出之前已经提出了一个确切的问题,只有一个模糊的答案:链接

I realize that the exact question has been asked before on stack overflow with only a vaguely conclusive answer: link

所以这里又是。

表A:有一个整数列是可空的,还有一个索引。
查询:

Table A: Has an integer column which is nullable, along with an index. Query:

SELECT * 
FROM table 
WHERE column IS NULL 
LIMIT 10;

是否会使用索引,或者mysql会在找到10个条目之前进行全表扫描?

Will an index be used, or will mysql do a full table scan until it has found 10 entries?

推荐答案

我认为这应该会有所帮助:

i think this should be helpful:

http://dev.mysql.com/doc/refman/5.0/en /mysql-indexes.html


使用col_name IS NULL的搜索如果col_name是
索引,则使用索引。 / p>

A search using col_name IS NULL employs indexes if col_name is indexed.

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

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