Articles → SQL SERVER → Index Scan And Index Seek In Sql Server
Index Scan And Index Seek In Sql Server
Software Requirement
Technical Knowledge
- What are tables?
- What is an index?
- What is the difference between clustered and non-clustered indexes?
- What is a primary key?
- What is an execution plan?
Scan And Seek
Types Of Scans And Seek In SQL Server
- Table scan
- Clustered index scan
- Clustered index seek
Table Scan
SELECT
[PersonId],
[PersonName],
[Address]
FROM
[Test].[dbo].[Person]
Adding Primary Key And Clustered Index On The Table
- Set primary key for "PersonId"
- Add a non-clustered index on the "Address" column
Clustered Index Scan And Seek
SELECT
[PersonId],
[PersonName],
[Address]
FROM
[Test].[dbo].[Person]
where
Personid = 1
How ISNULL Functions Change The Behavior?
select
[Address]
from
Person
where
[Address] = 'Address 1'
select
[Address]
from
Person
where
Isnull([Address], '') = 'Address 1'