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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Function Based Index - Not Used ???

RE: Function Based Index - Not Used ???

From: Cunningham, Gerald <Gerald.Cunningham_at_usi.net>
Date: Thu, 29 May 2003 08:35:04 -0800
Message-ID: <F001.005A5AB5.20030529083504@fatcity.com>


Wow, there sure are a lot of Scott's in India...

-----Original Message-----
Sent: Thursday, May 29, 2003 9:30 AM
To: Multiple recipients of list ORACLE-L

JP,

In the EXPLAIN PLAN, it says "Card=262146", indicating that the query expects to retrieve over a quarter-million rows. Is that in fact correct?

If so, the CBO is making the correct decision to perform a FULL table scan. What was the comparison of elapsed times between the two plans, the one being the FULL table scan and the other being the indexed scan? I bet the FULL table scan query finished much more quickly...

You've got everything configured correctly -- simply a lousy index. The CBO has to be coerced into using the index because it is not the best plan to use.

Hope this helps...

-Tim

on 5/28/03 11:54 PM, Prem Khanna J at jprem_at_kssnet.co.jp wrote:

> Guys,
>
> create table Tab1 ( name varchar2(100),age int,state
> varchar2(100),country varchar2(100));
>
> insert into tab1 values ('SCOTT',25,'TN','India');
>
> I have 20,00,000 records like above.
>
> create index idx1 on tab1 (upper(name));
>
> analyze table tab1 compute statistics;
> analyze index idx1 compute statistics;
>
> select age from tab1 where upper(name)='SCOTT'; ---> this will return
> around 50 records.
>
> ---------------------------------------------------------
> 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2458 Card=262146
Bytes=2097168)
> 1 0 TABLE ACCESS (FULL) OF 'TAB1' (Cost=2458 Card=262146
Bytes=2097168)
>
> --- INIT.ORA ----------------------
> optimizer_mode=choose
> compatible=8.1.0
> query_rewrite_enabled=true
> query_rewrite_integrity=trusted
> -----------------------------------
> It's Oracle 8.1.6/Win2K.
>
> When i add a HINT, IDX1 is used.Why is it so ?
> Why this SELECT does not use index IDX1 w/o a hint ?
>
> TIA.
> Jp.
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Tim Gorman
  INET: tim_at_sagelogix.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the
message BODY, include a line containing: UNSUB ORACLE-L (or the name of
mailing list you want to be removed from).  You may also send the HELP
command for other information (like subscribing).


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Cunningham, Gerald
  INET: Gerald.Cunningham_at_usi.net

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu May 29 2003 - 11:35:04 CDT

Original text of this message

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