Learn about the Oracle FBI Index

Source: Internet
Author: User

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.

The cost-based optimizer is used to create a standard B-tree index on the SURNAME column.

  1. SQL>create index non_fbi on sale_contacts (surname);  
  2. SQL>analyze index non_fbi compute statistics;   
  3. SQL>:analyze table sale_contacts compute statistics;   
  4. SQL>SELECT count(*) FROM sale_contacts  
  5. WHERE UPPER(surname) = 'ELLISON';  
  7. Execution Plan   
  8. ----------------------------------------------------------   
  9. 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=1 Bytes=17)   
  10. 1 0 SORT (AGGREGATE)   
  11. 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:

  1. SQL>create index fbi on sale_contacts (UPPER(surname));  
  2. SQL>analyze index fbi compute statistics;  
  3. SQL>analyze table sale_contacts compute statistics;  
  4. SQL>SELECT count(*) FROM sale_contacts WHERE UPPER(surname) = 'ELLISON';   
  5. Execution Plan  
  6. ----------------------------------------------------------   
  7. 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17)   
  8. 1 0 SORT (AGGREGATE)   
  9. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.