Skip to content
← All writing

// Series · 8 parts

Inside PostgreSQL

A row’s journey through PostgreSQL: indexes, the planner, VACUUM and the storage engine.

  1. 01

    Inside PostgreSQL Medium

    Inside PostgreSQL #001: Why Can PostgreSQL Find One Row Among 100 Million Records in…

    Imagine walking into the world’s largest library. It contains 100 million books, but none of them are arranged in any order. You ask the librarian: “Can you find the book PostgreSQL Internals?” The...

    · 4 min

    (opens on Medium in a new tab)
  2. 02

    Inside PostgreSQL Medium

    Inside PostgreSQL #002: What Actually Happens When You Run SELECT * FROM users;

    You write just one line of SQL… You press Enter. Within milliseconds, PostgreSQL returns thousands — or even millions — of rows. Seems simple, right? But behind that one query… PostgreSQL performs...

    · 4 min

    (opens on Medium in a new tab)
  3. 03

    Inside PostgreSQL Medium

    Inside PostgreSQL #003: How Does PostgreSQL Decide Between an Index Scan and a Sequential Scan?

    Imagine you’re standing in front of a massive library with 100 million books. You ask the librarian: “Can you find the book with ID 82736491?” The librarian has two choices. Walk through every...

    · 4 min

    (opens on Medium in a new tab)
  4. 04

    Inside PostgreSQL Medium

    Inside PostgreSQL #004: Why Is VACUUM One of PostgreSQL’s Most Important Processes?

    Imagine you’ve been living in the same house for ten years. Every day you: Throw away old papers Buy new furniture Replace broken items Rearrange rooms But… You never clean the house. You never...

    · 5 min · Stackademic

    (opens on Medium in a new tab)
  5. 05

    Inside PostgreSQL Medium

    Inside PostgreSQL #005 (part 1): How PostgreSQL Stores Your Data — From Relation Files to Heap…

    Let’s perform the simplest operation possible. One second later PostgreSQL says Done. Easy. But… Have you ever stopped and wondered what just happened? Where is Alice now? Seriously. Think about...

    · 4 min · Stackademic

    (opens on Medium in a new tab)
  6. 06

    Inside PostgreSQL Medium

    Inside PostgreSQL #005 (Part 2): Opening PostgreSQL’s Storage Engine

    In Part 1 we discovered something surprising. A PostgreSQL table isn’t really a table. It’s a Relation. That relation is stored as one or more files. Those files are divided into Heap Pages. Our...

    · 4 min · Stackademic

    (opens on Medium in a new tab)
  7. 07

    Inside PostgreSQL Medium

    Inside PostgreSQL #005 (Part 3): We Opened the Page…

    In Part 2, we opened a PostgreSQL page for the very first time. Instead of finding something like this… we discovered that a page actually looks like this. At the very bottom were something called...

    · 4 min · Stackademic

    (opens on Medium in a new tab)
  8. 08

    Inside PostgreSQL Medium

    Inside PostgreSQL #005 (Part 4): Every Row Has an Address

    Let’s go back to Alice. At this point, we know Alice is stored inside a Heap Page. Something like this: Looks simple. But now imagine someone asks PostgreSQL: “Can you give me Alice?” How does...

    · 4 min · Stackademic

    (opens on Medium in a new tab)
esc