What Is Indexing?: Indexing Is A Data Structure Technique Which Allows You To Quickly Retrieve
What Is Indexing?: Indexing Is A Data Structure Technique Which Allows You To Quickly Retrieve
An index -
Types of Indexing
Ty
pe of Indexes in Database
Primary Indexing
Secondary Indexing
Primary Index
Primary Index is an ordered file which is fixed length size with two fields. The
first field is the same a primary key and second, filed is pointed to that specific
data block. In the primary Index, there is always one to one relationship
between the entries in the index table.
The primary Indexing in DBMS is also further divided into two types.
Dense Index
Sparse Index
Dense Index
In a dense index, a record is created for every search key valued in the
database. This helps you to search faster but needs more space to store
index records. In this Indexing, method records contain search key value and
points to the real record on the disk.
Sparse Index
It is an index record that appears for only some of the values in the file.
Sparse Index helps you to resolve the issues of dense Indexing in DBMS. In
this method of indexing technique, a range of index columns stores the same
data block address, and when data needs to be retrieved, the block address
will be fetched.
However, sparse Index stores index records for only some search-key values.
It needs less space, less maintenance overhead for insertion, and deletions
but It is slower compared to the dense Index for locating records.
Secondary Index
The secondary Index in DBMS can be generated by a field which has a
unique value for each record, and it should be a candidate key. It is also
known as a non-clustering index.
Clustering Index
In a clustered index, records themselves are stored in the Index and not
pointers. Sometimes the Index is created on non-primary key columns which
might not be unique for each record. In such a situation, you can group two or
more columns to get the unique values and create an index which is called
clustered Index. This also helps you to identify the record faster.
Example:
B-Tree Index
B-tree index is the widely used data structures for tree based indexing in
DBMS. It is a multilevel format of tree based indexing in DBMS technique
which has balanced binary search trees. All leaf nodes of the B tree signify
actual data pointers.
Moreover, all leaf nodes are interlinked with a link list, which allows a B tree to
support both random and sequential access.
Advantages of Indexing
Important pros/ advantage of Indexing are: