Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to tune a SQL with 4 sbu-queries?

Re: How to tune a SQL with 4 sbu-queries?

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 25 Sep 2001 13:43:04 -0500
Message-ID: <uofnzt0ac.fsf@verizon.net>


On Tue, 25 Sep 2001, dino1.nospam_at_ms1.hinet.net wrote:

> SELECT branch_id, brand_code, branch_brand_units, branch_units,
> brand_units, units
> FROM
> (SELECT branch_id, brand_code, SUM(units) AS

[...]

> (SELECT branch_id, SUM(units) AS branch_units

[...]

> (SELECT brand_code, SUM(units) AS brand_units

[...]

> (SELECT SUM(units) AS units

[...]

Would it make sense to create a table by:

insert into blah
select branch_id, brand_code, sum(units) from orders
group by branch_id, brand_code

Then, this table could fulfill all of your subqueries, and probably pretty quickly. Maybe this is where a materialized view would come into play?

-- 
Galen Boyer
Everyone in town, now, they probably all agree,
I'm _lying_ in the bed I made.
Received on Tue Sep 25 2001 - 13:43:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US