Database Daily
qwertydiy's profile
Rene Yibowei@qwertydiy•Jun 09, 2025
16.1K
Post cover image

How Databases Store Your Tables on Disk

Avatar of programmingdigestProgramming Digest•From deepintodev.com•Jun 08, 2025•16m read time

Databases store tables using a hierarchical structure of pages and heap files. Data is organized in fixed-size pages (typically 8KB-16KB) that contain multiple rows, with databases reading entire pages rather than individual rows for efficiency. Tables are stored in heap files where pages can be unordered, making full table scans expensive. Indexes solve this by creating separate B-tree structures that point to specific pages in the heap, dramatically reducing I/O operations. Clustered indexes physically organize table data based on the index key, with databases like MySQL's InnoDB storing all tables as clustered indexes by default. The choice of primary key affects performance significantly, as random values like UUIDs can cause page splits and fragmentation.

1 Comment

Sort:

qwertydiy's user avatar
Rene Yibowei
@qwertydiy
Joined Feb 8. 2023
16.1K

Secondary School Student doing the Full Stack with Linux, currently learning Data Science

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard