SystemCity
WorkspaceProblemsCanvasPricing
Sign in
S

SystemCity

AI-powered system design tutor. Learn architecture, ace interviews, build real systems.

Learn

  • Learn System Design
  • Interview Prep Guide
  • All Problems
  • Glossary
  • Compare
  • Design Canvas

Product

  • Pricing
  • Portfolio
  • Support

Legal

  • Terms
  • Privacy
  • Refunds

© 2026 SystemCity. All rights reserved.

Master system design · interview prep · 120+ problems

Back to glossary

Data & Storage

Database Indexing

Also known as: Indexing, B-tree Index

A data structure (typically a B-tree or hash table) that lets a database find rows matching a query without scanning the entire table.

In depth

A database index is a separate data structure that maps the values of one or more columns to the physical location of the matching rows. Without an index, a query that filters on a column must scan every row in the table — O(N). With an index, lookup is typically O(log N) for a B-tree or O(1) for a hash index.

Most relational databases use B-tree indexes by default because they support equality queries, range queries, and sort orders efficiently. Hash indexes are faster for exact-match lookups but cannot do ranges. Specialized indexes include GIN/GiST (Postgres, for full-text and geospatial), bitmap indexes (analytics warehouses), and inverted indexes (Elasticsearch, for text search).

Indexes are not free. Every index adds disk space and slows down writes (each insert, update, or delete must update every relevant index). The right number of indexes is enough to make important queries fast and no more — a common production performance issue is a table with too many redundant indexes.

When to use

Add an index for any column you frequently filter, join, or sort by — but only after measuring. Drop indexes that no query uses.

Tradeoffs

Indexes trade write throughput and disk space for read speed. Composite indexes only help if the query matches the leading column. Over-indexing is a real anti-pattern in production databases.

Related terms

SQL vs NoSQL

A choice between relational databases with strict schemas and ACID guarantees and non-relational databases optimized for scale, flexibility, or specialized workloads.

Denormalization

Intentionally duplicating data across tables to avoid expensive joins and improve read performance, at the cost of write complexity.

ACID

Atomicity, Consistency, Isolation, Durability — the four properties that traditional database transactions guarantee.

Object Storage

A storage architecture that manages data as objects (file + metadata + ID) in a flat namespace, optimized for huge amounts of unstructured data.

Time-Series Database

A database optimized for storing and querying timestamped data points — ideal for metrics, sensor data, financial ticks, and events.

Practice this concept

EasyInfrastructure

Design a Tagging Service

MediumSearch

Design Twitter Search

HardSearch

Design Google Search

HardInfrastructure

Design a Log Collection and Analysis System