I have the following table:
Create table Tab_with_Ix
(
id int not null,
name nvarchar(10),
phone decimal(10,0)
)
I inserted a few entries:
insert into Tab_with_Ix
values(1, 'Yogesh', 8855664452), (2, 'Vinay', 9977884455), (3, 'Sam', 9988554466)
Now I am creating a non-clustered index on Tab_with_Ix:
CREATE NONCLUSTERED INDEX NCI_Ix on Tab_with_Ix(id)
Now when I request Tab_with_Ix:
Select *
from Tab_with_Ix
where id = 1
I get the execution plan as:

But when I use the following query:
Select id
from Tab_with_Ix
where id = 1
I get the execution plan as:

My question is: why does SQL Server use a table scan once and another time the index searches?