What's the difference between a Table Scan and a Clustered Index Scan?

后端 未结 3 1534
离开以前
离开以前 2020-12-04 09:37

Since both a Table Scan and a Clustered Index Scan essentially scan all records in the table, why is a Clustered Index Scan supposedly better?

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 10:25

    http://msdn.microsoft.com/en-us/library/aa216840(SQL.80).aspx

    The Clustered Index Scan logical and physical operator scans the clustered index specified in the Argument column. When an optional WHERE:() predicate is present, only those rows that satisfy the predicate are returned. If the Argument column contains the ORDERED clause, the query processor has requested that the rows' output be returned in the order in which the clustered index has sorted them. If the ORDERED clause is not present, the storage engine will scan the index in the optimal way (not guaranteeing the output to be sorted).

    http://msdn.microsoft.com/en-us/library/aa178416(SQL.80).aspx

    The Table Scan logical and physical operator retrieves all rows from the table specified in the Argument column. If a WHERE:() predicate appears in the Argument column, only those rows that satisfy the predicate are returned.

提交回复
热议问题