日期:2014-05-16 浏览次数:20890 次
请各位大虾帮忙看看这条指令有没有优化的空间~
现在执行一次大概要1秒,生产环境每次执行需要循环传值,大概循环执行几百次..
数据量说明:a表60万 b表180万 e表260万
SELECT cucy,up,qty,signdat
FROM
(
select
nvl(a.cucy,a.qpcucy) cucy,
nvl(b.ytxup,b.qpytxup) up ,
NVL(b.cprqty,b.caqqty) qty,
a.signdat,a.vndno
from txf000hfc21 a,txf000hfc22 b,txf000hba32 e
where a.purco=b.purco and a.purshno= b.purshno and a.vndno=b.vndno AND a.purco=e.purco AND a.purshno=e.purshno AND b.puritm=e.puritm
and a.purco='5' and Nvl(b.ordhmat,e.mtno)='A2P1P34400019WA7' AND a.rckmk='Y'
ORDER BY a.signdat desc, up,qty
)
WHERE ROWNUM=1;
执行计划:
Plan hash value: 3415185491
------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 38 | | 8428 (1)| 00:01:42 |
|* 1 | COUNT STOPKEY | | | | | | |
| 2 | VIEW