Search code examples
sql-serverdatabaseindexingclustered-indexnon-clustered-index

SQL Server: Key Lookup without Clustered Index


I have a table named Scan that has just two columns: id (int) and a (char).

It starts without any index. So I created a nonclustered index link following

CREATE INDEX ix_id ON scan(id ASC)

So I ran this select:

SELECT id, a
FROM Scan
WHERE id = 1

and this is the execution plan:

enter image description here

Why did I get a Key Lookup (clustered) if my table doesn't have any clustered index?


Solution

  • Why did I get a Key Lookup (clustered) if my table doesn't have any clustered index?

    You didn't. This is presumably a bug in the html-query-plan library used by SQL Operations Studio.

    The same issue is also visible on the Paste The Plan site (example).

    As you know (because you found it!) the bug report is here.