Skip to catalogue

71

database index

A lookup structure so the query does not read the whole table. Indexes match the WHERE and the ORDER BY.

What is database index?

An index lets the database find rows without a scan. It costs writes and disk. A missing index is a sequential scan. A useless index is write amplification. Unique indexes are also constraints.

Why does database index matter when vibe coding?

Models add a filter in the API and never the index. The page is fast on three seed rows. Name the query and the index in the same turn.

How do you do database index?

For every new list or lookup, write the query, then the index that matches its filter and sort. Explain with `EXPLAIN` if you can. Do not index every column “to be safe.”

How do you ask a model for database index?

Add an index for the query that filters by (columns) and sorts by (columns). Do not index columns this query does not use. Keep uniqueness as a unique index, not an application check.

What goes wrong with database index?

An index on a low-cardinality boolean alone. It will not save you. Lead with the selective column.

adjacent