Oracle中查看建立索引和使用索引的注意点
2023-09-27 14:27:22 时间
一、查看和建立索引
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 9i 9.2.0.4 linux i386 安装:闲来尝试:各种问题、及解决
- Oracle 查询表的索引包含的字段
- oracle主键约束、唯一键约束和唯一索引的区别
- oracle schema
- oracle--表空间基本操作
- oracle查看表索引
- Oracle 创建索引
- 【三思笔记】 全面学习Oracle分区表及分区索引
- 【索引】Oracle之不可见索引和虚拟索引的比对
- oracle 列授权相关测试
- 分析oracle索引空间使用情况,以及索引是否须要重建
- Oracle性能优化之 Oracle里的优化器
- Linux平台下使用rman进行oracle数据库迁移
- linux 6.4平台利用rman迁移oracle 11g r2数据库
- Oracle笔记(十三) 视图、同义词、索引
- Oracle 学习笔记 12 -- 序列、索引、同义词
- Oracle入门笔记(九)——视图、序列、索引、同义词和权限等
- oracle index 索引总结
- oracle点知识8——索引组织表
- Oracle Spatial 创建空间表、添加空间原表信息、添加删除空间索引
- Oracle索引
- oracle创建索引后sqlldr导入错误
- oracle完全删除表空间