Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Statment
Witthout looking at the explain plan that's very difficult to tell, though
usually both the group by and the order by result in sorts.
But why don't you just write an ordinary join, like this
select rep.repnomfan, sum(pedtotinf) venda
from puket.avpeca, puket.coreca rep
where avpeca.repcod = rep.repcod /* assuming you are using the rule based
optimizer and you want coreca to be the driving table */
and rep.repstacod = 'A'
group by rep.repnomfan
order by venda
This should be fairly efficient.
Personally I don't see why you need inline sql, and I have a feeling the
inline sql is giving you performance headaches...
Hth,
Sybrand Bakker, Oracle DBA
Daniel Cukier wrote in message <7k8vrg$2qls_at_enews3.newsguy.com>...
>Is there anything wrnog with this SQL statment?
>
>"select rep.repnomfan, sum(pedtotinf) venda
>from puket.avpeca, (select repcod, repnomfan from puket.coreca where
>repstacod = 'A') rep
>where rep.repcod = avpeca.repcod
>group by rep.repnomfan
>order by venda"
>
>table puket.avpeca has 35000 rows
>
>the search takes 6 secons. It is normal?
>
>
>-----------------------------------------------
>Daniel Cukier
>danicuki_at_linux.ime.usp.br
>UIN: 5570114
>-----------------------------------------------
>
>
Received on Wed Jun 16 1999 - 16:37:51 CDT
![]() |
![]() |