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

Home -> Community -> Usenet -> c.d.o.server -> Re: Is this a good situation for an Index ?

Re: Is this a good situation for an Index ?

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Thu, 25 Sep 2003 12:21:26 +0100
Message-ID: <3f72cfb6$0$251$ed9e5944@reading.news.pipex.net>

"Mark" <marki.NOSPAM_at_libero.it> wrote in message news:_4zcb.345710$Ny5.11008401_at_twister2.libero.it...
> Hi all DBAs,
> I have a table (of about 30.000 records) with a varchar2 field 'CODE' in
 it.
> All 'CODE' have different values (even if there isn't a unique constraint
 in
> it).
> Since CODE is in the WHERE clause, is it a good situation for using an
 index
> on it ? does it have some overhead to index a non numeric column ?

Yes to the first question and No to the second, there is an overhead but no different in real life to indexing a number column. If CODE is designed to be unique then constrain it to be unique using an Unique index.

>
> A last question: if I want to retrieve rows with CODE that begins with 'A'
 ?
> will this prevent the index to be used ?

Not necessarily. WHERE CODE LIKE 'A%' might use the index depending on a number of factors, but WHERE CODE LIKE '%A1%' can't.

-- 
Niall Litchfield
Oracle DBA
Audit Commission UK
Received on Thu Sep 25 2003 - 06:21:26 CDT

Original text of this message

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