Oracle SQL Developer
Oracle SQL Developer
Oracle SQL Developer
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Managing Indexescause serious problems by increasing the processing overhead for statements that add,modify, or delete rows. In some cases, a statement could use two or more indexes andthe optimizer picks just one of them. Unless other statements can take advantage ofthe unused indexes, they are not providing any benefit. Therefore, you might findyourself deleting indexes if you create too many.This topic contains the following topics:■■■Creating Indexes for Use with ConstraintsIndex TypesGuidelines for Creating Indexes4.3.1 Creating Indexes for Use with Constraints4.3.2 Index TypesAll enabled unique and primary keys require corresponding indexes, although in mostcases the indexes are created automatically. Note the following:■■■Constraints use existing indexes where possible, rather than creating new ones.Unique and primary keys can use non-unique as well as unique indexes. They caneven use just the first few columns of non-unique indexes.At most one unique or primary key can use each non-unique index.■ The column orders in the index and the constraint do not need to match.You should almost always index foreign keys; the database does not do this for youautomatically.Indexes can be categorized in a number of ways. The primary options are:4.3.2.1 NormalA standard, B-tree index contains an entry for each value in the index key along withan address to the row where the value is stored. A B-tree index is the default and mostcommon type of index in an <strong>Oracle</strong> database.4.3.2.2 Ascending and DescendingThe default search through an index is from lowest to highest value, where characterdata is sorted by ASCII values, numeric data from smallest to largest number, and datefrom the earliest to the latest value. This default behavior is performed in indexescreated as ascending indexes. You can cause index searches to reverse the search orderby creating the related index with the descending option.4.3.2.3 Column and Function-basedTypically, an index entry is based on the value or values found in the table's column orcolumns. This is a column index. Alternatively, you can create a function-based indexin which the indexed value is derived from the table data. For example, to findcharacter data that can be in mixed case, you could use a function-based index to lookfor the values as if they were all in uppercase characters.4.3.2.4 Single Column and ConcatenatedYou can create an index on just one column, which is called a single column index, oron multiple columns, which is called a concatenated index. Concatenated indexes areDatabase Objects: Usage Information 4-7