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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Performance question - query with OR

Re: Performance question - query with OR

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 10 Apr 1998 06:57:01 GMT
Message-ID: <01bd644c$a91fd650$294b989e@WORKSTATION>

The optimizer has the option for doing this rewrite internally if the cost is optimal.

However, you can supply the /*+ use_concat */ hint to make it happen anyway
without rewriting the rest of the statement..

Peter Schneider <peter.schneider_at_okay.net> wrote in article <352d59ad.22972963_at_news.ipf.net>...

> queries with or-expressions often give bad performance because the
> optimized chose to do a full table scan. You can replace such
> constructs with an equivalent union-all statement:
>
> SELECT columns
> FROM table
> WHERE ( column_1 = value1
> AND column_2 = value2
> AND column_3 = value3 )
> UNION ALL
> SELECT columns
> FROM table
> WHERE ( column_1 = value1
> AND column_2 > value2 )
> UNION ALL
> SELECT columns
> FROM table
> WHERE ( column_1 > value1 )
> ORDER BY 1, 2, 3
>
Received on Fri Apr 10 1998 - 01:57:01 CDT

Original text of this message

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