UNION ALL Alternative in Oracle 10g

Profile: SulekhaOracle
Tags:
Oracle 10g
Select Col1,Col2
(
Select Col1,Date1 from Table1
UNION ALL

Select Col1,Date1 from Table2

)

WHERE COl1 > date - 4

And Col1 < date + 2

Orderby Col1 Desc
The above query performance is too slow.When we add the Where condition the query gets slow.Is any other way we can perform the above query.I tried the below query:
Select Col1,Col2
(

Select Col1,Date1 from Table1 WHERE COl1 > date - 4 And Col1 < date + 2

UNION ALL Select Col1,Date1 from Table2 WHERE COl1 > date - 4 And Col1 < date + 2

) Orderby Col1 Desc
By the above query the performance improved but still as I need to use the Order By outside to get the dates in descending order the query is taking time. Please give suggestions to restructure this query.

Reply to this discussion

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members reply.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: