0

I have very simple table like this :

enter image description here

It contains only one clustered index on ID column (PRIMARY KEY) as you can see. Data that are stored in that table :

enter image description here

When I do Display Estimated Execution Plan it shows me that it uses clustered index scan for following query :

enter image description here

I'm wondering why SQL engine shows me clustered index scan instead of table scan ? I'm searching via Name column (not ID) and I assume that index does not contain any information about Name data (Name column) - the index is built based on ID column and should operate strictly on ID column if I understand it correctly. So if I'm using only Name column which is not indexed - why it uses clustered index to search the table? I don't get it. I would expect table scan in this case.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
Dear Deer
  • 515
  • 1
  • 11
  • 29
  • 2
    Same thing basically: a table scan is a scan of a table which has no clustered index, in other words a heap. Obviously you want to index `Name` here – Charlieface Apr 03 '22 at 23:17
  • In SQL Server, the leaf level of the clustered index ***IS*** the table - all the data pages that make up the whole table. So a "clustered index scan" really is a table scan - it's just called differently – marc_s Apr 04 '22 at 04:15

0 Answers0