SQL Server Clustered Index - Order of Index Question

后端 未结 9 1128
梦毁少年i
梦毁少年i 2020-12-05 12:34

I have a table like so:

keyA keyB data

keyA and keyB together are unique, are the primary key of my table and make up a clustered index.

9条回答
  •  日久生厌
    2020-12-05 12:59

    I believe that SQL Server orders it exactly the way you tell it. It assumes that you know best how to access your index.

    In any case, I would say it's a good idea where possible to specify what you want exactly rather than hoping the database will figure it out.

    You can also try it both ways, run a bunch of representative queries and then compare the generated execution plans to determine which is best for you.

提交回复
热议问题