Documente Academic
Documente Profesional
Documente Cultură
To improve performance on joins of multiple tables, index columns used for joins.
Page 3 of 22 Managing Indexes
2/21/2013 http://docs.oracle.com/cd/B19306_01/server.102/b14231/indexes.htm
Note:
Primary and unique keys automatically have indexes, but you might want
to create an index on a foreign key.
Small tables do not require indexes. If a query is taking too long, then the table might have
grown from small to large.
Some columns are strong candidates for indexing. Columns with one or more of the following
characteristics are candidates for indexing:
Values are relatively unique in the column.
There is a wide range of values (good for regular indexes).
There is a small range of values (good for bitmap indexes).
The column contains many nulls, but queries often select all rows having a value. I n this case,
use the following phrase:
Note:
CREATE I NDEX stores the timestamp of the most recent function used in
the function-based index. This timestamp is updated when the index is
validated. When performing tablespace point-in-time recovery of a
function-based index, if the timestamp on the most recent function used in
the index is newer than the timestamp stored in the index, then the index
is marked invalid. You must use the ANALYZE I NDEX. . . VALI DATE
STRUCTURE statement to validate this index.
Page 14 of 22 Managing Indexes
2/21/2013 http://docs.oracle.com/cd/B19306_01/server.102/b14231/indexes.htm
To illustrate a function-based index, consider the following statement that defines a function-based
index (ar ea_i ndex) defined on the function ar ea( geo) :
CREATE I NDEX ar ea_i ndex ON r i ver s ( ar ea( geo) ) ;
In the following SQL statement, when ar ea( geo) is referenced in the WHERE clause, the optimizer
considers using the index ar ea_i ndex.
SELECT i d, geo, ar ea( geo) , desc
FROM r i ver s
WHERE Ar ea( geo) >5000;
Table owners should have EXECUTE privileges on the functions used in function-based indexes.
Because a function-based index depends upon any function it is using, it can be invalidated when a
function changes. If the function is valid, you can use an ALTER I NDEX. . . ENABLE statement to
enable a function-based index that has been disabled. The ALTER I NDEX. . . DI SABLE statement lets
you disable the use of a function-based index. Consider doing this if you are working on the body of
the function.
See Also:
Oracle Database Concepts for more information about function-based
indexes