Saturday, 2 November 2024

Clustered index scan/seek operator in SQL Server execution plan

The Clustered Index Scan operator in SQL Server is used when a query scans an entire clustered index to retrieve data. A Clustered Index Scan reads all rows in the clustered index, making it efficient for retrieving large data sets, especially when the query requires a full table scan.

Icon of clustered index scan operator

Index seek

Index Scan

See the example

If we have a table and that table have the cluster index then Clustered index seek or scan happen.

Clustered index seek

If we are pulling the records from the table based on the search condition then index seek happen. See in this example. 

In this table we have 4 records. We want to get the all records from the table. To get the all records either we can write the query like “select * from products_demo” or we can write “select * from products_demo where productid in (1,2,3,5)”

If we use filter then Seek happen. See below


If we select all records from this table then Clustered index scan happen.

See below.

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts