Re: Union problem

From: Steve Sherman <sherman9_at_bellatlantic.net>
Date: Sat, 19 Dec 1998 09:25:48 -0500
Message-ID: <367BB76C.65ABC595_at_bellatlantic.net>


Gabri is probably right. The way you have the union written, the query will perform a "distinct" selection from the entire result set. Unions can be expensive.

  • steve

Gabri van Lee wrote:

> This kind of union will give you a distinct result st. If your source tables
> are very big this could take some time.
>
> Try using "union all" if you don't care about duplicates or if your tables
> don't contain dupes.
>
> G'luck,
> Gabri
>
> Andrew Hendrickson wrote in message ...
> >To all,
> >
> >I have a construct of :
> >
> >select a from x
> >union
> >select a from y
> >
> >The above query runs for around a couple of hours. When I stub out either
> >one of the queries it runs in seconds. Any clues? I am using this in
> >reports designer however the test script is running in PL/SQL. This seems
> >to be the pertinent information but if any thing else is needed let me
> know.
> >
> >I am in a crunch and need these queries running quickly very soon.
> >
> >TIA
> >Andy
> >
> >
Received on Sat Dec 19 1998 - 15:25:48 CET

Original text of this message