// Writing
Notes from beneath the surface
Explainers on how PostgreSQL and Rails work inside, published on Medium and Stackademic.
10 posts
-
(opens on Medium in a new tab)
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)
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)
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)
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)
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)
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)
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)
How Rails Actually Knows Which Controller to Execute Medium
Part 2: How Rails Actually Knows Which Controller to Execute
At this point, our request has finally reached the router. Rails already knows one thing. It needs to find which controller should handle this request. Seems easy, right? Not really. Imagine you’re...
· 4 min
-
(opens on Medium in a new tab)
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)
How Rails Actually Knows Which Controller to Execute Medium
Part 1: How Rails Actually Knows Which Controller to Execute
“Rails feels magical… until you realize every bit of that magic is carefully engineered.” If you’ve built a Rails application, you’ve probably written something like this: Started your server…...
· 4 min