Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating an index on a function
Message
De
22/08/2001 03:51:29
 
 
À
21/08/2001 15:05:14
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Québec, Canada
Information générale
Forum:
Oracle
Catégorie:
Autre
Divers
Thread ID:
00546932
Message ID:
00547120
Vues:
15
This message has been marked as a message which has helped to the initial question of the thread.
These are called function based indexes. To use them you need Enterprise Edition. On my 8iEE server I do so like this:
SQL>  create table test (col1 varchar2(20));

Table created.
SQL>  create index function_test_idx on test (SUBSTR(col1,1,1));

Index created.
It might not be necessary to do this depends on what you are trying to do. Just build the index as normal and it should have the same effect. When using queries like:

where col1='A'


If you want to make the indexes smaller. You should look at the COMPRESS argument in the create index statement. In an nutshell if you have data like.

TESTxxx
TESTyyy
TESTzzz

Using the compress argument will only store
xxx
yyy
zzz

I.E. it will compress common data so that it is only stored once.
This avoid the need for SUBSTR(col1,4). Thus it cuts down on the number of blocks need to store then index so you get less block reads when you do an index scan.

Hope that helps...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform