Re: Long query execution times for union

From: Rich Bernat <rber_at_chevron.com>
Date: 1996/08/13
Message-ID: <4ur4i3$cje_at_gaudi.lahabra.chevron.com>#1/1


This is not particularly the answer, but my experience with unions is that each segment of the union is evaluated and stored before the in temp tables (your temp space) until it is all done, then the where clause against the view applied. Run EXPLAIN PLAN against your union view and the tables anc compare the results.

Example

A query against table A or table B runs 10 sec. A query against a view with a select of a column in the view runs much longer than the two. I also believe that indexes are not applicable.

Please correct/enlighten me if I am wrong. Rich Bernat

In <3210E749.41C6_at_chevron.com>, "C. Eric Ladner" <clad_at_chevron.com> writes:
>I've got two selects that are unioned together. If I execute the two
>selects seperatly, they each execute in about 5 seconds. Together (in a
>view with a union) they take for ever (10+ minutes). What's the deal
>with that?
>
>I am adding an extra condition to the selects which I'm also adding to
>the view. But, the name of the column that I'm restricting is different
>in each view. How does that work anyway?
>
>Basically I've got this:
>
>create view foo as
> select calendar_date, pasbal_code, value (etc, etc..)
> union
> select reading_date, pasbal_code, value (etc, etc..)
>;
>
>The reading/calendar date is the field I'm searching on. In the
>description of the view, it shows up as calendar_date.
>
>Any hints, clues, suggestions?
>
>========================================================================
>Eric Ladner | UNIX/Oracle/Passport Sys-Administration, General
>clad_at_chevron.com | Applications Development, etc., etc.
>========================================================================
Received on Tue Aug 13 1996 - 00:00:00 CEST

Original text of this message