---
title: "Oracle索引失效的原因"
author: "button"
date: "2014-03-10T14:57:17Z"
tags: []
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2014-03-10T14:57:17Z"
id: 2028888
url: "https://jic.iteye.com/blog/2028888"
---

容易引起oracle索引失效的原因很多：

1、在索引列上使用函数。如SUBSTR,DECODE,INSTR等，对索引列进行运算.需要建立函数索引就可以解决了。

2、新建的表还没来得及生成统计信息，分析一下就好了

3、基于cost的成本分析，访问的表过小，使用全表扫描的消耗小于使用索引。

4、使用&lt;&gt;、not in 、not exist，对于这三种情况大多数情况下认为结果集很大，一般大于5%-15%就不走索引而走FTS。

5、单独的&gt;、&lt;。

6、like "%\_" 百分号在前。

7、单独引用复合索引里非第一位置的索引列。

8、字符型字段为数字时在where条件里不添加引号。

9、当变量采用的是times变量，而表的字段采用的是date变量时.或相反情况。

10、索引失效，可以考虑重建索引，rebuild online。

11、B-tree索引 is null不会走,is not null会走,位图索引 is null,is not null  都会走、联合索引 is not null 只要在建立的索引列（不分先后）都会走。