DEV Community

Amr el-dessouki
Amr el-dessouki

Posted on

DBMS Disk manager introduction

If we want to understand DBMS internals, we first need to understand the storage hierarchy.

Image description

Above SSDs, we have temporary memory, which we call RAM. If the electricity goes off, all the information stored in RAM and above will be lost when the PC restarts. Additionally, all components above DRAM, including DRAM itself, are smaller in capacity compared to the components below DRAM

Image description

SEQUENTIAL VS. RANDOM ACCESS

Random access on non-volatile storage(all components above SSD) is almost always much slower than sequential access.

DBMS will want to maximize sequential access.

→ Algorithms try to reduce number of writes to random pages so that data is stored in contiguous blocks.
→ Allocating multiple pages at the same time is called an extent.

why RANDOM ACCESS is slow ?

lets say we need to execute this query

SELECT * FROM USERS

This means the DBMS needs to retrieve all user data. This data is stored in files on disk (we will discuss this in the next few articles). Fetching data from disk requires physical movement

Image description

The disk spins, and the disk head moves to read data. This movement takes time as it lands on the right sector that holds the USER table data, which is essentially wasted time. To optimize performance, we need to minimize head movement because any time spent moving is time wasted. Ideally, the head should retrieve all necessary data without moving.

Full Article Here DBMS Disk manager introduction

Top comments (0)