🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.oracle.misc
Article #127

Re: SQL Statment

#127
From: Sybrand Bakker
Date: Wed, 16 Jun 1999 00:00
42 lines
2320 bytes
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@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@linux.ime.usp.br
>UIN: 5570114
>-----------------------------------------------
>
>
Technical Details
Message-ID: <929568998.21787.0.pluto.d4ee154e@news.demon.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7k8vrg$2qls@enews3.newsguy.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb53f,5fe1e418263968a5
X-Google-Attributes: gidfb53f,public
X-Google-Thread: f99a8,5fe1e418263968a5
X-Google-Attributes: gidf99a8,public
X-Google-Thread: fa4f9,5fe1e418263968a5
X-Google-Attributes: gidfa4f9,public
X-Google-Thread: 10747e,5fe1e418263968a5
X-Google-Attributes: gid10747e,public
X-Google-Thread: 1143a7,5fe1e418263968a5
X-Google-Attributes: gid1143a7,public
From: "Sybrand Bakker" <postbus@sybrandb.demon.nl>
Subject: Re: SQL Statment
Date: 1999/06/16
Message-ID: <929568998.21787.0.pluto.d4ee154e@news.demon.nl>
X-Deja-AN: 490421908
X-NNTP-Posting-Host: sybrandb.demon.nl:212.238.21.78
References: <7k8vrg$2qls@enews3.newsguy.com>
X-Trace: news.demon.nl 929568998 pluto:21787 NO-IDENT sybrandb.demon.nl:212.238.21.78
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: comp.databases.oracle.misc,comp.databases.oracle.server,comp.lang.basic.visual.database,hannover.uni.comp.oracle,relcom.comp.dbms.oracle
X-Complaints-To: abuse@demon.net