oracle执行计划走索引类型,SQL执行计划问题:where条件是主键(NUMBER类型字段)LIKE  :VAR,为什么执行计划不走索引?...

3b08456407a36064ab6a8a73f2c14066.png

SQL执行计划问题:where条件是主键(NUMBER类型字段)LIKE  :VAR,为什么执行计划不走索引?

中文社区 (MOSC)

数据库 (MOSC)

6 Replies

Last updated on February 26, 2013

This question is Not Answered.

环境:

ORACLE 10.2.0.4

表C_MP,数据量1100多万,主键MP_ID(是唯一索引),MP_NO是唯一索引

用PL/SQL及toad工具分析下面语句的执行计划,结果一样:

SELECT * FROM C_MP A WHERE A.MP_ID LIKE :VAR1;------执行计划全表扫描

SELECT * FROM C_MP A WHERE A.MP_NO LIKE :VAR2;-----执行计划INDEX RANGE SCAN

两个语句条件都是唯一索引,只是一个是主键条件,一个不是,为什么执行计划完全不同?

这个和数据库版本有关系吗?还是其他原因?

谢谢!

To view full details, sign in with your My Oracle Support Community account.

Don't have a My Oracle Support

Community account? Click to get started!

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.

Oracle offers a comprehensive and fully integrated stack of cloud applications and platform services. For more information about Oracle (NYSE:ORCL), visit oracle.com. © Oracle | Contact and Chat | Support | Communities | Connect with us7e74ff1c5e8f568c56d47081985382cf.png3dc927bdb53c435567ade7cd8caeb170.pngb134db6bb64e3626c8e74a908ba90592.png | Legal Notices | Terms of Use

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值