Database Storage: From Records to Page Reads

Database Storage connects the records you work with to the bytes that hold them. A table containing thousands of records is normally stored across many physical pages, and retrieving a small result can still require several page reads. Understanding this layer helps you estimate storage requirements and explain why record placement and caching affect retrieval, without needing to write a query.

Pages connect records to storage

A page is a fixed-size unit that a database storage manager organizes and transfers between persistent storage and memory. A page can contain several records. Persistent storage retains the database when its ordinary in-memory copies disappear.


A common page design includes a header, a slot directory, record bytes and free space. The header describes the page. Each slot identifies where one record sits, allowing its bytes to move within the page while the slot continues to locate it. Exact layouts vary between database implementations.


A schematic storage page contains a header, a slot directory, free space and records.


The buffer pool is the database-managed memory area that holds copies of pages. If a requested page is already there, the database can use the copy without fetching that page from persistent storage again. A clean, unmodified copy can be discarded without deleting the stored records. Modified pages require additional write-management rules, beyond the read-cost model here.

Calculate space using a stated layout

For a simplified fixed-length layout, let PP be bytes per page, HH fixed page overhead, RR bytes per record including its record header, and SS slot bytes per record. If records cannot cross page boundaries, capacity is


c=⌊P−HR+S⌋.c=\left\lfloor\frac{P-H}{R+S}\right\rfloor.


The floor brackets mean round down to a whole number. Provided c≥1c\geq 1, storing NN records on pages filled to this capacity requires


B=⌈Nc⌉,allocated bytes=BP.B=\left\lceil\frac{N}{c}\right\rceil, \qquad \text{allocated bytes}=BP.


The ceiling brackets mean round up: a partly occupied final page still occupies a whole page. These equations describe the stated model. Variable-length records, reserved free space and other implementation overhead can change actual capacity.



Unused bytes within allocated pages still count toward allocated storage. Also, BPBP describes these table pages only; it does not automatically include indexes or other database files.

Placement changes retrieval cost

A heap file can place a new record wherever suitable space exists. An index supplies searchable entries that help locate records, but following an index can require reading both index pages and table pages.


Storage arrangement

Retrieval implication

Storage or maintenance implication

Unordered heap without a useful index

A full scan may inspect every table page

No required search-key ordering

Records grouped by the search key

Nearby matching records may share pages

Maintaining the grouping can require extra work

Separate index over a heap

Index entries locate records whose pages may be scattered

Index pages occupy space and need maintenance


For a particular access, count distinct required pages that are absent from the buffer pool:


storage page reads=required pages not already cached.\text{storage page reads}=\text{required pages not already cached}.


A cold-cache model starts with none of the relevant pages cached. Under that assumption, a full scan reads all BB table pages. An index-based retrieval reads its required index pages plus its distinct required table pages. Several matching records on one page need only one read of that page, provided it remains available in memory.



Page-read counts explain storage traffic, but they do not determine elapsed time alone. Sequential access, scattered access, device behaviour and processing work also matter.

What to remember

  • Pages contain both records and overhead.
  • Round record capacity down and required page count up.
  • Record placement determines how many distinct table pages a retrieval touches.
  • Cached pages can reduce storage reads without changing the stored table size.
  • Fewer page reads alone do not guarantee a shorter running time.

Example: Planning a Sensor Archive

A monitoring team archives 14,500 fixed-length sensor records. Each table page contains 8,192 bytes, with 192 bytes reserved for fixed page overhead. Each record occupies 196 bytes, including its record header, and needs a separate 4-byte slot entry. The record footprint is the total page space required by one record and its slot entry.


Assume records cannot span pages, pages are filled to maximum capacity before another page is used, and there is no additional overhead. Calculate table storage separately from index storage.


a) How many records fit on one page?


First remove the fixed overhead. The usable space is ________. Then combine the stored record and its slot entry: the record footprint is ________.


P−H=8192−192=8000 bytes,R+S=196+4=200 bytes per record.P-H=8192-192=8000\ \text{bytes}, \qquad R+S=196+4=200\ \text{bytes per record}.


Divide usable space by the footprint, rounding down because a fraction of a record cannot occupy the remaining space.


c=⌊8000200⌋=40 records per page.c=\left\lfloor\frac{8000}{200}\right\rfloor=40\ \text{records per page}.


The page capacity is 40 records. As a check, 40×200=800040\times200=8000 bytes exactly fills the usable space.


b) How many table pages are required, and how many bytes do those pages occupy?


Divide the number of records by the capacity. Before rounding, the quotient is ________.


Nc=1450040=362.5.\frac{N}{c}=\frac{14500}{40}=362.5.


The first 362 full pages hold 362×40=14,480362\times40=14{,}480 records. The remaining 20 records require one additional page, even though it will be only partly occupied.


B=⌈362.5⌉=363 pages.B=\lceil362.5\rceil=363\ \text{pages}.


Multiply by the complete page size, including overhead and unused space in the final page.


allocated bytes=363×8192=2,973,696 bytes.\text{allocated bytes}=363\times8192=2{,}973{,}696\ \text{bytes}.


The table requires 363 pages occupying 2,973,696 bytes. This excludes index pages and other database files.


c) A lookup retrieves one archived record. Its index traversal requires three distinct index pages, followed by one table page. Compare its storage page reads with a full scan of the table. Both operations start independently with empty caches, retain pages once read, and access no other pages.


For the index-based lookup, the index contributes ________ and the table contributes ________. Each required page is initially absent from memory.


Clookup=3+1=4 page reads.C_{\text{lookup}}=3+1=4\ \text{page reads}.


A full scan reads every allocated table page, including the partly occupied final page. It does not also traverse the index.


Cscan=B=363 page reads.C_{\text{scan}}=B=363\ \text{page reads}.


The lookup requires 4 storage page reads, compared with 363 for the full scan, a reduction of 363−4=359363-4=359 reads. This comparison measures page reads, not a guaranteed elapsed-time ratio. The different access patterns can have different costs per read.

A database uses a buffer pool, an in-memory cache of database pages. It discards a clean, unmodified page from this cache, while the persistent copy remains valid. Later, a request needs that page again. Assuming no other cache supplies it, what should happen?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A database designer is comparing physical storage choices for an archive. Match each organization or access structure to its defining property. A search key need not uniquely identify a record.

Match each term
A.

Maintains data records in search-key order so nearby key values are stored together.

B.

Stores records wherever space is available without maintaining search-key order.

C.

Uses a balanced hierarchy of ordered entries and linked leaves to support equality and range searches.

D.

Maps a search-key value to a bucket for equality searches without maintaining an ordered sequence of keys.

B+ tree index

Heap file

Sorted file

Hash index

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A laboratory database stores 9,400 fixed-length records. Each page contains 4,096 bytes, including 96 bytes of fixed page overhead. Each record occupies 150 bytes, including its record header, and requires a separate 10-byte slot entry. Records cannot span pages, and pages are filled to maximum capacity before another page is used. How many table pages are required? Answer in pages, as a whole number with zero decimal places.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice