Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

An Oracle index is worth adding or keeping when it measurably improves important queries enough to outweigh its storage and write-maintenance costs. Indexes can speed selective lookups, range access, ordered retrieval, and some queries that can be answered from index contents alone—but the optimizer chooses the access path, and the presence of an index does not guarantee it will be used.

What an index can—and cannot—do

An index gives Oracle another way to find or order rows. It can reduce the work needed for a selective lookup or range scan, and a suitable index may help satisfy an ordering requirement. If an index contains all the values a query needs, Oracle may also be able to answer that query without visiting the table for those values.

Those benefits depend on the relationship between the index keys and the query. The predicates, requested columns, and overall workload matter. An index is not a general speed switch: Oracle’s SQL Tuning Guide for Database 18c explicitly cautions that indexes are not a performance cure-all.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Every index also has a cost. It occupies storage, and Oracle must maintain it as relevant table data is inserted, updated, or deleted. That work consumes resources and can affect write performance. Oracle’s guidance is to weigh the query improvements against the effect on DML rather than judging an index by read speed alone.

How to tell whether an index helps your workload

  1. Choose representative SQL. Identify the statements that matter to users or business operations, then note their filter and join predicates, returned columns, and how often they run. Include both reads and writes in the workload you assess.
  2. Check whether the index matches the query. For a composite index, determine whether the query can use a leading portion of its key. If the predicate applies a function or other transformation to a column, check whether the index uses a matching expression. A plain index on the underlying column may not provide the expected access path for a transformed predicate.
  3. Inspect the execution plan. See which access path Oracle actually chose; do not infer index use from the SQL text or the index definition. An index access path can still require many table-block visits, so its presence in a plan is not by itself evidence of a useful improvement.
  4. Measure under representative conditions. Compare the important queries’ timings and the workload’s write costs with and without the index, using conditions that resemble normal activity. A result from an atypical period or a single query does not establish the effect on the workload as a whole.
  5. Include storage and maintenance in the decision. An index can save query work while adding space use and work to data changes. Keep it only when the measured benefit to the important workload justifies those costs.
  6. Observe usage over a representative period. Oracle describes index-usage monitoring as part of evaluation. An index that appears unused during a short or unusual observation window may still support infrequent but important activity; do not use that observation alone as a reason to drop it.

Which index type fits the query?

Index type When it may help Important limitation or cost
B-tree or composite Selective lookups, range access, ordered retrieval, and some queries whose needed values are all present in the index. For a composite key, access generally depends on the query being able to use a leading portion of the key. An index access path may still visit many table blocks.
Function-based Recurring queries that filter or order by a transformed column or expression, such as a case-normalized value, when the query expression aligns with the indexed expression. The index adds storage and DML maintenance; changes still require Oracle to maintain the index and evaluate its expression.
Bitmap Analytic queries on large tables that filter on several low- or medium-cardinality attributes. Heavy concurrent DML is a poor fit: bitmap entries can represent sets of rows, so concurrent changes can contend. Do not treat bitmap indexes as a general OLTP choice.
Reverse-key A possible way to address insert hot spots, as described in Oracle’s Database 21c Performance Tuning Guide. Reverse-key indexes do not support index range scans. Check the target Oracle version and workload before selecting one.

Why a plausible index may not improve a query

The query cannot use the key in the expected way

A composite index is not interchangeable with separate indexes on every column. If the query does not use a relevant leading portion of its key, it may not be able to access that composite index in the expected way. Likewise, a predicate that transforms a column can prevent the ordinary index path from applying; a function-based index may help only when its indexed expression matches the expression used by the SQL.

The access path still reads many table blocks

Using an index does not mean Oracle avoids table I/O. For a range scan, index entries may lead to rows spread across many table blocks. Oracle’s clustering factor is a rough indicator of how well the order of index entries corresponds to the physical placement of table rows. A high clustering factor can indicate more I/O for a large range scan, but it is a diagnostic clue—not a verdict about whether to keep the index.

The read gain is smaller than the workload cost

An index may reduce the time for one query but add meaningful work to frequent inserts, updates, or deletes. It can also consume storage. Assess the change across the workload, including read latency or throughput, DML latency, and storage, instead of optimizing a single statement in isolation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Oracle version context

The guidance behind these principles spans Oracle Database 18c SQL Tuning guidance, Oracle Database 19c Concepts, a Database 12c optimizer-access-path reference, and Oracle’s Database 21c Performance Tuning Guide for the reverse-key tradeoff. An Oracle optimizer-access-path tutorial in the material is for Database 11g and SQL Developer 3.2, so it should not be treated as current product or UI guidance. Check syntax, optimizer behavior, licensing, and feature availability against the release and edition you run.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.