When can adding an index actually hurt performance? Explain the trade-off between read speed and write throughput.
Last updated
Every index must be updated on each
INSERT/UPDATE/DELETE, so more indexes mean faster reads but slower writes (write amplification, page splits).Indexes also cost disk space and buffer cache memory. Redundant or low-selectivity indexes (e.g. a boolean flag) add cost with little or no benefit.
They hurt most on write-heavy or bulk-load tables. Index for real query patterns and drop unused indexes.
- https://planetscale.com/blog/what-are-the-disadvantages-of-database-indexes
- https://dev.to/uptimearchitect/oracle-indexes-when-they-help-when-they-hurt-and-how-to-tell-1e6g
- https://dev.to/wantsvibes/database-index-overhead-write-amplification-cache-pressure-and-maintenance-costs-3p3g
- https://dev.mysql.com/doc/refman/8.0/en/innodb-change-buffer.html
- https://dev.mysql.com/doc/refman/8.2/en/data-size.html
- https://www.postgresql.org/docs/current/sql-createindex.html
- https://theartofpostgresql.com/yesql/performance/indexing-strategy/
- https://medium.com/@sjksingh/10x-write-amplification-postgresql-vs-mysql-index-architecture-analysis-a55d4e2b13e5