Skip to content
Commitpedia
Log in Join & edit

What is an index (database)?

A database index is a lookup structure that lets the database find rows fast instead of reading the whole table.

Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?

Edit history of What is an index (database)?: 1 recorded edit
Edit history · 1 edit
Type
Article
Edits
1
Editors
1
First issued
15 Oct 2026
Last edit
15 Oct 2026
Reading
1 min

An index is an extra data structure the database keeps next to a table so it can jump straight to matching rows. The index at the back of a textbook is exactly this: instead of reading all 400 pages to find the word photosynthesis, you look it up and go to page 212. Without an index the database must scan every row, which is fine for 100 rows and painful for 100 million.

You add indexes on columns you search or join by often, such as an email column or a foreign key. Every index speeds up reads but slows down writes a little and takes disk space, so you do not index everything. EXPLAIN shows whether a slow query is using an index or scanning the table.

CREATE INDEX idx_customers_email ON customers (email);
EXPLAIN SELECT * FROM customers WHERE email = '[email protected]';

See also: What is SQL? and What is a primary key?

Did this work for you?

No votes yet. Be the first.

If it did not work, the report form below tells the editors what went wrong.

See also

  • 0070 Indexes and EXPLAIN: making SQL queries fast An index is a sorted lookup structure that lets the database jump to matching rows instead of reading the whole table. EXPLAIN… Advanced · Explains an idea · Any system Article Indexes & performance 15 Oct 2026

History

Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.

  1. Dominik +839 chars

Report a problem

Something wrong, unsafe or copied? Tell the editors.
What is wrong?