Sql-server – Nonclustered index Seek

nonclustered-indexsql server

Question about Index usage:

If I create a nonclustered index like

IX_LastName_Age

Where it is created by LastName ASC and Age ASC, and there is clustered index on ID field.

Now if I run a query

Select Age from dbo.user where Age > 10

Would the execution plan use "IX_LastName_Age" or will it scan from Clustered Index?

Best Answer

If the table has more columns than the 3 described, it would be more efficient to scan the IX_LastName_Age index. If the table is just those 3 columns, it may scan either the clustered index, or the IX_LastName_Age index, each would essentially be equivalent. In no case could there be a seek given the info in this scenario.