question

sql2012 avatar image
sql2012 asked

Missing index details on the execution plan screen

Hi i am using sql server 2012. i run a query to practice for missing index. i turn on the "Include Execution plan" from the SSMS too, after i run a simple query select lastname from tperson where lastName = 'Duffy' when i clicked on the Execution plan tab, my training video show there is a Missing index message displayed under the query, but I did not see it from my screen. Did i miss anything? really appreciate if you know can advise me. Thank you, Fong
sqlsql-server-2012
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
are you running the same query in the same database as the training video (adventureworks etc)? with same number of rows in the table? the same statistics?
0 Likes 0 ·
sql2012 avatar image sql2012 commented ·
Not the same database. i used AdventureWorks2012 data. I cooied one of the tables to a new table and make sure there is no index. then run a query as the training video from the pluralsight. i did the same steps in video, except it has less records from the training's demo. However, it should not make any different right? or you think sql server will not bother to report the missing index if the data set is small? my table has 19972 records.
0 Likes 0 ·

1 Answer

·
KenJ avatar image
KenJ answered
The smaller table is almost certainly the difference. If the table is small enough SQL Server will often scan the whole table rather than using an index or even looking for or recommending one. Throw 100,000 or so more rows in there and see if it recommends an index then (make sure you have a variety of last names, not just 100,000 Duffys.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sql2012 avatar image sql2012 commented ·
Yes It makes sense. I will try it later. thank you.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.