Indexing Notes Dbms
Indexing Notes Dbms
DBMS - Indexing
We know that data is stored in the form of records. Every record has a key field, which
helps it to be recognized uniquely.
Indexing is a data structure technique to efficiently retrieve records from the database
files based on some attributes on which the indexing has been done. Indexing in
database systems is similar to what we see in books.
following
Indexing is defined based on its indexing attributes. Indexing can be of the
types -
I Primary Index Primary index is defined on an ordered data file. The data file
primary key of the
is ordered on a key field. The key field is generally the
relation.
Secondary index may be generated from a field which is
a
Secondary Index
record, or a non-key with
candidate key and has a unique value in every
duplicate values.
Clustering index is defined on an ordereddata file.
The data
Clustering Index
file is ordered on a non-key field.
Dense Index
Sparse Index
Dense lndex
database, This
there is an index record for every search key value in the
In dense index, space to store index records
itself, Index
faster but requires more
makes searching the disk,
search key value and a pointer to the actual record on
records contain
1/7
https://www.tutorialspoint.com/dbms/dbms_indexing.htm
Page Iof 5
Page 2 of 7
China China Beijing 3,705,386
Canada Canada Ottawa 3,855,081
Russia Russia Moscow 6,592,735
USA USA Washington 3,718,691
Advertisement
F
Product anoary February March
Reglon Sales Rep Status
2Laptop 200 150 180 Noitt Jon Doecthve
$Mouse 300 500SoHuth
4 Monitor
ane Smith Acthe
150 120East Mark Le0tnactive
Keyboad 180 220 190 West Emma Ray Active
18
20
Sparse lndex
In sparse index, index records are not created for every search key. An index record here
contains a search key and an actual pointer to the data on the disk. To search a record,
we first proceed by index record and reach at the actual location of the data. If the data
we are looking for is not where we directly reach by following the index, then the system
starts sequential search until the desired data is found.
Multilevel Index
Index records comprise search-key values and data pointers. Multilevel index is stored
on the disk along with the actual database files. As the size of the database grows, so
in the
does the size of the indices. There is an immense need to keep the index records
1/
2/7
https://www.tutorialspoint.com/dbms/dbms_indexing.htm
hmLMLUIIUSUUL IL
Page I of 5
main memory s0 as to speed Page 3 of 7
2large size index up the search operations.
cannot be kept in memory which If single-level index is
used, then
leads to multiple disk
accesses.
Data Blocks
Inner Index
Outer Index
Inner Index Data Blocks
it
Inner Index
Outer Index
Data Blocks
Inner Index
Data Blocks
Multi-levelIndex helps in breaking down the index into several smaller indices in order to
make the outermost level so small that it can be saved in a singledisk block,which can
easily be accommodated anywhere in the main memory.
B* Tree
AB* tree is a balanced binary search tree that follows a multi-level index format. The
leaf nods of a B* tree denote actual data pointers. B* tree ensures that all leaf nodes
remain at the same height, thus balanced. Additionally, the leaf nodes are linked using a
link list; therefore, a Bt tree can support random access as well as sequential access.
Structure of B Tree
B* tree is of the order n where
Every leaf node is at equal distance from the root node. A
nis fixed for every B* tree.
ntamp Ordering
ENCtL CO5DFORTSP
Page 4 of 7
A B
D E G H
ulti Internal nodes
Usec
date
whi
Internal (non-leaf) nodes contain
at least [n/21 pointers,
At most, an internal except the root node.
In node can contain n
pointers.
WC
Leaf nodes -
B Tree Insertion
htps://www.tutorialspoint.com/dbms/dbms_indexing.htm
Page 5 of 7
B Tree Deletion
TOP TUTORIALS
Python Tutorial
Java Tutorial
C++ Tutorial
C Programming Tutorial
C# Tutorial
PHP Tutorial
R Tutorial
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
SQL Tutorial
TRENDING TECHNOLOGIES
5/7
Cloud Computing Tutorial
Amazon Web Services
Microsoft Azure TutorialTutorial
Page 6 of 7
Git Tutorial
Ethical Hacking Tutorial
Docker Tutorial
Multivers Kubernetes Tutorial
used in DSA Tutorial
data iter Spring Boot Tutorial
while pre SDLC Tutorial
In this a
Unix Tutorial
works.
Multive CERTIFICATIONS
Business Analytics Certification
In MVTO, Java & Spring Boot
Transactic Advanced Certification
Data Science
AdvancedCertification
There are Cloud Computing And
DevOps
Advanced Certification In
Business Analytics
Artificial Intelligence And
Tit Machine Learning
de DevOps Certification
Game Development Certification
Ve Front-End Developer Certification
un
AWS Certification Training
Or Python Programming Certification
the
COMPILERS &EDITORS
Online Java Compiler
Online Python Compiler
Online Go Compiler
Online C Compiler
Online C++ Compiler
Online C# Compiler
Online PHP Compiler
Online MATLAB Compiler
Online Bash Compiler
Online SQL Compiler
i
Online Html Editor
https/www.tutorialspoint.com/dbms/dbms_indexing.htm