Oracle中查看建立索引和使用索引的注意点
2015-03-23 17:17
281 查看
此文转自http://www.2cto.com/database/201404/294632.html
一、查看和建立索引
select * from user_indexes where table_name = ‘student’
create index i_student_num on student(num)
二、使用索引的注意点
①类型匹配
若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
一、查看和建立索引
select * from user_indexes where table_name = ‘student’
create index i_student_num on student(num)
二、使用索引的注意点
①类型匹配
若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
相关文章推荐
- Oracle中查看建立索引和使用索引的注意点
- Oracle中查看建立索引和使用索引的注意点
- Oracle中查看建立索引和使用索引的注意点
- Oracle使用并行索引需要注意的问题
- Oracle使用并行建索引须要注意的问题
- 使用NOSQL的MongoDB时建立索引需要注意的几点建议和Explain优化分析 (转)
- 查看Oracle执行计划的几种方法 / oracle中DateTime类型的字段,建立索引后,查寻时索引如何生效?/ oracle 中sql语句怎么加多个强制索引
- 查看oracle指定的表哪些列使用索引
- Oracle学习(四)---索引说明和使用注意
- Mysql建立索引的时机,使用索引的注意事项和不足之处
- Oracle使用强制索引的方法与注意事项
- 使用NOSQL的MongoDB时建立索引需要注意的几点建议和Explain优化分析
- sqlserver查看索引使用情况以及建立丢失的索引
- spool命令、创建一个表,创建并且copy表,查看别的用户下的表,rowid行地址 索引的时候使用,表的增删改查,删除表,oracle的回收站
- 【DB.Oracle】create index注意n如果是大表建立索引,切记加上ONLINE参数
- 使用NOSQL的MongoDB时建立索引需要注意的几点建议和Explain优化分析
- Oracle使用强制索引注意事项
- spool命令、创建一个表,创建而且copy表,查看别的用户下的表,rowid行地址 索引的时候使用,表的增删改查,删除表,oracle的回收站
- 使用NOSQL的MongoDB时建立索引需要注意的几点建议和Explain优化分析
- Oracle使用并行建索引需要注意的问题