Glossary · Backend
What is a database index?
A database index is a separate data structure that lets the database find rows matching a condition without scanning the whole table, much like a book's index. It makes reads on the indexed columns much faster, at the cost of extra storage and slightly slower writes.
Source: PostgreSQL: Indexes
Why it matters
Missing indexes are one of the most common reasons an app is fast in development and slow in production, once tables hold real volumes of data.
Indexes should follow your real queries: the columns you filter, join and sort on.
Example
Adding an index on orders (customer_id, created_at) turns a slow order-history page into a fast one.