Clustered Index Scan 與 Clustered Index Seek
阿新 • • 發佈:2017-08-09
info index 會有 語句 class 聚集索引 方式 計劃 執行計劃
use master go select * from sysobjects select * from sysobjects where name like ‘sys%‘ select * from sysobjects where id<3
Clustered Index Scan 與 Clustered Index Seek
在利用 SQL Server 查詢分析器的執行計劃中,會有許多掃描方式,其中就有 Clustered Index Scan 與 Clustered Index Seek,這二者有什麽區別呢?Clustered Index,為聚集索引,表示它們使用的都是聚集索引掃描。
Scan 表示它掃描一個範圍或者是全部內容,Seek 表示掃描特定範圍內的行。也就是說 Scan 並不知道要目標行是哪些,而 Seek 掃描表明我已經知道我要找的目標行是哪些,所以 Seek 一般要快些。
看看下面的語句,哪個(些)是 Scan 掃描,哪些是 Seek 掃描呢?
由於 sysobjects 表是對 id 建的聚集索引,所以前兩個查詢語句使用的是 Scan,後面一個使用的是 Seek。
Clustered Index Scan 與 Clustered Index Seek 的圖標
Clustered Index Scan 與 Clustered Index Seek