Menu

Why Do Database Indexes Slow Down INSERTs? (The B+ Tree Page Split Dilemma)
📰

Why Do Database Indexes Slow Down INSERTs? (The B+ Tree Page Split Dilemma)

DEV Community: database·Binary Dose·3 days ago
#zfUwYVsh
#devtodatabase#devto#dev#index#write
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.