oracle 索引列更新变慢

前段时间维护数据需要将一张千万数量级表中cardno长度为9的数据cardtype更改为其他值,在cardtype和cardno上建有索引,

开始用 update card_table set cardtype='X' where cardtype='A' and length(cardno)=9 and rownum<100000

速度很快,过一段时间之后发现速度越来越慢;即使是查询

select count( cardno ) where cardtype='A' and length(cardno)=9 and rownum<100000 速度也很慢;

 

推测是由于做rangescan的时候 扫描太多不满足条件的数据,于是加上 index_desc的hint,果然查询快了很多

于是将更新修改为 update card_table set cardtype='X' where cardtype='A' and  cardno like '1%'  and length(cardno)=9 and rownum<100000

限定更新范围,果然速度有所提升。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值