An example analysis of Oracle query not going index

Source: Internet
Author: User

Like after% position does not go index problem

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‘;——不走索引

Inconsistent query field type causes implicit conversions without indexing problems

create table t3(id varchar2(10),name varchar2(10));——创建表t3insert 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大大提升

Another: Do not use SELECT ' * ' From ... When you write a select asterisk, Oracle queries the data dictionary for conversion to a specific column name, increasing the cost of Oracle, and suggests writing a specific field name.
Attached: index information for query tables
Select Index_name,index_type,table_owner,table_name,tablespace_name from user_indexes where table_name= ' T1 ';

An example analysis of Oracle query not going index

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.