CSE Roadmap

Core tier · about 2 hours · 5 parts

Part 2 of 5 · 1 min read

Why a database caches pages itself

Reading from memory is far faster than reading from disk, so recently used pages are kept close.

Think of a chef keeping today's most-used ingredients on the counter, instead of walking to the pantry for every single one, every single time it is needed.

In plain words: the buffer pool is an area of memory holding recently read disk pages. A page already in the buffer pool can be read again without touching disk at all, which is dramatically faster. A database manages this cache itself, rather than relying only on the operating system's own file cache, since it understands its own access patterns better.

A worked example. Querying the same orders row twice in quick succession reads from disk the first time, but serves the second read entirely from the buffer pool, with no disk access at all.

The key lines. No SQL; buffer pool behavior is an internal storage-engine mechanism, not something a query directly controls.

Buffer pool

The buffer pool is an area of memory holding recently read disk pages, so a repeated read of the same page can be served from memory instead of disk.

Example: a second read of the same row, shortly after the first, is typically served from the buffer pool, far faster than the first disk-backed read.