Please explain why adding more indexes to a relational database is not always beneficial for speeding up workloads.


At a high level, an index over a specific table can speed up the execution of a query that accesses the table provided that the query references a compatible subset of columns that the index covers and that the cost of using the index is lower than alternatives (e.g., simply scanning the whole table or using another index). At the same time, the index needs to be kept up-to-date with the table, which means that each table update (insertion or deletion of new rows, or updates to existing rows for the columns that the index covers) will now cost more as the relational database system has to also propagate the update to the index. Thus, the usefulness of adding an index to a workload will depend on the fraction of queries that can benefit from the index, and on the mix of queries and updates.