Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Database /Difference Between Indexing and Sorting

Difference Between Indexing and Sorting

June 27, 2011Posted byIndika


Indexing is a method that is used to improve the data retrieval speed in a table of a database. An index could be created using a single or more columns in a table and the index is stored in a separate file. Indices can be created as unique indices or non-unique indices. Sorting is the process or arranging items in a set in a specific order. Sorting a table would create a copy of the table in which the rows may have a different order than the original.

What is Indexing?

Indexing is a method that is used to improve the data retrieval speed in a table of a database. An index could be created using a single or more columns in a table and the index is stored in a separate file. This file contains the logical order of rows along with their physical position in the table. The space required by an index file is typically less than the space required to store the table. Unique indices will prevent the table from containing duplicate values of the index. Indexing would make the data retrieval more efficient. Consider the following SQL statement.

SELECT first_name, last_name FROM people WHERE city = ‘New York’

If the above query was executed in a table that does not have an index created using thecitycolumn, it has to scan the whole table and look at thecitycolumn of each row to find all the entries withcity=”New York”.但如果表had an index, it will simply follow using a B-tree data structure until the entries with the “New York” is found. This would make the search more efficient.

What is Sorting?

Sorting is the process or arranging items in a set in a specific order. Sorting a table would create a copy of the table in which the rows may have a different order than the original. Storing the new table would require an amount of space similar to that of the original table. Due to this reason sorting is used less frequently; only used when a new copy of the sorted table is required. Sorting is allowed using multiple fields, such as sorting addresses using the states and then sort using the cities inside the states.

What is the difference between Indexing and Sorting?

Indexing and sorting are two methods that can be used to create an order in a data table. Indexing would create an index file that contains only the logical order of rows along with their physical position in the table whereas with sorting, a copy of the sorted table has to be stored. Usually, the index file requires lesser space than storing a sorted table. Furthermore, some operations like running queries and searching would be faster with a table with indexes. In addition, indexing would not change the original order in the table, while sorting would change the order of rows. Also, operation such as linking tables would require having an index.

Related posts:

Difference Between MS SQL Server 2008 and 2008 R2 Difference Between DBMS and RDBMS Difference Between Deferred Update and Immediate Update Difference Between Database and Schema Difference Between Filesystem and DatabaseDifference Between Filesystem and Database

Filed Under:DatabaseTagged With:B-tree data structure,数据检索,index,索引文件,Indexing,non-unique indices,sort,Sorting,unique indices

About the Author:Indika

Indika, BSc.Eng, MSECE Computer Engineering, PhD. Computer Science, is an Assistant Professor and has research interests in the areas of Bioinformatics, Computational Biology, and Biomedical Natural Language Processing.

Leave a ReplyCancel reply

Your email address will not be published.Required fields are marked*

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Must and Shall

Difference Between Nitrogen Cycle and Carbon Cycle

Difference Between Nitrogen Cycle and Carbon Cycle

Difference Between T-Mobile myTouch and LG DoublePlay

Difference Between T-Mobile myTouch and LG DoublePlay

Difference Between 2.2 and 2.3 and 2.7 MacBook Pro

Difference Between J2SE and J2EE

Latest Posts

  • What is the Difference Between Induction Cooker and Normal Cooker
  • What is the Difference Between Vitiligo and Psoriasis
  • What is the Difference Between Cancellous and Cortical Bone
  • What is the Difference Between Electric and Induction Cooktop
  • What is the Difference Between Prevention and Cure
  • What is the Difference Between DSM IV and DSM V Autism
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018Difference Between. All rights reserved.Terms of Useand Privacy Policy:Legal.