Marul,
 
1. you don't have table analyzed in which case Rule based optimizer will be used. CBO is used if atleast one of the tables in the query is ANALYZED
2. There is no data in your table. Optimizer goes for a full tablescan if it thinks that it will be moer advisable to do a full table scan. e.g. You will not use the INDEX if your book has only one page.
 
The decision of going for a full tablescan is based on DB_BLOCK_SIZE * DB_FILE_MULTI_BLOCK_READCOUNT, which tells how much data Oracle fetches at one time. If your entire table can be fetched in atleast 2 fetches, full table scan will be done instead of INDEX scan, to avoid doubling of work.
 
 
Naveen
-----Original Message-----
From: Marul Mehta [mailto:[EMAIL PROTECTED]]
Sent: Saturday, August 31, 2002 2:18 PM
To: Multiple recipients of list ORACLE-L
Subject: Function-Based Index not working

Hi,
 
Can you please help me out in solving this weird problem of funcation-based index not being used when I query the table.
This is the comand I fired and the result it returned me.
 
1. SQL> create table employees  (last_name varchar2(20));
    Table created.
 
2. SQL> CREATE INDEX upper_ix ON employees (UPPER(last_name));
    Index created.
 
Made the autotrace on and than:-
 
3. SELECT last_name FROM employees WHERE UPPER(last_name) IS NOT NULL  ORDER BY UPPER(last_name);
    no rows selected.
 
Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE
   1    0   SORT (ORDER BY)
   2    1     TABLE ACCESS (FULL) OF 'EMPLOYEES'
 
 
I fired without order by clause also but no use.
 
Now can any body please let tell me why this Oracle is having a full scan of the employee table.
 
TIA,
Marul.
 

   
 

Reply via email to