query execution plan : missing index

2019-06-26 03:38发布

问题:

alt text http://img502.imageshack.us/img502/7245/75088152.jpg

There are two tables that I join them together, one of them is a temp table and I create an index after creating the table. But it is said in the query execution plan above.

what should I consider to convert all scan operations to seek operations? There are parts which are joins and where conditions...

Regards bk

回答1:

The "Missing index" hint that is displayed is your best starting point. SQL Server has detected you would get better performance by adding the index that it tells you to.

It's difficult to be specific as really need to know what your SELECT statement is as a number of things could cause a scan to be done instead of seek.

As an example, I recently blogged about how the structure of your WHERE clause for (e.g.) date filtered queries, can turn seeks into scans - in this instance things to look out for are the use of functions within the WHERE clause.