设为首页 加入收藏

TOP

Oracle中查看建立索引和使用索引的注意点
2014-11-23 21:43:05 来源: 作者: 【 】 浏览:20
Tags:Oracle 查看 建立 索引 使用 注意
一、查看和建立索引
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
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Linux下安装Oracle的过程和涉及的.. 下一篇一张图片说明Oracle数据库网络连..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: