I have a table with 2.5 million rows (I know, development nearly finished to warehouse this).
The system querying has been suffering some SQL timeouts understandably. I profiled a few of my queries and noticed 97% of the work was scanning an index.
There was no other index on the table other than the clustered index on the ID column. Now, the queries timing out appeared to be problems with the one datetime column on the table being used in the where
, so I added an index to that datetime column.
I used the index wizard, which spun loading for a few mins and then instantly CPU usage dropped from a steady ~95% to around 9%. I thought I'd killed the service, but it's just performing with a lot less CPU now.
Couple Questions:
- Is there anything I need to be aware of given this huge performance gain? Have I offloaded the problem elsewhere (memory rather than CPU, for example)? Or is it that it was simply just crying out for an index?
- I was under the impression an index needed to build. While the wizard was loading (for a min or so), was this the building of the index completing? I expected to have to wait for an hour or so given the 2.5 million records?