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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Fastest access on varchar keyed table...

Re: Fastest access on varchar keyed table...

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 23 Nov 2001 13:31:31 -0800
Message-ID: <9tmf7j0aqs@drn.newsguy.com>


In article <9tm3ks$uqd$06$1_at_news.t-online.com>, Andreas says...
>
>Hi,
>
>we have a table like
>table emp (
> fullname varchar2(250),
> age number(3)
> )
>with a few thousand entries
>(on a simple, small "default installation" DB)
>
>No matches on other tables are made. The table is
>written once/rarely and read very often.
>
>What is the fastest way to get the age of "John Doe" ?
>

use an IOT

create table emp ( fullname varchar2(250) primary key, age number(3) );

or, if the table is a relatively static size, consider a cluster (hash cluster) with a cluster key on fullname.

>A simple "select age from emp where fullname='John Doe'" ?
>Could it make the query faster if we extended the
>table by a
>
> lengthofname number(3)
>
>and do a
>
>select age from emp where lengthofname=8 and fullname='John Doe' ?
>
>--
> Andreas
>Who doesn't live can never die
>

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Fri Nov 23 2001 - 15:31:31 CST

Original text of this message

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