core practice · coding problem

Secondary index write cost

Table with 3 secondary indexes. One INSERT touches how many index structures?

The mechanism

A secondary index is an extra sorted lookup that maps a non-primary-key value (like email) back to the rows that match. Reads on that value get fast; writes get a little slower because the index also has to update. Every index is a tradeoff — only add the ones queries actually need.

Study Secondary Indexes

Expected evidence

Primary + 3 secondaries = 4 writes (plus WAL).

Try this drill in the practice workspace →

Hints when you need them
  • Each index is another B-tree insert.
  • Indexes speed reads, tax writes.

Check the sources

Browse all practice briefs