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

Home -> Community -> Usenet -> c.d.o.tools -> Re: union problem

Re: union problem

From: Dave Henderson <dave_at_oracle-consultant.co.uk>
Date: 12 Jun 2001 14:36:20 -0700
Message-ID: <3db0aa40.0106121336.4333ac29@posting.google.com>

Hi Kazelot,

It sure is possible, as you have found!

A "union" takes the results of each of the two constituent queries and then sorts them so that it does not return duplicates (i.e. if the same result row exists in each result set, the union will return only one).

If you don't require this filtering of duplicates, use a "union all" instead (eliminates the nasty old sort). If the filter is necessary, have a look at where the sort is occurring. If it is happening on disk (i.e. in temp space), you could perhaps consider increasing sort_area_size to accommodate the sort in memory (much quicker than disk sorts).

Hope this helps,

Dave.



http://www.oracle-consultant.co.uk

<kazelot_at_thenut.eti.pg.gda.pl> wrote in message news:<Pine.LNX.4.33.0106121216580.13915-100000_at_thenut.eti.pg.gda.pl>...
> I have two sql queries joined with union.
> Each query separately executes in about 0.1s.
> query1 union query2 takes more then 50s, which is about 500 times more.
>
> Is it possible? I mean it is because I got this results :-), but what what
> could happend?
>
> Thanks for any suggestions,
> kazelot
Received on Tue Jun 12 2001 - 16:36:20 CDT

Original text of this message

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