CS FundamentalsModerateTCS NQT · Infosys pattern
Why does adding an index on a frequently-UPDATEd or frequently-INSERTed column have a real cost, beyond the storage the index itself uses?
- A. It only slows down SELECT queries, never writes
- B. It prevents the column from ever being updated again
- C. It has no real cost; indexes only ever help
- D. Every INSERT/UPDATE/DELETE that touches the indexed column must also update the index structure (potentially splitting/merging B+ tree nodes), slowing down writes in exchange for faster reads
Correct answer: D. Every INSERT/UPDATE/DELETE that touches the indexed column must also update the index structure (potentially splitting/merging B+ tree nodes), slowing down writes in exchange for faster reads
Indexes are maintained incrementally: every write that changes an indexed column's value must also locate and update the index (possibly triggering node splits or merges in a B+ tree), so more indexes on a table mean slower writes — the classic read/write trade-off behind index design.
More DBMS and SQL questions
- ARIES recovery uses a Log Sequence Number (LSN) stored on each data page, recording the LSN of the last log record that modified that…
- ARIES recovery performs three phases on restart: analysis, redo, then undo. Why must redo happen BEFORE undo, rather than undoing first…
- A Compensation Log Record (CLR) in ARIES, written while undoing a transaction's update, includes a field pointing to the next log record…
- Write-ahead logging (WAL) requires that:
- A fuzzy checkpoint in ARIES records the set of active (dirty) transactions and dirty pages at checkpoint time WITHOUT forcing all dirty…
- Strict two-phase locking (Strict 2PL) differs from basic 2PL in which way?