Re: oracle/sql "where clause"

From: g wayne nichols <gwn_at_cyber2.servtech.com>
Date: 1996/10/02
Message-ID: <52tugv$ao3_at_cyber2.servtech.com>#1/1


In <johnv.0a4n_at_acix.DIALix.oz.au> johnv_at_acix.DIALix.oz.au (John Verhoeven) writes:

>In article dated Thu, 26 Sep 1996 06:23:00 +0100, AMARENDRA B NETTEM (nettama_at_charlie.cns.iit.edu) wrote:
>> Paul Chow wrote:
>> > does anyone know whether one of the following two where clauses is more efficient
>> > than the other ...
>> >
>> > [1]. select ...
>> > from ...
>> > where (field_x='K' or field_x='L' or field_x='M')
>> >
>> > [2]. select ...
>> > from ...
>> > where field_x in ('K','L','M')
 

>> Second query is efficient than the first one. But make there are no NULL
>> value for that field when using IN operator.
 

>Nope. Neither is more efficient than the other.
 

>The second may be quicker for you to write, but the parser converts it
>into the first form for execution anyway.
 

>Do an explain plan on both queries and you will see that they are treated
>the same.

OK, then how about:

     [3].  select ...
           from ...
           where INSTR('KLM', field_x) > 0
-- 
------------------------------------------------------------------------------
Computer General		Rochester, NY			(716) 436-6372
      "... providing general computer solutions to specific business problems"
                              gwn_at_servtech.com
Received on Wed Oct 02 1996 - 00:00:00 CEST

Original text of this message