主鍵是聚集索引,其他的都是非聚集索引(升序)。為什么數(shù)據(jù)只是按照username排序。如果這樣,我們在查詢的時候又怎么能夠來提高速率呢?
如果有對每個字段都排序的話,怎么辦呢?請盡可能的講詳細點,先謝謝!
問題補充:索引建在標識符上是浪費吧,建在主鍵也是?,如果不在主鍵建聚集索引,那么豈不是不能設(shè)置主鍵(默認為聚集索引,而且不能刪的),我很糊涂,能幫我解釋一下嗎?
以下為回復(fù)的內(nèi)容: declare @d datetimeset @d=getdate()select top 10 * from tableName where 1=1order by Tst_Id desc,Tst_username asc,Tst_D_CreateTime desc,Tst_Count_N descselect [語句執(zhí)行花費時間(毫秒)]=datediff(ms,@d,getdate()) 你可以用SQL的查詢優(yōu)化分析器來進行調(diào)試 |