codejump

Database Scaling — Series 3

Preview — 3 of 10 questions

A database supports covering indexes. A frequent query filters by customer_id and returns only order_id and total. Which index can satisfy its required columns without a separate table lookup when visibility permits?

AAn index on total including the creation timestamp.
BAn index on customer_id including order_id and total.
CAn index on order_id including the creation timestamp.
DSeparate indexes on total and the creation timestamp.

A large append-only table is partitioned by month. Entire old months expire together. What usually removes an expired month's data with less row-by-row work?

ACopy current rows into the same expired partition.
BDelete each expired row through a secondary index.
CDetach or drop the expired partition.
DMark each expired row with a soft-delete flag.

A table has daily range partitions on created_at. A query for one day scans all partitions because its predicate wraps the key in an unsupported function. What is the most targeted fix?

ASort the query output by created_at.
BUse a supported half-open range on created_at.
CAdd more partitions with smaller date ranges.
DIncrease the number of database replicas.

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.