使用索引的误区之二:使用了 和 != 操作符,导致查询不使用索引[2]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 lunar2000 的 blog

|*  1 |  table access full   | emp         |       |       |       |

--------------------------------------------------------------------

predicate information (identified by operation id):

---------------------------------------------------

   1 - filter("emp"."empno"<>10)

note: rule based optimization

 

14 rows selected

 

 

将上面的查条件“empno <>10转换成“empno <10 and empno>10后,就可以使用索引了

select empno from emp where empno <10 and empno>10;

 

plan_table_output

--------------------------------------------------------------------------------

--------------------------------------------------------------------

本文关键:使用索引的误区之二:使用了 和 != 操作符,导致查询不使用索引
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top