I have a table with +/- 80 million rows (partitioned).
The inserts are getting kinda slow (about 1-3 sec).
The query plan says 68% of the insert is clustered index insert, but there are also some triggers on the table for every insert / update and delete. So its kinda hard to say what is really causing the time.
Anyways, we have some indexes on that table, some with 3-5 columns in it.
What I want to know is what is better, performance wise:
To have some indexes with multiple columns in it, or to have more smaller indexes with less columns?
All tips and suggestions are welcome.
I think it’s fairly obvious that it’s your triggers causing the problem. It’s extremely unlikely that inserting a single row would take 3 seconds on such a small table without triggers. You could try removing them and see if your inserts are still slow.
You should look at your queries and see which indexes they are using. To optimize read performance you should add indexes if a slow query could benefit – this could be either a single column index or a multiple column index, depending on the specific query. To optimize write performance you should remove any unused indexes.