Indexes: a shortcut with a maintenance cost
Why a lookup gets faster, why writes get a little slower, and how to read the trade-off.
Community contributor10 min readQuick checkSources
A database index is an additional structure that helps the engine find rows without scanning every row in a table. Like the index at the back of a textbook, it maps a value to where the useful material lives.
Faster reads are not free
The database must update each relevant index when rows change. Indexes also use storage and can change which query plan the engine chooses. The right index follows a real query pattern; adding one to every column usually adds cost without a matching benefit.
Quick check
Why can adding many indexes slow down writes?
Show answerHide answer
Each insert, update, or delete may need to maintain several index structures as well as the table row.