Glossary

Secondary Index

An extra index on a non-primary-key field so you can query by it without scanning everything.

1 min read·4 sections
Open the interactive version → diagrams, practice & more

Definition

An extra index on a non-primary-key field so you can query by it without scanning everything.

How it works

Speeds up reads on that field at the cost of slower writes (every write updates the index too) and more storage. In distributed stores, a global secondary index may live on different nodes than the data, turning a lookup into a scatter-gather. Index the fields you filter on — not every column.

Common questions

What is Secondary Index?

An extra index on a non-primary-key field so you can query by it without scanning everything.

How does Secondary Index work?

Speeds up reads on that field at the cost of slower writes (every write updates the index too) and more storage. In distributed stores, a global secondary index may live on different nodes than the data, turning a lookup into a scatter-gather. Index the fields you filter on —…

What is Secondary Index used for in system design?

Speeds up reads on that field at the cost of slower writes (every write updates the index too) and more storage. In distributed stores, a global secondary index may live on different nodes than the data, turning a lookup into a scatter-gather. Index the fields you filter on —…

Part of Glossary on SystemLore — system design explained with 148 deep topics, interactive diagrams, and a build-it-yourself game. Browse the glossary and "X vs Y" comparisons, or build this one →