一、查看和建立索引select * from user_indexes where table_name = "student"
create index i_student_num on student(num)
相关阅读:由Oracle索引来理解ArcSDE索引 http://www.linuxidc.com/Linux/2012-10/72184.htmOracle索引技术之如何建立最佳索引 http://www.linuxidc.com/Linux/2012-09/70996.htmOracle索引列NULL值引发执行计划该表的测试示例 http://www.linuxidc.com/Linux/2012-09/69938.htmOracle索引 主键影响查询速度 http://www.linuxidc.com/Linux/2011-12/48588.htmOracle索引扫描 http://www.linuxidc.com/Linux/2012-03/56644.htm
二、使用索引的注意点①类型匹配
若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 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12Oracle数据库冷备份的还原及emca重建资料库Oracle PL/SQL基础 游标相关资讯 Oracle索引 Oracle查看索引 Oracle建立索引
- Oracle跳跃式索引扫描测试 (08月09日)
- 关于Oracle位图索引内部浅论 (09/17/2015 19:23:59)
- Oracle 索引的可见与隐藏(visible (07/18/2015 09:41:42)
| - Oracle外键要建立索引的原理和实验 (05月28日)
- Oracle组合索引与回表 (08/07/2015 18:11:53)
- Oracle 索引基本原理 (04/12/2015 18:03:58)
|
本文评论 查看全部评论 (0)