/    /  DBMS – Comparison of Ordered Indexing and Hashing

Comparison of Ordered Indexing and Hashing

 

Based on the type of query, either indexing or hashing has to be chosen.

The performance of the database is optimised using indexing, since it reduces the number of disk accessing. Whereas, Hashing doesn’t use index structure and directly calculates the location of the disk record. For large databases, hashing works well compared to Indexing.

In an SQL query, if the ‘where’ clause contains ‘equal to’ sign, then Hashing technique is preferable.

Ex :          Select   SName

                   From  STUD

                   Where   DNo = 5;

 

In an SQL query, if the ‘where’ clause contains ‘greater than  or less than’ sign, then Indexing technique is preferable.

Ex :          Select   SName

                   From  STUD

                   Where DNo  <  5;

 

Reference Link

Comparison of Ordered Indexing and Hashing