跳转到主内容
新派编程网 - 新潮编程理念,全新技术课堂!

Oracle中查看建立索引和使用索引的注意点

一、查看和建立索引select * from user_indexes where table_name =

一、查看和建立索引select * from user_indexes where table_name = 'student'create index i_student_num on student(num)

相关阅读:

由Oracle索引来理解ArcSDE索引Oracle索引技术之如何建立最佳索引Oracle索引列NULL值引发执行计划该表的测试示例Oracle索引 主键影响查询速度Oracle索引扫描

二、使用索引的注意点

①类型匹配若student中num列是varchar类型,语句select * from student where num = 100该语句被转化为select * from student where to_number(num) = 100,,该列的索引就失效了。

②避免索引列参与计算索引失效:select * from student where num * 10 > 10000索引有效:select * from student where num > 10000 / 10③不要对索引列使用IS NULL或IS NOT NULL原则上对某一个列建立索引的时候,该列就不应该允许为空。

索引失效:select * from student where num is null

相关文章