Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance overhead of single column vs multiple column indexes

Hi i was wondering what the performance overheads are like for single column vs multiple column indexes in terms of inserts. So for example if i have 3 single column indexes would that be better for inserts into that table as opposed to having 1 index with multiple columns. When i'm talking about performance i'm interested in raw speed.

like image 354
Vince Ashby-Smith Avatar asked Dec 05 '11 14:12

Vince Ashby-Smith


1 Answers

The INSERT overhead of INDEXes is normally negligible regardless of single or multi column.

Unless writes significantly out weigh reads, always include whatever indexes are necessary to improve the performance of your queries.

In some case multiple single column indexes sufficiently boost the performance of many more queries than a single multi-column index. More often, a single multi-column index further boosts performance of a smaller set of queries.

The general rule is to consider the query performance, not the insert performance, unless you can predict or see a particular issue with inserts.

like image 132
MatBailie Avatar answered Sep 23 '22 09:09

MatBailie