SlideShare a Scribd company logo
1 of 9
Download to read offline
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
The Memory Hierarchy
HDD >>
Internal Register >> Information inside the CPU is
stored in registers.
Hardware>> D flip-flops
Cache >> It is used to improve latency of fetching
information from Main Memory to CPU registers.
Types: L1, L2 & L3 cache.
Hardware >> SRAM (6 transistors)
Main Memory (RAM) >> Program Instructions and
Data are normally loaded into RAM memory.
Hardware >> DRAM (capacitor, transistor)
Secondary Storage (HDD) >> Permanent storage
of programs and data.
Hardware >> Magnetic Disk, SSD(microchip)
Tertiary Storage >> updates less frequently than
secondary and is not constantly online at all.
Hardware >> Magnetic tapes, Optical disks/tapes
DBMS
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
Transfer of Data>>
Disk Blocks is a group of sectors that the operating system can address. Entire blocks are moved to or from a continuous
section of main memory called buffer.
For example, NTFS Block Size is 4096 bytes(4KB). Block size can vary from 4-64 KB.
 A key technique for speeding up database operations is to arrange data so that when one piece of a disk block is
needed, it is likely that other data on the same block will also be needed at about the same time.
 It is not sufficient simply to scatter the records that represent tuples of a relation among various blocks.
Indexing
Queries like,
“Find all accounts at the Perryridge branch”
references only a fraction of the account records.
It is inefficient for the system to read every record and to check the branch-name field for the name “Perryridge”. That is
why we use index structure to gain fast random access to records in a file.
For example, to retrieve an account record given the account number
▸ The database system would look up an index to find on which disk block the corresponding record resides and
then fetch the disk block, to get the account record.
Types of Indices>>
i. Ordered indices: Based on a sorted ordering of the indexed key values.
ii. Hash indices : Based on a uniform distribution of indexed key values (determined by hash function) across a
range of buckets.
What type you will consider for your system depends on several factors, such as
 Access types: The types of access (Point queries, Range queries) that are supported efficiently.
 Access time: The time it takes to find a particular data item, or set of items, using the technique in question.
 Insertion time: The time it takes to insert a new data item. This value includes the time it takes to find the
correct place to insert the new data item, as well as the time it takes to update the index structure.
 Deletion time: The time it takes to delete a data item. This value includes the time it takes to find the item to be
deleted, as well as the time it takes to update the index structure.
 Space overhead: The additional space occupied by an index structure. Provided that, the amount of additional
space is moderate, it is usually worthwhile to sacrifice the space to achieve improved performance.
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
Ordered Indices >>
▸ Each index structure is associated with a particular search key. An attribute or set of attributes used to look up
records in a file/disk block/page is called a search key.
▸ An index record consists of a search-key value, and pointers to one or more data records with that value as their
search-key value.
The pointer to a data record consists of the identifier of a disk block and an offset within the disk block to
identify the record within the block.
▸ An ordered index stores the values of the search keys in sorted order, and associates with each search key the
data records that contain it.
Different Types of Ordered Indices>>
1. Primary Index: If the file containing the records is sequentially ordered, a primary index is an ordered index
whose search key also defines the sequential order of the file. Primary indices are also called clustering indices.
The search key of a primary index is usually the primary key, although that is not necessarily so.
If all files are ordered sequentially on some search key, then such files with a primary index on the search key,
are called index-sequential files.
2. Secondary Index: Ordered Indices whose search key specifies an order different from the sequential order of
the file are called secondary indices, or non-clustering indices.
Secondary indices must be dense, with an index entry for every search-key value, and a pointer to every record
in the file.
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
If a secondary index stores only some of the search-key values(sparse), records with intermediate search-key
values may be anywhere in the file and, in general, we cannot find them without searching the entire file.
3. Dense Index: An index record appears for every search-key value in the file.
Type 1) Dense + Primary Index + No Duplicate Search Keys
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
Type 2) Dense + Primary Index + Duplicate Search Keys
Type 3) Dense + Secondary Index (with/without Duplicate Search Keys)
4. Sparse Index: An index record appears for only some of the search-key values.
To locate a record,
we find the index entry with the largest search-key value that is less than or equal to the search-key value for
which we are looking. We start at the record pointed to by that index entry, and follow the pointers in the file
until we find the desired record.
A good design is to have a sparse index with one index entry per block as the time to scan the entire block is
negligible than the time to bring a block from disk into main memory.
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
Type 1) Sparse + Primary Index
Type 2) Sparse + Secondary Index IS IT POSSIBLE!!!!!!!
Dense vs Sparse Index:
▸ It is generally faster to locate a record if we have a dense index rather than a sparse index.
▸ However, sparse indices have advantages over dense indices in that they require less space and they impose less
maintenance overhead for insertions and deletions.
▸ In practice,
to have a file with 100,000 records, with 10 records stored in each data block. If we have one index record per
block, the index has 10,000 records. Index records are smaller than data records, so let us assume that 100 index
records fit on a block. Thus, our index occupies 100 blocks.
Such large indices are stored as sequential files on disk. A search for an entry in the index block requires as many
as ⌈log2(b)⌉ blocks to be read(binary search).
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
5. Multilevel Indices: The process of searching a large index structure may be costly. The solution is Multilevel
Index (Indices with two or more levels).
Problems of Multilevel Indices?
6. B+
Tree Index Structure: This index structure is the most widely used of several index structures that maintain
their efficiency despite insertion and deletion of data.
A B+-tree index takes the form of a balanced tree in which every path from the root of the tree to a leaf of the
tree is of the same length.
Structure of B+
tree >>
▹ Degree/Order/Maximum no of Pointers = n = 5 and Maximum no of keys = n-1 = 4
▹ The search key values within a node are kept in ascending sorted order.
▹ Root node >> Minimum no of keys =1 and minimum no of pointers = 2
▹ Non-leaf node >> Minimum no of keys = ⌈
𝑛
2
⌉ − 1 and minimum no of pointers = ⌈
𝑛
2
⌉
▹ Leaf node >> Minimum no of keys = ⌈
𝑛−1
2
⌉ and minimum no of pointers = ⌈
𝑛−1
2
⌉ + 1
▹ Left child node search key values are less then the parent key value and Right child values are greater
than or equal to the parent key value.
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
Example, for n=5,
▸ Each node contains maximum 5 pointers
▸ Each node contains maximum 4 key values
▸ Each root node contains at least 2 pointers
▸ Each non-leaf node contains at least ⌈5/2⌉ = 3 pointers that is at least 2 key values
▸ Each leaf node contains at least ⌈(5 − 1)/2⌉ = 2 key values
Insertion into a B+
Tree >>
initially,
inserting 7(free slot exists),
inserting 8(no free slot + copy up + push up),
Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com
Class Practice Samples:
1. Construct a B+
tree for the following set of key values, where each internal node can contain at most 4 childrens.
Assume that the tree is initially empty and values are added sequentially one by one.
a) 11, 61, 101, 5, 40, 25, 80, 30, 92, 130, 165, 35, 50, 56
b) 5, 50, 100, 25, 40, 45, 150, 80, 30, 15, 35

More Related Content

What's hot

TOC 2 | Deterministic Finite Automata
TOC 2 | Deterministic Finite AutomataTOC 2 | Deterministic Finite Automata
TOC 2 | Deterministic Finite AutomataMohammad Imam Hossain
 
TOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity CheckTOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity CheckMohammad Imam Hossain
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Abhimanyu Mishra
 
AI 2 | Rational Agents and Problem Formulation
AI 2 | Rational Agents and Problem FormulationAI 2 | Rational Agents and Problem Formulation
AI 2 | Rational Agents and Problem FormulationMohammad Imam Hossain
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Saket Pathak
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examplesgreatqadirgee4u
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsSarvesh Rawat
 

What's hot (20)

TOC 9 | Pushdown Automata
TOC 9 | Pushdown AutomataTOC 9 | Pushdown Automata
TOC 9 | Pushdown Automata
 
TOC 2 | Deterministic Finite Automata
TOC 2 | Deterministic Finite AutomataTOC 2 | Deterministic Finite Automata
TOC 2 | Deterministic Finite Automata
 
Er model
Er modelEr model
Er model
 
TOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity CheckTOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity Check
 
DBMS 7 | Relational Query Language
DBMS 7 | Relational Query LanguageDBMS 7 | Relational Query Language
DBMS 7 | Relational Query Language
 
AI 3 | Uninformed Search
AI 3 | Uninformed SearchAI 3 | Uninformed Search
AI 3 | Uninformed Search
 
TOC 10 | Turing Machine
TOC 10 | Turing MachineTOC 10 | Turing Machine
TOC 10 | Turing Machine
 
TOC 7 | CFG in Chomsky Normal Form
TOC 7 | CFG in Chomsky Normal FormTOC 7 | CFG in Chomsky Normal Form
TOC 7 | CFG in Chomsky Normal Form
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
 
TOC 6 | CFG Design
TOC 6 | CFG DesignTOC 6 | CFG Design
TOC 6 | CFG Design
 
AI 2 | Rational Agents and Problem Formulation
AI 2 | Rational Agents and Problem FormulationAI 2 | Rational Agents and Problem Formulation
AI 2 | Rational Agents and Problem Formulation
 
AI 5 | Local Search
AI 5 | Local SearchAI 5 | Local Search
AI 5 | Local Search
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
AI 6 | Adversarial Search
AI 6 | Adversarial SearchAI 6 | Adversarial Search
AI 6 | Adversarial Search
 
Chomsky Normal Form
Chomsky Normal FormChomsky Normal Form
Chomsky Normal Form
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
 

Similar to DBMS 8 | Memory Hierarchy and Indexing

lecture 2 notes indexing in application of database systems.pptx
lecture 2 notes indexing in application of database systems.pptxlecture 2 notes indexing in application of database systems.pptx
lecture 2 notes indexing in application of database systems.pptxpeter1097
 
overview of storage and indexing BY-Pratik kadam
overview of storage and indexing BY-Pratik kadam overview of storage and indexing BY-Pratik kadam
overview of storage and indexing BY-Pratik kadam pratikkadam78
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMSVrushaliSolanke
 
fileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdffileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdfFraolUmeta
 
Data indexing presentation
Data indexing presentationData indexing presentation
Data indexing presentationgmbmanikandan
 
FILE ORGANIZATION.pptx
FILE ORGANIZATION.pptxFILE ORGANIZATION.pptx
FILE ORGANIZATION.pptxKavya990096
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...Javed Khan
 
Chapter 3 Indexing Structure.pdf
Chapter 3 Indexing Structure.pdfChapter 3 Indexing Structure.pdf
Chapter 3 Indexing Structure.pdfJemalNesre1
 
Database and Research Matrix.pptx
Database and Research Matrix.pptxDatabase and Research Matrix.pptx
Database and Research Matrix.pptxRahulRoshan37
 
Index Structures.pptx
Index Structures.pptxIndex Structures.pptx
Index Structures.pptxMBablu1
 

Similar to DBMS 8 | Memory Hierarchy and Indexing (20)

indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
 
lecture 2 notes indexing in application of database systems.pptx
lecture 2 notes indexing in application of database systems.pptxlecture 2 notes indexing in application of database systems.pptx
lecture 2 notes indexing in application of database systems.pptx
 
Data storage and indexing
Data storage and indexingData storage and indexing
Data storage and indexing
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
Database management system session 6
Database management system session 6Database management system session 6
Database management system session 6
 
overview of storage and indexing BY-Pratik kadam
overview of storage and indexing BY-Pratik kadam overview of storage and indexing BY-Pratik kadam
overview of storage and indexing BY-Pratik kadam
 
Storage struct
Storage structStorage struct
Storage struct
 
Db lec 08_new
Db lec 08_newDb lec 08_new
Db lec 08_new
 
DBMS (UNIT 5)
DBMS (UNIT 5)DBMS (UNIT 5)
DBMS (UNIT 5)
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMS
 
fileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdffileorganizationandintroductionofdbms-210313163900.pdf
fileorganizationandintroductionofdbms-210313163900.pdf
 
Data indexing presentation
Data indexing presentationData indexing presentation
Data indexing presentation
 
FILE ORGANIZATION.pptx
FILE ORGANIZATION.pptxFILE ORGANIZATION.pptx
FILE ORGANIZATION.pptx
 
Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...
 
Lucece Indexing
Lucece IndexingLucece Indexing
Lucece Indexing
 
Chapter 3 Indexing Structure.pdf
Chapter 3 Indexing Structure.pdfChapter 3 Indexing Structure.pdf
Chapter 3 Indexing Structure.pdf
 
Database and Research Matrix.pptx
Database and Research Matrix.pptxDatabase and Research Matrix.pptx
Database and Research Matrix.pptx
 
DMBS Indexes.pptx
DMBS Indexes.pptxDMBS Indexes.pptx
DMBS Indexes.pptx
 
Index Structures.pptx
Index Structures.pptxIndex Structures.pptx
Index Structures.pptx
 
Files
FilesFiles
Files
 

More from Mohammad Imam Hossain

DS & Algo 4 - Graph and Shortest Path Search
DS & Algo 4 - Graph and Shortest Path SearchDS & Algo 4 - Graph and Shortest Path Search
DS & Algo 4 - Graph and Shortest Path SearchMohammad Imam Hossain
 
DS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionDS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionMohammad Imam Hossain
 
DBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR SchemaDBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR SchemaMohammad Imam Hossain
 
TOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite AutomataTOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite AutomataMohammad Imam Hossain
 
TOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of ComputationTOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of ComputationMohammad Imam Hossain
 

More from Mohammad Imam Hossain (17)

DS & Algo 6 - Offline Assignment 6
DS & Algo 6 - Offline Assignment 6DS & Algo 6 - Offline Assignment 6
DS & Algo 6 - Offline Assignment 6
 
DS & Algo 6 - Dynamic Programming
DS & Algo 6 - Dynamic ProgrammingDS & Algo 6 - Dynamic Programming
DS & Algo 6 - Dynamic Programming
 
DS & Algo 5 - Disjoint Set and MST
DS & Algo 5 - Disjoint Set and MSTDS & Algo 5 - Disjoint Set and MST
DS & Algo 5 - Disjoint Set and MST
 
DS & Algo 4 - Graph and Shortest Path Search
DS & Algo 4 - Graph and Shortest Path SearchDS & Algo 4 - Graph and Shortest Path Search
DS & Algo 4 - Graph and Shortest Path Search
 
DS & Algo 3 - Offline Assignment 3
DS & Algo 3 - Offline Assignment 3DS & Algo 3 - Offline Assignment 3
DS & Algo 3 - Offline Assignment 3
 
DS & Algo 3 - Divide and Conquer
DS & Algo 3 - Divide and ConquerDS & Algo 3 - Divide and Conquer
DS & Algo 3 - Divide and Conquer
 
DS & Algo 2 - Offline Assignment 2
DS & Algo 2 - Offline Assignment 2DS & Algo 2 - Offline Assignment 2
DS & Algo 2 - Offline Assignment 2
 
DS & Algo 2 - Recursion
DS & Algo 2 - RecursionDS & Algo 2 - Recursion
DS & Algo 2 - Recursion
 
DS & Algo 1 - Offline Assignment 1
DS & Algo 1 - Offline Assignment 1DS & Algo 1 - Offline Assignment 1
DS & Algo 1 - Offline Assignment 1
 
DS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionDS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL Introduction
 
DBMS 1 | Introduction to DBMS
DBMS 1 | Introduction to DBMSDBMS 1 | Introduction to DBMS
DBMS 1 | Introduction to DBMS
 
DBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR SchemaDBMS 5 | MySQL Practice List - HR Schema
DBMS 5 | MySQL Practice List - HR Schema
 
TOC 5 | Regular Expressions
TOC 5 | Regular ExpressionsTOC 5 | Regular Expressions
TOC 5 | Regular Expressions
 
TOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite AutomataTOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite Automata
 
TOC 3 | Different Operations on DFA
TOC 3 | Different Operations on DFATOC 3 | Different Operations on DFA
TOC 3 | Different Operations on DFA
 
TOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of ComputationTOC 1 | Introduction to Theory of Computation
TOC 1 | Introduction to Theory of Computation
 
Web 6 | JavaScript DOM
Web 6 | JavaScript DOMWeb 6 | JavaScript DOM
Web 6 | JavaScript DOM
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

DBMS 8 | Memory Hierarchy and Indexing

  • 1. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com The Memory Hierarchy HDD >> Internal Register >> Information inside the CPU is stored in registers. Hardware>> D flip-flops Cache >> It is used to improve latency of fetching information from Main Memory to CPU registers. Types: L1, L2 & L3 cache. Hardware >> SRAM (6 transistors) Main Memory (RAM) >> Program Instructions and Data are normally loaded into RAM memory. Hardware >> DRAM (capacitor, transistor) Secondary Storage (HDD) >> Permanent storage of programs and data. Hardware >> Magnetic Disk, SSD(microchip) Tertiary Storage >> updates less frequently than secondary and is not constantly online at all. Hardware >> Magnetic tapes, Optical disks/tapes DBMS
  • 2. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com Transfer of Data>> Disk Blocks is a group of sectors that the operating system can address. Entire blocks are moved to or from a continuous section of main memory called buffer. For example, NTFS Block Size is 4096 bytes(4KB). Block size can vary from 4-64 KB.  A key technique for speeding up database operations is to arrange data so that when one piece of a disk block is needed, it is likely that other data on the same block will also be needed at about the same time.  It is not sufficient simply to scatter the records that represent tuples of a relation among various blocks. Indexing Queries like, “Find all accounts at the Perryridge branch” references only a fraction of the account records. It is inefficient for the system to read every record and to check the branch-name field for the name “Perryridge”. That is why we use index structure to gain fast random access to records in a file. For example, to retrieve an account record given the account number ▸ The database system would look up an index to find on which disk block the corresponding record resides and then fetch the disk block, to get the account record. Types of Indices>> i. Ordered indices: Based on a sorted ordering of the indexed key values. ii. Hash indices : Based on a uniform distribution of indexed key values (determined by hash function) across a range of buckets. What type you will consider for your system depends on several factors, such as  Access types: The types of access (Point queries, Range queries) that are supported efficiently.  Access time: The time it takes to find a particular data item, or set of items, using the technique in question.  Insertion time: The time it takes to insert a new data item. This value includes the time it takes to find the correct place to insert the new data item, as well as the time it takes to update the index structure.  Deletion time: The time it takes to delete a data item. This value includes the time it takes to find the item to be deleted, as well as the time it takes to update the index structure.  Space overhead: The additional space occupied by an index structure. Provided that, the amount of additional space is moderate, it is usually worthwhile to sacrifice the space to achieve improved performance.
  • 3. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com Ordered Indices >> ▸ Each index structure is associated with a particular search key. An attribute or set of attributes used to look up records in a file/disk block/page is called a search key. ▸ An index record consists of a search-key value, and pointers to one or more data records with that value as their search-key value. The pointer to a data record consists of the identifier of a disk block and an offset within the disk block to identify the record within the block. ▸ An ordered index stores the values of the search keys in sorted order, and associates with each search key the data records that contain it. Different Types of Ordered Indices>> 1. Primary Index: If the file containing the records is sequentially ordered, a primary index is an ordered index whose search key also defines the sequential order of the file. Primary indices are also called clustering indices. The search key of a primary index is usually the primary key, although that is not necessarily so. If all files are ordered sequentially on some search key, then such files with a primary index on the search key, are called index-sequential files. 2. Secondary Index: Ordered Indices whose search key specifies an order different from the sequential order of the file are called secondary indices, or non-clustering indices. Secondary indices must be dense, with an index entry for every search-key value, and a pointer to every record in the file.
  • 4. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com If a secondary index stores only some of the search-key values(sparse), records with intermediate search-key values may be anywhere in the file and, in general, we cannot find them without searching the entire file. 3. Dense Index: An index record appears for every search-key value in the file. Type 1) Dense + Primary Index + No Duplicate Search Keys
  • 5. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com Type 2) Dense + Primary Index + Duplicate Search Keys Type 3) Dense + Secondary Index (with/without Duplicate Search Keys) 4. Sparse Index: An index record appears for only some of the search-key values. To locate a record, we find the index entry with the largest search-key value that is less than or equal to the search-key value for which we are looking. We start at the record pointed to by that index entry, and follow the pointers in the file until we find the desired record. A good design is to have a sparse index with one index entry per block as the time to scan the entire block is negligible than the time to bring a block from disk into main memory.
  • 6. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com Type 1) Sparse + Primary Index Type 2) Sparse + Secondary Index IS IT POSSIBLE!!!!!!! Dense vs Sparse Index: ▸ It is generally faster to locate a record if we have a dense index rather than a sparse index. ▸ However, sparse indices have advantages over dense indices in that they require less space and they impose less maintenance overhead for insertions and deletions. ▸ In practice, to have a file with 100,000 records, with 10 records stored in each data block. If we have one index record per block, the index has 10,000 records. Index records are smaller than data records, so let us assume that 100 index records fit on a block. Thus, our index occupies 100 blocks. Such large indices are stored as sequential files on disk. A search for an entry in the index block requires as many as ⌈log2(b)⌉ blocks to be read(binary search).
  • 7. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com 5. Multilevel Indices: The process of searching a large index structure may be costly. The solution is Multilevel Index (Indices with two or more levels). Problems of Multilevel Indices? 6. B+ Tree Index Structure: This index structure is the most widely used of several index structures that maintain their efficiency despite insertion and deletion of data. A B+-tree index takes the form of a balanced tree in which every path from the root of the tree to a leaf of the tree is of the same length. Structure of B+ tree >> ▹ Degree/Order/Maximum no of Pointers = n = 5 and Maximum no of keys = n-1 = 4 ▹ The search key values within a node are kept in ascending sorted order. ▹ Root node >> Minimum no of keys =1 and minimum no of pointers = 2 ▹ Non-leaf node >> Minimum no of keys = ⌈ 𝑛 2 ⌉ − 1 and minimum no of pointers = ⌈ 𝑛 2 ⌉ ▹ Leaf node >> Minimum no of keys = ⌈ 𝑛−1 2 ⌉ and minimum no of pointers = ⌈ 𝑛−1 2 ⌉ + 1 ▹ Left child node search key values are less then the parent key value and Right child values are greater than or equal to the parent key value.
  • 8. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com Example, for n=5, ▸ Each node contains maximum 5 pointers ▸ Each node contains maximum 4 key values ▸ Each root node contains at least 2 pointers ▸ Each non-leaf node contains at least ⌈5/2⌉ = 3 pointers that is at least 2 key values ▸ Each leaf node contains at least ⌈(5 − 1)/2⌉ = 2 key values Insertion into a B+ Tree >> initially, inserting 7(free slot exists), inserting 8(no free slot + copy up + push up),
  • 9. Mohammad Imam Hossain, Lecturer, Dept. of CSE, UIU. Email: imambuet11@gmail.com Class Practice Samples: 1. Construct a B+ tree for the following set of key values, where each internal node can contain at most 4 childrens. Assume that the tree is initially empty and values are added sequentially one by one. a) 11, 61, 101, 5, 40, 25, 80, 30, 92, 130, 165, 35, 50, 56 b) 5, 50, 100, 25, 40, 45, 150, 80, 30, 15, 35