oracle 查询不走索引的范例分析
2018-01-19 22:22
555 查看
like 后%位置不走索引问题
查询字段类型与表字段类型不一致导致隐式转换,不走索引问题
另:不要用select '*' from........写select 星号时,oracle会查询数据字典再转换成具体的列名,增加oracle的开销,建议写具体字段名称。
附:查询表的索引信息
select INDEX_NAME,INDEX_TYPE,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME from user_indexes where table_name='T1';
create table t2 as select * from dba_objects;——创建表 create index idx_t2_name on t2(object_name);——创建索引 set autotrace on ——开启执行计划跟踪 select * from t2 where object_name like 'DE%';——走索引 select * from t2 where object_name like '%DE';——不走索引
查询字段类型与表字段类型不一致导致隐式转换,不走索引问题
create table t3(id varchar2(10),name varchar2(10));——创建表t3 insert into t3 select * from dba_objects;——插入数据 commit; ——提交 create index idx_t3_id on t3(id);创建id索引 set autotrace on——开启执行计划自动跟踪 select * from t3 where id=7000;——不走索引,会出现隐式转换,filter(TO_NUMBER("ID")=7000) select * from t3 where id='7000';——走索引,cost大大提升
另:不要用select '*' from........写select 星号时,oracle会查询数据字典再转换成具体的列名,增加oracle的开销,建议写具体字段名称。
附:查询表的索引信息
select INDEX_NAME,INDEX_TYPE,TABLE_OWNER,TABLE_NAME,TABLESPACE_NAME from user_indexes where table_name='T1';
相关文章推荐
- Oracle查询隐式类型转换不走索引
- Oracle查询不走索引
- 深入理解Oracle索引(23):6 种常见不走索引的原因分析
- Oracle查询数据库的索引字段以及查询用索引
- Oracle 重新解析表中索引令其查询速度加快
- oracle执行计划不走索引的原因总结
- Oracle表与索引的分析及索引重建
- oracle 索引字段包含date类型,使用spring jdbc更新时不走索引,而是走table access full的问题
- oracle 索引失效的情况分析
- Oracle层次查询和分析函数在号段选取中的应用
- 使用Oracle的instr函数与索引配合提高模糊查询的效率 一般来说,在Oracle数据库中,我们对tb表的name字段进行模糊查询会采用下面两种方式: 1.select * from tb wh
- oracle优化- 索引代价分析
- Oracle表与索引的分析及索引重建
- Oracle教程之查询出每个雇员姓名的长度范例
- Oracle性能分析5:数据访问方式之索引结构和扫描方式介绍
- oracle 使用闪回事务查询是 视图flashback_transaction_query中列operation为unknown 问题分析
- Oracle index】SQL语句无法走索引的一些情况分析及语句改写思路
- 如何在oracle中查询所有用户表的表名、主键名称、索引、外键等 - Oracle 基础和管理_files
- SQL 优化之该走索引却不走索引的分析(二)
- oracle查询表, 索引,唯一约束,字段