index

A separate, sorted structure a database keeps alongside a table so it can find matching rows without reading them all.

In more detail

Most database indexes are B-trees or B+ trees, so a lookup touches only a few disk pages and range queries follow sorted order. Indexes speed up reads but must be updated on every write, so they cost write time and storage.

Examples

In the browser: In IndexedDB, createIndex('byStatus', 'status') during an upgrade lets you query by status quickly. Options include unique, to reject duplicates, and multiEntry, to index each element of an array value.
A SIEM indexes events by time and by chosen fields, so a query on a source address returns quickly.
CREATE INDEX orders_customer_date ON orders (customer_id, ordered_on);

Related terms

Taught in

References