Skip to content
System Designer

Scale the data · 3 minutes

Search is a copy

A search index is a second copy of your data, shaped for finding words fast.

Open this lesson
A search index is a second copy of your data, shaped for finding words fast.

Looking up is not searching

A database finds a row by its id quickly. Finding every row that mentions "red shoes" is a different job. A search index keeps a word-to-document map built just for that, and it is a copy, kept up to date by a feed of changes.

Slightly behind again

The database is authoritative; the word index is a maintained copy. Change a document, search before delivery, then catch the index up.

Try the idea

Search is crushing the database. Move it to a search index and keep the index fed.

Key numbers

Index update delay
≈ 1 to 5 s. approx.
Search query
≈ 20 to 50 ms. approx.
Index size versus data
≈ 1 to 3 times. depends on what you index, approx.

Check your reasoning

Think through these questions before opening the lesson. In the game you can test the idea and compare your reasoning.

  • Which is the source of truth?
  • You add an item and cannot find it for a second. Why?
  • Why not use the database for all search?

The key point

Keep one source of truth and feed purpose-built copies for search.

Practise this idea

Continue through the lesson tracks