SQL Index Pros & Cons

Here a few things to think about, when creating an index in SQL:

1. While it (mostly) speeds up a select, it slows down inserts, updates, and deletes because the database engine does not have to write the data only, but the index, too.
2. An index needs space on the hard disk (and much more important) in RAM.
3. An index that can’t be held in RAM is pretty useless.
4. An index on a column with only a few different values doesn’t speed up selects, because it can not sort out many rows (for example a column “gender”, which usually has only two different values – male, female).

Leave a Reply

Your email address will not be published. Required fields are marked *