SlideShare une entreprise Scribd logo
1  sur  26
VIJAY KUMAR SHARMA 1
Storing Data
Disk Organization and I/O
www.kumarvijaybaswa.blogspot.com
VIJAY KUMAR SHARMA 2
Disks
 DBMS stores information on (“hard”) disks.
 This has major implications for DBMS
design!
• READ: transfer data from disk to main memory
(RAM).
• WRITE: transfer data from RAM to disk.
• Both are high-cost operations, relative to in-
memory operations, so must be planned
carefully!
VIJAY KUMAR SHARMA 3
Why Not Store Everything in Main Memory?
 Costs too much. $1000 will buy you
over 128MB of RAM or 7.5GB of disk
today.
 Main memory is volatile. We want data
to be saved between runs.
(Obviously!)
VIJAY KUMAR SHARMA 4
 Typical storage hierarchy:
• Main memory (RAM) for currently used
data.
• Disk for the main database (secondary
storage).
• Tapes for archiving older versions of the
data (tertiary storage).
VIJAY KUMAR SHARMA 5
Disks
 Secondary storage device of
choice.
 Main advantage over tapes:
random access vs. sequential.
 Data is stored and retrieved in
units called disk blocks or pages.
VIJAY KUMAR SHARMA 6
 Unlike RAM, time to retrieve a disk
page varies depending upon location
on disk.
• Therefore, relative placement of pages
on disk has major impact on DBMS
performance!
VIJAY KUMAR SHARMA 7
Components of a Disk
Platters
The platters spin (say, 100rps).
Spindle
The arm assembly is moved
in or out to position a head
on a desired track. Tracks
under heads make a
cylinder (imaginary!).
Disk head
Arm movement
Arm assembly
Only one head
reads/writes at any
one time.
Tracks
Sector
 Block size is a multiple
of sector size (which is fixed).
VIJAY KUMAR SHARMA 8
Accessing a Disk Page
 Time to access (read/write) a disk
block:
• seek time (moving arms to position disk
head on track)
• rotational delay (waiting for block to
rotate under head)
 often called “rotational latency”
• transfer time (actually moving data
to/from disk surface)
VIJAY KUMAR SHARMA 9
 Seek time and rotational delay dominate.
• Seek time varies from about 1 to 20msec
• Rotational delay varies from 0 to 10msec
• Transfer rate is about 1msec per 4KB page
 Key to lower I/O cost: reduce
seek/rotation delays! Hardware vs.
software solutions?
VIJAY KUMAR SHARMA 10
Arranging Pages on Disk
 `Next’ block concept:
• blocks on same track, followed by
• blocks on same cylinder, followed by
• blocks on adjacent cylinder
 Blocks in a file should be arranged
sequentially on disk (by `next’), to
minimize seek and rotational
delay.
VIJAY KUMAR SHARMA 11
 For a sequential scan, pre-fetching
several pages at a time is a big win!
VIJAY KUMAR SHARMA 12
Disk Space Management
 Lowest layer of DBMS software
manages space on disk.
 Higher levels call upon this layer to:
• allocate/de-allocate a page
• read/write a page
VIJAY KUMAR SHARMA 13
 One such “higher level” is the buffer
manager, which receives a request
to bring a page into memory and
then, if needed, requests the disk
space layer to read the page into the
buffer pool.
VIJAY KUMAR SHARMA 14
Buffer Management in a DBMS
DB
MAIN MEMORY
DISK
disk page
free frame
Page Requests from Higher Levels
BUFFER POOL
choice of frame dictated
by replacement policy
VIJAY KUMAR SHARMA 15
 Data must be in RAM for DBMS to
operate on it!
 Table of <frame#, pageid> pairs is
maintained.
VIJAY KUMAR SHARMA 16
When a Page is Requested ...
 If requested page is not in pool:
• Choose an unpinned frame for
replacement; pin_count := 1
• If frame is dirty, write it to disk
• Read requested page into chosen frame
 Else:
• increment pin_count
VIJAY KUMAR SHARMA 17
 Return its address.
 If requests can be predicted (e.g., sequential scans)
pages can be pre-fetched several pages at a time!
VIJAY KUMAR SHARMA 18
More on Buffer Management
 Requestor of page must unpin it, and
indicate whether page has been
modified:
• dirty bit is used for this.
 Page in pool may be requested many
times:
• a pin count is used. A page is a
candidate for replacement iff pin count
= 0.
VIJAY KUMAR SHARMA 19
 CC & recovery may entail additional
I/O when a frame is chosen for
replacement. (Write-Ahead Log
protocol; more later.)
VIJAY KUMAR SHARMA 20
Buffer Replacement Policy
 Frame is chosen for replacement by
a replacement policy:
• Least-recently-used (LRU), Clock, MRU,
etc.
 Policy can have big impact on # of
I/O’s; depends on the access
pattern.
VIJAY KUMAR SHARMA 21
 Sequential flooding: Nasty situation
caused by LRU + repeated sequential
scans.
• # buffer frames < # pages in file means
each page request causes an I/O. MRU
much better in this situation (but not in
all situations, of course).
VIJAY KUMAR SHARMA 22
Files of Records
 Page or block is OK when doing I/O,
but higher levels of DBMS operate on
records, and files of records.
VIJAY KUMAR SHARMA 23
 FILE: A collection of pages, each
containing a collection of records.
Must support:
• insert/delete/modify record
• read a particular record (specified using
record id)
• scan all records (possibly with some
conditions on the records to be
retrieved)
VIJAY KUMAR SHARMA 24
Disk and File Summary
 Disks provide cheap, non-volatile
storage.
• Random access, but cost depends on
location of page on disk; important to
arrange data sequentially to minimize
seek and rotation delays.
VIJAY KUMAR SHARMA 25
 Buffer manager brings pages into RAM.
• Page stays in RAM until released by
requestor(s).
• Written to disk when frame chosen for
replacement (which is after all requestors
release the page), or earlier.
• Choice of frame to replace based on
replacement policy.
 File layer keeps track of pages in a file,
and supports abstraction of a collection of
records.
VIJAY KUMAR SHARMA 26
End

Contenu connexe

Tendances

Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)
Tarah DiNardo
 
DB2 and Storage Management
DB2 and Storage ManagementDB2 and Storage Management
DB2 and Storage Management
Craig Mullins
 
40 demand paging
40 demand paging40 demand paging
40 demand paging
myrajendra
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_Scalability
Israel Gold
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_Scalability
Israel Gold
 

Tendances (20)

Random Access memory.
Random Access memory.Random Access memory.
Random Access memory.
 
Db2 and storage management (mullins)
Db2 and storage management (mullins)Db2 and storage management (mullins)
Db2 and storage management (mullins)
 
Managed disk-Azure Storage Evolution
Managed disk-Azure Storage EvolutionManaged disk-Azure Storage Evolution
Managed disk-Azure Storage Evolution
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)Maxta_MxSP_for_VMware (1)
Maxta_MxSP_for_VMware (1)
 
Storage memory
Storage memoryStorage memory
Storage memory
 
Disk
DiskDisk
Disk
 
DB2 and Storage Management
DB2 and Storage ManagementDB2 and Storage Management
DB2 and Storage Management
 
40 demand paging
40 demand paging40 demand paging
40 demand paging
 
Dba tuning
Dba tuningDba tuning
Dba tuning
 
Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_Scalability
 
Disk memory systems
Disk memory systemsDisk memory systems
Disk memory systems
 
Storage Fundamentals Presentation
Storage Fundamentals PresentationStorage Fundamentals Presentation
Storage Fundamentals Presentation
 
IMDB_Scalability
IMDB_ScalabilityIMDB_Scalability
IMDB_Scalability
 
Solid state drive (ssd)
Solid state drive (ssd)Solid state drive (ssd)
Solid state drive (ssd)
 
Nano-node: Intelligent Hard Drives in Large Storage Infrastructures
Nano-node: Intelligent Hard Drives in Large Storage InfrastructuresNano-node: Intelligent Hard Drives in Large Storage Infrastructures
Nano-node: Intelligent Hard Drives in Large Storage Infrastructures
 
Storage devices lesson 1
Storage devices lesson 1Storage devices lesson 1
Storage devices lesson 1
 
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
 
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
IMC Summit 2016 Breakout - Pandurang Naik - Demystifying In-Memory Data Grid,...
 

En vedette (10)

Hard disk
Hard diskHard disk
Hard disk
 
Hard disk PPT
Hard disk PPTHard disk PPT
Hard disk PPT
 
Presentation of the big external memory
Presentation of the big external memoryPresentation of the big external memory
Presentation of the big external memory
 
Magnetic disk
Magnetic diskMagnetic disk
Magnetic disk
 
Operation System
Operation SystemOperation System
Operation System
 
06 External Memory
06  External  Memory06  External  Memory
06 External Memory
 
Primary and secondary storage devices
Primary and secondary storage devicesPrimary and secondary storage devices
Primary and secondary storage devices
 
17. Recovery System in DBMS
17. Recovery System in DBMS17. Recovery System in DBMS
17. Recovery System in DBMS
 
External memory
External memoryExternal memory
External memory
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similaire à Storing data : Disk Organization and I/O

What is the future of disk drives?
What is the future of disk drives?What is the future of disk drives?
What is the future of disk drives?
Iftikhar Alam
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage media
Srinath Sri
 
Dbms by jeet goyal
Dbms by jeet goyalDbms by jeet goyal
Dbms by jeet goyal
jeet1991
 
Disk structure.45
Disk structure.45Disk structure.45
Disk structure.45
myrajendra
 

Similaire à Storing data : Disk Organization and I/O (20)

Lecture storage-buffer
Lecture storage-bufferLecture storage-buffer
Lecture storage-buffer
 
Conceptual framework storage devices (2)
Conceptual framework   storage devices (2)Conceptual framework   storage devices (2)
Conceptual framework storage devices (2)
 
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce ServerInitial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
Initial deck on WebSphere eXtreme Scale with WebSphere Commerce Server
 
Disks and Stable Storage.ppt
Disks and Stable Storage.pptDisks and Stable Storage.ppt
Disks and Stable Storage.ppt
 
What is the future of disk drives?
What is the future of disk drives?What is the future of disk drives?
What is the future of disk drives?
 
04.01 file organization
04.01 file organization04.01 file organization
04.01 file organization
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Nachos 2
Nachos 2Nachos 2
Nachos 2
 
Kinetic basho public
Kinetic basho publicKinetic basho public
Kinetic basho public
 
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.pptLECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
LECTURE13nvjlfdihbkzbjvzbfmdnmzbxckbn.ppt
 
Overview of physical storage media
Overview of physical storage mediaOverview of physical storage media
Overview of physical storage media
 
Presentation database on flash
Presentation   database on flashPresentation   database on flash
Presentation database on flash
 
Dbms by jeet goyal
Dbms by jeet goyalDbms by jeet goyal
Dbms by jeet goyal
 
DownloadClassSessionFile (44).pdf
DownloadClassSessionFile (44).pdfDownloadClassSessionFile (44).pdf
DownloadClassSessionFile (44).pdf
 
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar AhmedPGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
PGConf.ASIA 2019 Bali - Tune Your LInux Box, Not Just PostgreSQL - Ibrar Ahmed
 
Disk structure.45
Disk structure.45Disk structure.45
Disk structure.45
 
The life and times
The life and timesThe life and times
The life and times
 
Cmp
CmpCmp
Cmp
 
Managing Memory & Locks - Series 1 Memory Management
Managing  Memory & Locks - Series 1 Memory ManagementManaging  Memory & Locks - Series 1 Memory Management
Managing Memory & Locks - Series 1 Memory Management
 
운영체제론 Ch13
운영체제론 Ch13운영체제론 Ch13
운영체제론 Ch13
 

Plus de Computer Hardware & Trouble shooting (7)

Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
Vlsm
VlsmVlsm
Vlsm
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Php tutorial
Php  tutorialPhp  tutorial
Php tutorial
 
Mcse question
Mcse questionMcse question
Mcse question
 
Css notes
Css notesCss notes
Css notes
 
File organization
File organizationFile organization
File organization
 

Dernier

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Dernier (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
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
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

Storing data : Disk Organization and I/O

  • 1. VIJAY KUMAR SHARMA 1 Storing Data Disk Organization and I/O www.kumarvijaybaswa.blogspot.com
  • 2. VIJAY KUMAR SHARMA 2 Disks  DBMS stores information on (“hard”) disks.  This has major implications for DBMS design! • READ: transfer data from disk to main memory (RAM). • WRITE: transfer data from RAM to disk. • Both are high-cost operations, relative to in- memory operations, so must be planned carefully!
  • 3. VIJAY KUMAR SHARMA 3 Why Not Store Everything in Main Memory?  Costs too much. $1000 will buy you over 128MB of RAM or 7.5GB of disk today.  Main memory is volatile. We want data to be saved between runs. (Obviously!)
  • 4. VIJAY KUMAR SHARMA 4  Typical storage hierarchy: • Main memory (RAM) for currently used data. • Disk for the main database (secondary storage). • Tapes for archiving older versions of the data (tertiary storage).
  • 5. VIJAY KUMAR SHARMA 5 Disks  Secondary storage device of choice.  Main advantage over tapes: random access vs. sequential.  Data is stored and retrieved in units called disk blocks or pages.
  • 6. VIJAY KUMAR SHARMA 6  Unlike RAM, time to retrieve a disk page varies depending upon location on disk. • Therefore, relative placement of pages on disk has major impact on DBMS performance!
  • 7. VIJAY KUMAR SHARMA 7 Components of a Disk Platters The platters spin (say, 100rps). Spindle The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder (imaginary!). Disk head Arm movement Arm assembly Only one head reads/writes at any one time. Tracks Sector  Block size is a multiple of sector size (which is fixed).
  • 8. VIJAY KUMAR SHARMA 8 Accessing a Disk Page  Time to access (read/write) a disk block: • seek time (moving arms to position disk head on track) • rotational delay (waiting for block to rotate under head)  often called “rotational latency” • transfer time (actually moving data to/from disk surface)
  • 9. VIJAY KUMAR SHARMA 9  Seek time and rotational delay dominate. • Seek time varies from about 1 to 20msec • Rotational delay varies from 0 to 10msec • Transfer rate is about 1msec per 4KB page  Key to lower I/O cost: reduce seek/rotation delays! Hardware vs. software solutions?
  • 10. VIJAY KUMAR SHARMA 10 Arranging Pages on Disk  `Next’ block concept: • blocks on same track, followed by • blocks on same cylinder, followed by • blocks on adjacent cylinder  Blocks in a file should be arranged sequentially on disk (by `next’), to minimize seek and rotational delay.
  • 11. VIJAY KUMAR SHARMA 11  For a sequential scan, pre-fetching several pages at a time is a big win!
  • 12. VIJAY KUMAR SHARMA 12 Disk Space Management  Lowest layer of DBMS software manages space on disk.  Higher levels call upon this layer to: • allocate/de-allocate a page • read/write a page
  • 13. VIJAY KUMAR SHARMA 13  One such “higher level” is the buffer manager, which receives a request to bring a page into memory and then, if needed, requests the disk space layer to read the page into the buffer pool.
  • 14. VIJAY KUMAR SHARMA 14 Buffer Management in a DBMS DB MAIN MEMORY DISK disk page free frame Page Requests from Higher Levels BUFFER POOL choice of frame dictated by replacement policy
  • 15. VIJAY KUMAR SHARMA 15  Data must be in RAM for DBMS to operate on it!  Table of <frame#, pageid> pairs is maintained.
  • 16. VIJAY KUMAR SHARMA 16 When a Page is Requested ...  If requested page is not in pool: • Choose an unpinned frame for replacement; pin_count := 1 • If frame is dirty, write it to disk • Read requested page into chosen frame  Else: • increment pin_count
  • 17. VIJAY KUMAR SHARMA 17  Return its address.  If requests can be predicted (e.g., sequential scans) pages can be pre-fetched several pages at a time!
  • 18. VIJAY KUMAR SHARMA 18 More on Buffer Management  Requestor of page must unpin it, and indicate whether page has been modified: • dirty bit is used for this.  Page in pool may be requested many times: • a pin count is used. A page is a candidate for replacement iff pin count = 0.
  • 19. VIJAY KUMAR SHARMA 19  CC & recovery may entail additional I/O when a frame is chosen for replacement. (Write-Ahead Log protocol; more later.)
  • 20. VIJAY KUMAR SHARMA 20 Buffer Replacement Policy  Frame is chosen for replacement by a replacement policy: • Least-recently-used (LRU), Clock, MRU, etc.  Policy can have big impact on # of I/O’s; depends on the access pattern.
  • 21. VIJAY KUMAR SHARMA 21  Sequential flooding: Nasty situation caused by LRU + repeated sequential scans. • # buffer frames < # pages in file means each page request causes an I/O. MRU much better in this situation (but not in all situations, of course).
  • 22. VIJAY KUMAR SHARMA 22 Files of Records  Page or block is OK when doing I/O, but higher levels of DBMS operate on records, and files of records.
  • 23. VIJAY KUMAR SHARMA 23  FILE: A collection of pages, each containing a collection of records. Must support: • insert/delete/modify record • read a particular record (specified using record id) • scan all records (possibly with some conditions on the records to be retrieved)
  • 24. VIJAY KUMAR SHARMA 24 Disk and File Summary  Disks provide cheap, non-volatile storage. • Random access, but cost depends on location of page on disk; important to arrange data sequentially to minimize seek and rotation delays.
  • 25. VIJAY KUMAR SHARMA 25  Buffer manager brings pages into RAM. • Page stays in RAM until released by requestor(s). • Written to disk when frame chosen for replacement (which is after all requestors release the page), or earlier. • Choice of frame to replace based on replacement policy.  File layer keeps track of pages in a file, and supports abstraction of a collection of records.