SQL优化

select * from (
select ip.part_no,ith1.dated indate,row_number() over(partition by ith1.part_no order by ith1.dated desc) rn
from ifsapp.inventory_transaction_hist_tab ith1,
     ifsapp.inventory_part_tab ip
where ith1.part_no=ip.part_no
and ith1.contract=ip.contract
and ith1.transaction_code='OOREC'
and ith1.date_applied>=to_date('2006-1-1','yyyy-mm-dd')
and ip.contract='SKY'
and ip.sk_part_category_db='1')
where rn=1

Explain plan:
SELECT STATEMENT, GOAL = CHOOSE                        Cost=2198        Cardinality=35506        Bytes=1349228
VIEW        Object wner=IFSAPP                Cost=2198        Cardinality=35506        Bytes=1349228
  WINDOW SORT PUSHED RANK                        Cost=2198        Cardinality=35506        Bytes=1881818
   HASH JOIN                        Cost=1883        Cardinality=35506        Bytes=1881818
    TABLE ACCESS FULL        Object wner=IFSAPP        Object name=INVENTORY_PART_TAB        Cost=136        Cardinality=10277        Bytes=164432
    TABLE ACCESS BY INDEX ROWID        Object wner=IFSAPP        Object name=INVENTORY_TRANSACTION_HIST_TAB        Cost=1724        Cardinality=93121        Bytes=3445477
     INDEX RANGE SCAN        Object wner=IFSAPP        Object name=INVENTORY_TRANSACTION_HIST7_IX        Cost=589        Cardinality=3

inventory_transaction_hist_tab 有16000000记录.我的这个SQL运行了1262 S,
在不动索引的情况下,怎样优化?
请高手支招 64.gif

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12391917/viewspace-293564/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12391917/viewspace-293564/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值