Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to tune a SQL with 4 sbu-queries?
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