RE: question about index

From: Asif Momen <>
Date: Mon, 19 May 2008 13:38:28 -0700 (PDT)
Message-ID: <>


Its a function based index and unfortunately, it will never be used. Below is a detailed test case:

SQL> desc t

 Name                                                  Null?    Type
 ----------------------------------------------------- -------- --------------------------------
 ID                                                             NUMBER
 NAME                                                           VARCHAR2(4000)

SQL> create index t_idx1 on t('garbage');

Index created.     

SQL> set line 10000
SQL> exec dbms_stats.gather_table_stats( user, 't');

PL/SQL procedure successfully completed.

SQL> select index_name, INDEX_TYPE, num_rows from user_indexes where table_name = 'T';

INDEX_NAME                     INDEX_TYPE                    NUM_ROWS

------------------------------ --------------------------- ----------

SQL> select index_name, column_expression from user_ind_expressions where table_name = 'T';


------------------------------ -----------------------------------------------------------------
T_IDX1 'garbage'


Asif Momen

"Terrian, Thomas J Mr CTR DLA J6DIB" <> wrote: Function based index......but I am not sure how you would use it.

-----Original Message-----

[] On Behalf Of
Sent: Monday, May 19, 2008 1:55 PM
Subject: question about index

Ok i guess i'm having a brain fart, someone asked me about this and for the life of me i can't figure it out. The 2nd index, what exactly is it doing with single quotes around the column name??

SQL> create table z1(x1 number, x2 date);

Table created.

SQL> CREATE INDEX X1 ON Z1 (X1); Index created.

SQL> CREATE INDEX X2 ON Z1 ('X1'); Index created.

Thanks, Joe

You can have it: Fast, Right or Cheap, pick 2 of the 3. Fast + Right is Expensive
Fast + Cheap will be incorrect.
Right + Cheap will take a while.


-- Received on Mon May 19 2008 - 15:38:28 CDT

Original text of this message