Strategies For Storing Record In Disk

Strategies For Storing Record In Disk

Disk Structure

As we know that disk consists of tracks and sectors and intersect between them called "blocks or cluster" disk-structure.png

Unspanned Mapping

  • The record of a file is stored inside the block only if it can be stored completely inside it
  • Access time of a record is less

Spanned Mapping

  • the record of a file is stored inside the block even if it can only be stored partially
  • No wastage of memory (no internal fragmentation)

Example

From the previous point we go to show how records are stored on disk ?

  • Assume that we have table called employee, each row in this table needs around 200Byte to store it and block size is 1024Byte

Now to store any record we must have at least 200Byte.

We want to store 5 record which their size are 5 * 200 = 1000Byte, Now available free space in the block is 24Byte

If we want to store another record, We have two strategies

  • Add record in new block this strategy called "Unspanned Mapping"
  • Consume 24Byte and add 167Byte in new block this strategy called "Spanned Mapping"

Most DBMS used Unspanned Mapping because of access time of a record is less

See You Later