> For the complete documentation index, see [llms.txt](https://tuonioooo-notebook.gitbook.io/performance-optimization/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tuonioooo-notebook.gitbook.io/performance-optimization/sqlyou-hua-pian/mysqlyou-hua-pian/xiang-jie-suo-yin-ji-you-hua/bu-zou-suo-yin-de-qing-kuang.md).

# 不走索引的情况

1. 没有查询条件没where 后面的内容  查询条件没索引.
2. 查询条件没引导列.  没有有索引的列.
3. 查询数量是超过表的一部分,mysql30%,oracle 20%.
4. 索引失效,索引插入过多可能发生意外失效.
5. 查询条件使用函数在索隐列上面.计算等.
6. 查询条件使用函数在索引列上，或者对索引列进行运算，运算包括(+，-，\*，/，! 等). 错误的例子：select \* from test where id-1=9; 正确的例子：select \* from test where id=10;
7. 对小表查询.
8. 统计数据不真实.
9. CBO计算走索引花费过大的情况.
10. 查询条件字符串和数字等的隐式转换.
11. 使用不等于（!= 或者<>）的时候MySQL 无法使用索引.
12. %% 两个百分号不走索引,开始的结尾的百分号走索引.
13. not in    、not exist  、or   、 in 尽量转换为union.
14. time 和date 时间格式不一致.
15. B-tree索引is null不会走,is not null会走,位图索引 is null,is not null 都会走.
16. 索隐列避免空列,一般选非空的列.
17. Join 语句中Join 条件字段类型不一致的时候MySQL 无法使用索引.
18. 过滤字段使用了函数运算后（如abs(column)），MySQL 无法使用索引.
19. MyISAM 存储引擎索引键长度总和不能超过1000 字节.
20. BLOB 和TEXT 类型的列只能创建前缀索引.
