Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...ShapeBlue
WooCommerce Workshop: Bring Your LaptopLaura Hartwig
Ampere Offers Energy-Efficient Future For AI And CloudShapeBlue
Empowering Cloud Providers with Apache CloudStack and StackbillShapeBlue
Predicting the unpredictable: re-engineering recommendation algorithms for fr...Speck&Tech
Ad
Database_Indexing_AND ITTS TYPES PRESENTATION
1. DATABASE INDEXING
• Indexing is used to optimize the performance of a
database by minimizing the number of disk accesses
required when a query is processed.
• The index is a type of data structure. It is used to locate
and access the data in a database table quickly.
• Indexes are a powerful tool used in the background of
a database to speed up querying. They provide a
method to quickly look up the requested data.
• Simply put, an index is a pointer to data in a table. An
index in a database is very similar to an index in the
back of a book.
2. WHY ARE INDEXES NEEDED?
• Imagine walking into the Library of Congress and being given the task
of finding a specific publishing within 10 minutes. Would you be able
to complete this task within the given time frame?
• The Library of Congress houses approximately 170 million items. The
first thing one would do is access the library’s index because indexes
contain all the necessary information needed to access items quickly
and efficiently.
• Similarly, a database index contains all the necessary information to
access data quickly. Some tech giants process hundreds of petabytes of
data per day, and efficient access is crucial. Indexes serve as lookup
tables that store data efficiently for quicker retrieval.
3. INDEX STRUCTURE
• 1. Search Key - Contains a copy of the primary key
or candidate key of the table. These are stored in
sorted order.
• 2. Data Reference - Contains pointers holding the
address of the disk block where the value of the
key can be found.
5. 1. ORDERED INDICES
• To enhance search efficiency, indices are often sorted for
faster retrieval.
Example
• Consider a table of employees with thousands of records,
where each record is 10 bytes in size. Suppose employee IDs
start sequentially from 1, 2, 3, and so on.
– Without an index: The database must scan sequentially until it
reaches ID 543, reading 543 × 10 = 5,430 bytes.
– With an index: If each index entry is 2 bytes, the DBMS only needs
to read 542 × 2 = 1,084 bytes, making the search much faster.
6. 2. PRIMARY INDEX
• If an index is created using the primary key of
a table, it is called Primary Indexing.
• These primary keys are unique, and searching
performance is efficient.
• Primary indexes can be:
1. Dense Index
2. Sparse Index
7. 2. PRIMARY INDEX
1. Dense Index - Contains an index record for
every search key value. Faster searching but
requires more space.
8. 2. PRIMARY INDEX
2. Sparse Index - Index records appear for only
some values, reducing space usage but requiring
additional sequential searching.
9. 3. CLUSTERING INDEX
• A Clustering Index is used when an index is
created on non-primary key columns that may
not be unique. A combination of columns is
used to form a unique index.
• Example: Employees grouped by Dept_ID form
clusters, and the index points to the entire
cluster instead of individual records.
11. SECONDARY INDEX
• As table size grows, mapping in a sparse index
also grows. Secondary indexing introduces
another level of indexing to improve
efficiency.
- The first level index maps broad ranges
and is stored in primary memory.
- The second level index further divides
ranges and is stored in secondary memory.
12. SECONDARY INDEX
• Searching for Roll No. 111:
• Find the highest entry ≤ 111
in Level 1 (gets 100).
• In Level 2, find the highest ≤
111 (gets 110).
• Using address 110, search
the data block until Roll No.
111 is found.
• This hierarchical structure
improves search efficiency.