Database indexes explained
What an index is, when it speeds a query, and when another index only slows writes.
An index is extra data that makes some lookups cheap
Without an index, a database may scan a whole table. An index is a structure (commonly a B-tree) that locates rows by a column or set of columns faster. It must be updated on writes.
Index what you filter and join
Look at slow queries: WHERE email = and JOIN … ON customer_id are classic. Unique constraints are indexes with a bonus integrity check. Primary keys are indexes.
Do not index everything
Each index slows INSERT/UPDATE and uses disk. Unused indexes are ballast. Measure with EXPLAIN (or your engine’s equivalent) on realistic data sizes.
Related
Last verified: August 2026. Technology and pricing change — always confirm current details with the vendor.