The Oracle FBI index is a new feature of Oracle8i. The following describes the concept and usage of the Oracle FBI index. If you are interested in the Oracle FBI index, take a look.
An important new feature of Oracle8i is the addition of the function-based index, which is referred to as the FBI ). With this feature, Oracle DBA can use functions or expressions in the index. These functions allow Oracle functions and PL/SQL functions.
A common problem encountered by DBA during SQL statement optimization is how to optimize statements that use functions in the WHERE clause. In the past, using a function in the WHERE clause made indexes on the table unusable, making it difficult to improve the statement performance.
Example:
The cost-based optimizer is used to create a standard B-tree index on the SURNAME column.
- SQL>create index non_fbi on sale_contacts (surname);
- SQL>analyze index non_fbi compute statistics;
- SQL>:analyze table sale_contacts compute statistics;
- SQL>SELECT count(*) FROM sale_contacts
- WHERE UPPER(surname) = 'ELLISON';
-
- Execution Plan
- ----------------------------------------------------------
- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=1 Bytes=17)
- 1 0 SORT (AGGREGATE)
- 2 1 TABLE ACCESS (FULL) OF 'SALES_CONTACTS' (Cost=3 Card=16 Bytes=272)
From the execution path generated by SQL * PLUS autotrace, we can see that although the index is created on the SURNAME Column Used in the WHERE clause, the full table scan is still executed. If this table is large, it will consume a lot of time.
Now we try to create an Oracle FBI index:
- SQL>create index fbi on sale_contacts (UPPER(surname));
- SQL>analyze index fbi compute statistics;
- SQL>analyze table sale_contacts compute statistics;
- SQL>SELECT count(*) FROM sale_contacts WHERE UPPER(surname) = 'ELLISON';
- Execution Plan
- ----------------------------------------------------------
- 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17)
- 1 0 SORT (AGGREGATE)
- 2 1 INDEX (RANGE SCAN) OF 'FBI' (NON-UNIQUE) (Cost=2 Card=381 Bytes=6477)
From the execution plan returned by SQL * Plus, we can see that this time, Oracle does not scan the entire table, but first scans the index, because the optimizer can know that the FBI index exists.
The performance improvement caused by using the Oracle FBI index depends on the table size, the number of duplicate records in the table, and the columns used in the where clause.
It should be clear that the Oracle FBI index does not actually store the expression results in the index, but uses an "expression tree" expression tree ).
How to uninstall an Oracle database in Windows
How to install Oracle as a Linux Service
Multiple table Connection Methods in Oracle
Example of using SQL recursive statements in oracle
Questions about Oracle bare Devices