Database Internals: Page Layout Explained (based on PostgreSQL)

Published: 09 December 2025
on channel: Data Craze
372
17

Ever wondered what actually happens on disk when you run an INSERT command?

It’s not magic. It’s engineering. And understanding it is the difference between a "database user" and a "database engineer".

In this video, we leave the SQL layer behind and dive deep into the physical storage of PostgreSQL. We’ll look at the famous 8KB page, see how tuples are arranged like a game of Tetris, and meet the silent heroes responsible for performance: FSM and VM.

TIMELINE:
00:00:00 Intro
00:00:23 Welcome
00:01:19 PGDATA
00:03:08 Main Table File
00:04:21 Free Space Map
00:05:19 Visibility Map
00:06:25 Initialization Fork
00:07:50 Page Layout
00:11:17 SQL Examples
00:16:26 Summary

SUMMARY:
👉 Pages are fixed-size: PostgreSQL typically uses 8KB pages. Your rows (tuples) must fit in here, or special mechanisms kick in.
👉 The "Tetris" of Storage: Items (row data) grow from the end of the page backwards, while pointers grow from the start. The empty space in the middle where the battle for efficiency happens.
👉 FSM & VM are critical: The Free Space Map prevents slow full-table scans during inserts, while the Visibility Map powers the ultra-fast Index-Only Scans.

RESOURCES:
📝 Full Article: https://datacraze.io/database-file-la...
📩 Data Craze Newsletter: https://datacraze.io/news
🧑‍💻 Github Script: https://github.com/datacraze/youtube-...
📚 PGData Documentation: https://www.postgresql.org/docs/curre...
#PostgreSQL #DatabaseInternals #DataEngineering #SystemDesign #Backend


On this page of the site you can watch the video online Database Internals: Page Layout Explained (based on PostgreSQL) with a duration of hours minute second in good quality, which was uploaded by the user Data Craze 09 December 2025, share the link with friends and acquaintances, this video has already been watched 372 times on youtube and it was liked by 17 viewers. Enjoy your viewing!