In this article i would like to give you one special type of index with its advantages as well as disadvantages which is oracle function based index. A function based index calculates the result of a function that involves one or more columns and stores that result in the index. Oracle 8i introduced functionbased indexes to counter this problem. In addition to the prerequisites for creating a conventional index, if the index is based on userdefined functions, then those functions must be marked deterministic. In oracle, when you create an index on a column such as a btree index, you need to mention the value exactly without modification for the index to be used. Id like to use function based indexes on index organized tables. See creating a functionbased index on a type method. Use the create index statement to create an index on. Disable statement lets you disable the use of a functionbased. This example demonstrates how a functionbased index can be used to sort based on the collation. Oracle database sql language reference create index syntax and semantics. The value of the function or expression is precomputed and stored in the index. One or more scalar typed object attributes of a table or a cluster.
A functionbased index improves the performance of queries that use the index. Tom, your latest book has an innovative way of using a functionbased index on a yn processed column. See oracle database plsql language reference for the example that creates this function. To encounter this, oracle introduced function based indexes.
Oracle will still use a function based indexes with columns that contain null i think you misinterpreted the documentation. If you omit schema, then oracle database creates the index in your own schema. You can create a functionbased index on an object column or ref column. See creating a function based index on a type method. The schema that contains the index must also have a quota for the tablespace intended to contain the index, or the unlimited tablespace system privilege. A functionbased index allows you to match any where clause in an sql statement and remove unnecessary largetable fulltable scans with superfast index range scans. How the function based index works in oracle youtube. Oracle function based index with real life examples. One of the most important oracle silver bullets is the functionbased index. Functionbased indexes facilitate queries that qualify a value returned by a function or expression. In my previous article i have given different ways to create index with multiple examples. Enable statement to enable a functionbased index that has been disabled. Using indexes in database applications oracle docs. Administrators guide for information about creating functionbased indexes.
The following example seems to be contradicting with the quote in the manual. To create or replace a standalone stored function in another users schema, you must have the create any procedure system privilege. Oracle functionbased index explained by pratical examples. I thought i would give it a try, but ran into a problem in that the index. You can create indexes on columns to speed up queries. The following shows the syntax of creating a function based index. To invoke a call specification, you may need additional privileges, for example, execute privileges on a c library for a c call specification. A functionbased index, on the other hand, is an index that is created on the results of a function or expression. A nested table storage table for indexing a nested table column.
1562 185 1050 332 110 1531 727 180 1238 24 1168 1112 206 876 961 1601 237 44 487 17 98 1083 779 573 39 1407 352 1067