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 -> many Union all vs. inserting results to temp table

many Union all vs. inserting results to temp table

From: <deann15_at_yahoo.com>
Date: 21 Mar 2006 14:54:41 -0800
Message-ID: <1142981681.639856.314160@v46g2000cwv.googlegroups.com>


I have a dynamic query which basically loop through an ID field in a table then build queries dynamically then union all the queries together, such as:

select * from (complex subquery) where a = 1 union all
select * from (complex subquery) where a = 2 union all
select * from (complex subquery) where a = 3 ...

Depending on what a user select, the query could have a few thousand unions. My question is about scalability and performance: will it be better if inserting the results of every query to a global temp table then select * from the temptable instead of executing the long query all at once?

Thanks! Received on Tue Mar 21 2006 - 16:54:41 CST

Original text of this message

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