Indexes: B-Trees and the Cost of a Lookup · graine 1 · A4, économe en encre. Le corrigé s'imprime sur sa propre page, pour les adultes.
En anglais

Indexes: fast lookups at a write cost

Informatique · Données et bases de données · de 19 à 20 ans
Nom ______________________   Date ____________
  1. Why are B-tree nodes wide rather than binary?

    • Keys share a read
    • Wide nodes use less storage
    • Wide nodes skip all write costs
  2. A users table has an index on email and no other index. Which lookup does the index speed up?

    • Finding users older than 30
    • One email lookup
    • Grouping users by country
  3. Which cost does every index add?

    • Slower but correct results
    • Extra rows in answers
    • Write work plus storage
  4. A table with five indexes inserts slowly. What is the likely cause?

    • Five index writes per insert
    • The disk reads pages too quickly
    • Too few queries use the table
  5. The email index stores values in order. Which extra query can use it?

    • Counting rows by country
    • Averaging all ages
    • Email names from a to m
  6. A B-tree index helps only exact matches, never ranges.

    En entourer un :   Vrai   Faux

  7. An index on city helps a query that filters rows by city and sorts by city.

    En entourer un :   Vrai   Faux

  8. Jo wants an index on every column to make all queries fast. What is wrong with the plan?

    • Queries would return wrong rows
    • Write and storage tax per index
    • Two indexes cannot share one table
LightMySky · lightmysky.comW1-mt_1Z5EQTqooI-s1

Corrigé

Pour les adultes. Replier cette page avant de passer le reste.

Indexes: fast lookups at a write cost W1-mt_1Z5EQTqooI-s1

  1. Keys share a read · A node fills a disk page, and the disk reads a page at a time.
  2. One email lookup · The index covers email only, so only the email lookup can use it.
  3. Write work plus storage · Each write must update every index, and each index occupies space.
  4. Five index writes per insert · Write work grows with each index, so heavy indexing slows inserts.
  5. Email names from a to m · Order serves ranges, so a range over email can use the same index.
  6. Faux · Its keys stay ordered, so ranges and sorts benefit too.
  7. Vrai · One ordered structure serves both the filter and the sort.
  8. Write and storage tax per index · Each index speeds its own lookups but charges on every write.