Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Performance question - query with OR
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
![]() |
![]() |