开发者

Sql Server 2005 Index Column Order

I am under the impression that column order for index matters. So an index on columns (A,B) would not be used for SELECTs WHERE B=yy. (not that it matters I think, but assume the index is non-clustered)

But I just ran a query that fits this form on a table with an index just like above and got unexpected results. Acc开发者_如何学JAVAording to sql server management studio, the actual query plan used involved using the non-clustered index.

Why could this have happened?


It probably reported an Index Scan which is comparable to a full table scan. Imagine an address book indexed by (as most are) LastName, FirstName. A query for "Doe,John" will result in a Index Seek, while a query for "John" would result in a Index Scan.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜