Index Seek vs Index Scan in SQL Server [closed]

Please explain the difference between Index Scan and Index Seek in MS SQL server with an sample example, since it will be helpful to know, what's the real use of it. Thanks in advance.

1

2 Answers

Here is the text showplan (slightly edited for brevity) for this query using a scan:

|–Table Scan(OBJECT:([ORDERS]), WHERE:([ORDERKEY]=(2)))

The following figure illustrates the scan:

enter image description here

Here is the text showplan for the same query using a seek:

 |–Index Seek(OBJECT:([ORDERS].[OKEY_IDX]), SEEK:([ORDERKEY]=(2)) ORDERED FORWARD)

enter image description here

have a look on this SQL Server Plans : difference between Index Scan / Index Seek

2

In simple words, An index scan or table scan is when SQL Server has to scan the data or index pages to find the appropriate records. A scan is the opposite of a seek, where a seek uses the index to pinpoint the records that are needed to satisfy the query.

your question is similar to the question which is already posted in stackoverflow get it from below link

#Index scan vs Index seek

you can also get information from below link

#Index scan vs Index seek in brief

You Might Also Like