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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Which is faster: Like or = ?

Re: Which is faster: Like or = ?

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: Mon, 25 Sep 2000 21:15:21 GMT
Message-ID: <39CFC069.1556241A@edcmail.cr.usgs.gov>

Eddie,

Is there an index on column_name2? Are you using CBO or RBO?

If you are using CBO and have regularly analyzed your table, then both methods will take the same amount of time since the optimizer will perform a full table scan due to the low cardinality of the column's attributes.

If you are using RBO, then theoretically both queries should take the same amount of time. This is due to the fact that both queries should use the same index.

If there is no index on this column then both queries will require a full table scan and should take the same amount of time.

All of this assumes that extraneous conditions do not effect your results.

HTH,
Brian

Eddie wrote:
>
> Hi,
> Which is faster:
>
> Select column_name1
> from table_name
> where columnn_name2 like 'Y%'
>
> or
>
> Select column_name1
> from table_name
> where columnn_name2 = 'Y'
>
> knowing that columnn_name2 is VARCHAR2(1) and contains either 'Y' or 'N'
>
> Thank you for your help,
>
> Eddie.
 

-- 
========================================
Brian Peasland
Raytheons Systems at
  USGS EROS Data Center
These opinions are my own and do not
necessarily reflect the opinions of my 
company!
========================================
Received on Mon Sep 25 2000 - 16:15:21 CDT

Original text of this message

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