If you want to be able to organize or access the same file in multiple ways without repeatedly resorting it, what operation should you apply to the data?

Difficulty: Easy

Correct Answer: Index

Explanation:


Introduction / Context:
Sorting physically rearranges records into a chosen order, but it is expensive to repeat and fixes a single order at a time. When users need multiple orderings or fast lookups by different keys, indexing provides a better, more flexible approach without reordering the base data.



Given Data / Assumptions:

  • You have a large file or table with many records.
  • Users want to access it by different fields (e.g., by name, by date, by category).
  • Performance and maintenance are considerations.


Concept / Approach:
An index is an auxiliary structure (e.g., B-tree, hash) that maps key values to record locations, enabling efficient retrieval and ordering without changing the physical sequence of the base file. Multiple indexes can coexist, supporting many access patterns simultaneously. This avoids repeated global sorts while still enabling ORDER BY and selective queries to run quickly.



Step-by-Step Solution:

Identify the need for multiple orderings or keyed lookups. Recognize that sorting alone enforces a single physical order at a time. Apply indexing to create multiple access paths over the same data. Choose “Index.”


Verification / Alternative check:
Database documentation for CREATE INDEX emphasizes improved retrieval speed and flexibility; storage engines use indexes to satisfy ORDER BY, GROUP BY, and WHERE predicates efficiently.



Why Other Options Are Wrong:

  • Delete/Update: modify or remove data; unrelated to access paths.
  • Sort key: a column used for sorting, not an operation that creates reusable access structures.
  • None: incorrect because indexing is the correct operation.


Common Pitfalls:
Over-indexing, which increases write costs; failing to maintain statistics; not aligning indexes with query predicates, leading to unused indexes.



Final Answer:
Index

Discussion & Comments

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