Every junior engineer learns that adding an index to a database column makes SELECT queries blazing fast—reducing full table scans ((N)$) to logarithmic B+ Tree lookups ((\log N)$).
So why shouldn't we just index every single column in the table?
Because on an indexed table, a simple INSERT is never just an append. In high-throughput systems, over-indexing can spike write latency by 300% to 500% .
Here is what actually happens inside a database storage engine during an INSERT.
1. Unindexed Table: The O(1) Sequential Append
When a table has no secondary indexes , inserting a row is straightforward:
The database appends the raw row to the end of the current heap data page.
This is a fast, sequential write ((1)$ complexity).
Disk I/O is minimal, and Write-Ahead Log (WAL) records are simple.
2.…