Four Indexes Made INSERT 6× Slower: The Bill Nobody Mentions
Indexes speed up reads by charging you on every write, and the charge is larger than most people picture. Measured on PostgreSQL 16 with the same 200,000 rows: a table with no indexes finished inserting in 287.8 ms and occupied 10.2 MB; a table with four indexes took 1,722.3 ms and occupied 27 MB. That is 6× slower and 2.6× bigger — just to carry four structures that no query may ever touch. The right question is not "should this column have an index?" but "does the read time saved cover the write time paid?"
Every post about database optimization ends with advice to add an index. Very few mention the bill that comes with it, and fewer still put a number on it.
This post goes deeper into two lessons from the 30-day SQL series: Database design and Index. Every figure below was measured on PostgreSQL 16.11.
