Database index

Database index

Unlock the power of efficient data retrieval with database indexing. A crucial yet often overlooked aspect of database management, indexing can dramatically improve your system's performance. Let's delve into its intricacies and understand how it can revolutionize your data handling.

Bitmap index

A special kind of index that stores the bulk of its data as bit arrays (bitmaps) and answers most queries by performing bitwise logical operations on these bitmaps.

Non-Clustered

The data is present in arbitrary order, but the logical ordering is specified by the index. The data rows may be spread throughout the table regardless of the value of the indexed column or expression.

Covering index

This index is only used to locate data records in the table and not to return data.

Index concurrency control

A.k.a. index locking

Clustered

alters the data block into a certain distinct order to match the index, resulting in the row data being stored in order

Column order

The order that the index definition defines the columns in is important.

Data structure for query optimization in databases

Index: a copy of selected columns of data, from a table, that is designed to enable very efficient search

Standardization

No standard defines how to create indexes, because the ISO SQL Standard does not cover physical aspects.

Policing the database constraints

Indexes are used to police database constraints, such as UNIQUE, EXCLUSION, PRIMARY KEY, AND FOREIGN KEY

Dense index

In databases, a dense index is a file with pairs of keys and pointers for every record in the data file. Every key in this file is associated with a particular pointer to a record. In clustered indices with duplicate keys, the dense index points to the first record with that key.

Sparse index

In databases, a sparse index is a file with pairs of keys and pointers for every block in the data file. Every key in this file is associated with a particular pointer to a particular key in the sorted data file, and points to the lowest-bladed search key in each block.

Applications and limitations

Indexes are useful for many applications but come with some limitations.

Cluster

When multiple databases and multiple tables are joined, it is called a cluster. The records for the tables sharing the value of a cluster key shall be stored together in the same or nearby data blocks.

Secondary index

Used to index fields that are neither ordering fields nor key fields (there is no assurance that the file is organized on key field or primary key field)

Index implementations

Indices can be implemented using a variety of data structures. Popular indices include balanced trees, B+ trees and hashes.

Support for fast lookup

Since databases may contain many objects, and since lookup is a common operation, it is often desirable to improve performance.

Source

Get in