Purpose of indexes in Oracle: uniqueness enforcement and performance.

Difficulty: Easy

Correct Answer: Valid (indexes can enforce uniqueness and speed lookups by column values)

Explanation:


Introduction / Context:
Indexes are auxiliary structures that improve query performance and, in the case of unique indexes or constraints, enforce uniqueness on key columns. Understanding this dual role clarifies why and when to create indexes in Oracle.


Given Data / Assumptions:

  • Oracle supports B-tree, bitmap, and other index types.
  • Unique constraints are enforced via unique indexes.
  • Index selection affects performance characteristics.


Concept / Approach:
An index maps key values to row locations, allowing Oracle to locate rows efficiently without scanning entire tables. A UNIQUE index (often created automatically by a UNIQUE or PRIMARY KEY constraint) ensures that duplicate key values cannot be inserted. Non-unique indexes accelerate predicates, joins, and orderings but do not enforce uniqueness. Therefore, the statement that indexes both enforce uniqueness and enable fast retrieval is correct.


Step-by-Step Solution:

Create a UNIQUE constraint on a column; Oracle creates a unique index under the covers.Create a non-unique index to speed WHERE clauses, joins, and ORDER BY.Measure plans with EXPLAIN PLAN to confirm index usage.Avoid over-indexing writes; balance read and write needs.


Verification / Alternative check:
Attempt to insert duplicate keys under a UNIQUE constraint—Oracle raises an error, proving uniqueness enforcement through indexing.


Why Other Options Are Wrong:

  • Indexes do not replace tables nor depend solely on block size or foreign keys.
  • Both B-tree and bitmap indexes can contribute to performance; bitmap indexes are specialized for low-cardinality, read-mostly workloads.


Common Pitfalls:
Creating too many indexes; forgetting to index selective foreign keys for join performance; assuming every query benefits from an index.


Final Answer:
Valid (indexes can enforce uniqueness and speed lookups by column values)

More Questions from Managing Databases with Oracle

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion