Category: 

What Is a Full Table Scan?

Article Details
  • Written By: Alex Newth
  • Edited By: Angela B.
  • Last Modified Date: 14 November 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Helium is the only element that was discovered in space before it was found on Earth.  more...

December 10 ,  1948 :  The UN adopted the Universal Declaration on Human Rights.  more...

A full table scan is one of the slowest, but most thorough, ways of scanning a database. The reason this scanning method is so slow is that the database reads every row and checks to see if one or more columns are valid for a query or condition imposed by the administrator. The most common trigger for a full table scan is that the database does not contain an index row from which the query can launch. It is usually better to scan the table manually if looking for one row but, if looking for more or if looking through a large table, the full table scan will work better.

Databases come with scan functions that look through tables to find information or to check the table to ensure it can meet a condition. A full table scan is the most thorough scan because, even if it finds a row that matches the condition, it will continue to scan through the rest of the rows. This function is expensive, meaning it uses a large amount of memory, because the scan reads and writes to each row and also performs multiple seeking to thoroughly check the row. A full scan is needed when a query, or function, is performed but the database does not see an index to run the query.

Ad

An index is a column in a table that indexes information about the table according to the administrator’s preference. For example, if the administrator wants to index information about names, the index column will record the position of each name. This helps both the administrator and database find information hidden deep in the database. If no index is located in the table, a full table scan will usually start automatically to allow a query to run.

So much memory is allocated to a full table scan and it is so thorough that a full scan is very slow. If the administrator just needs one or a few rows for the query, it is usually quicker just to build a small index. While this is true, if the query is large, the full scan may actually work faster. If the administrator is making a query that affects 5 percent or more of the whole database, a full scan will usually be able to perform the function quicker than the administrator doing the same thing manually.

An administrator will often use an “EXPLAIN PLAN” function, which will perform a quick scan of the table. This will show the administrator whether an index is needed for the query. By taking the results, the administrator will know if the query can run as it is, if he or she should make or search for an index, or if performing a full table scan will be efficient.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email