Re: How to get query to use an index
- From: Tim Gorman <tim@xxxxxxxxx>
- To: "'oracle-l'" <oracle-l@xxxxxxxxxxxxx>
- Date: Wed, 12 Apr 2006 13:04:29 -0600
Michael,
Very interesting! Expanding your test to include just using plain UNION
operator (which performs a DISTINCT), the results become correct.
So, I had always thought UNION-ALL was equivalent to an OR'd expression; is
it really UNION?
Thanks!!!
-Tim
on 4/12/06 12:25 AM, Michael Garfield Sørensen, CeDeT at mgs@xxxxxxxx wrote:
> SQL> create table mgsx(c1 varchar2(10),c2 varchar2(10));
>
> Tabel er oprettet.
>
> SQL> insert into mgsx values('x','y');
>
> 1 række er oprettet.
>
> SQL> insert into mgsx values('x','x');
>
> 1 række er oprettet.
>
> SQL> insert into mgsx values('y','x');
>
> 1 række er oprettet.
>
> SQL> select * from mgsx where c1 like 'x%' or c2 like 'x%';
>
> C1 C2
> ---------- ----------
> x y
> x x
> y x
>
> SQL> select * from mgsx where c1 like 'x%'
> 2 union all
> 3 select * from mgsx where c2 like 'x%';
--
http://www.freelists.org/webpage/oracle-l
- Follow-Ups:
- Re: How to get query to use an index
- From: David Aldridge
- Re: How to get query to use an index
- From: Gints Plivna
Other related posts:
- » How to get query to use an index
- » Re: How to get query to use an index
- » Re: How to get query to use an index
- » RE: How to get query to use an index
- » Re: How to get query to use an index
- » RE: How to get query to use an index
- » Re: How to get query to use an index
- » Re: How to get query to use an index
- » RE: How to get query to use an index
- » Re: How to get query to use an index
- » Re: How to get query to use an index
- » Re: How to get query to use an index
- » RE: How to get query to use an index
- » Re: How to get query to use an index
- » Re: How to get query to use an index
- Re: How to get query to use an index
- From: David Aldridge
- Re: How to get query to use an index
- From: Gints Plivna