Once you know what kind of indexing will be used, you can decide whether to modify your query statement.
One of the things you will look at is whether clustered or non-clustered indexes
will be used.
The performance impact of a query will depend on the type of index used and the type of query.
Once you know the indexing plan for your query, you should consider the following:
If many records are being inserted, a clustered index can hurt performance because SQL Server has to physically reorder the rows so that
they are in order.
- If SQL Server statistics are out of date, the query optimizer might select an index that is no longer the best candidate to use.
- If there is a tremendous amount of data that needs to be inserted, it might make more sense to instruct SQL Server not to maintain statistics for given indexes or columns. For example, if you are inserting one million rows,
it might make sense to turn off statistics, insert all the data, then turn statistics back on. This prevents recomputing statistics one million times.
The next lesson will review this module.