Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 April Database Theory: Table Scan vs Index Scan vs Index Seek

Database Theory: Table Scan vs Index Scan vs Index Seek

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

Table Scan:

It scans every row for finding a particular node or data. If the planner fails to use a proper index, it has to do full Table Scanning.
If table has a less number of records, Table Scan is an excellent choice for query optimizer.

For example, If Table has around 1000 records, Table Scan is faster because unnecessary Index Scanning operation is not required.
But, If the Table has a large number of records, Table Scan requires high CPU and other resources for scanning the whole table.

Index Scan:

It is scanning of each row, whenever you are retrieving more than 50% or 70% of the table data, internally planner performing full Index Scan.

Generally, Index pages and Data pages are stored separately.
Index scanning is also dependent on the ordering of the Index data because If matched key found from the top pages, Index Scan is not required.

The Row Lookups also involved in Index Scanning because matched Index key has to fetch data from the data page, so Index Scanning is very costly for the big table.

Index Seek:

Index Seek is opposite the Table Scan and Index Scan.
It touches the only qualified row index rather than scanning whole Index Pages, and after that, it fetches only qualified data page.

When we are fetching less number of records with the specific filter, the planner has to choose Index Seek to fetch and scan only qualified data.

Index Seek operation is much faster than Index Scan, and also it does not require more CPU and I/O resources.

Apr 18, 2016Anvesh Patel
SQL Server: GAM and SGAM Pages to find the Extent Space InformationSQL Server: Find the total row count and size of the Tables
Comments: 3
  1. MuKesh Singh
    May 16, 2016 at 3:58 am

    SQL – Index Scan Vs Table Scan
    In absence of the indexes, A table scan will work on the data pages and this scanning starts from the first page to the last page for the data and in this way, scanned table stands on a heap and these data rows have their own pages. In the table scan, every row of data goes into the data scanning. If we have the huge data in the table and no index is not there then the query execution cost will increase due to high volume table scan.
    http://www.sql-datatools.com/2016/05/sql-index-scan-vs-table-scan.html

  2. vijay Reddy
    January 3, 2018 at 12:53 pm

    Really very LUCKY to get this blog to learn basic information and clear explanation about all the tops about SQL SERVER. I am 100% sure..this blog is help full for Experienced guys as well biginers

    • Anvesh Patel
      Anvesh Patel
      January 4, 2018 at 9:20 am

      Thank you Vijay…

Anvesh Patel
Anvesh Patel

Database Engineer

April 18, 2016 Database TheoryAnvesh Patel, database, database concept, database research and development, database standards, Database Theory, database topic, dbrnd, Index Scan, Index Seek, RDBMS, Table Scan
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....