IT lexicon › Database › Secondary index

Secondary index

Database På svenska → Updated: 2026-05-29

An index on a column other than the primary key, letting you search quickly on that attribute. "Find all users with last name = Andersson" requires a secondary index on last name, otherwise the whole table must be scanned.

Mechanic: a secondary index maps the value in the indexed column → the primary keys (or row pointers) where the value occurs. A search looks up in the index and then fetches the rows. Distinct from the primary/clustered index (which determines physical order) — secondary indexes are separate structures that point back. Trade-off: faster reads on that column, but every write must update all affected indexes (write cost) and they take disk space. In distributed databases it gets tricky: the index must either be partitioned per node (local secondary index) or globally (global secondary index), with different compromises. Fundamental database optimization. Related to global and local secondary index.

← Back to the lexicon