Skip to content
Skein

sql-postgres

SQL & PostgreSQL, deep

The SQL language and Postgres internals for senior engineers — joins, windows, CTEs, transactions, the planner.

10 units·47 lessons·~12 h

Start track →
00

Start from zero

Before the deep material: what SQL is and how Postgres executes a query.
01

SQL foundations

The mental model: SQL describes sets, not steps.
02

Joins, deeply

Every join is a filtered Cartesian product — see that and outer/semi/anti/lateral follow.
03

Aggregation & grouping

GROUP BY collapses rows into buckets; everything in SELECT must be per-bucket.
04

Window functions

Windows aggregate without collapsing rows — the senior SQL superpower.
05

CTEs & recursion

WITH names a subquery; WITH RECURSIVE walks trees and graphs in pure SQL.
06

Types & modeling

Postgres has a rich type system — model with it, not around it.
07

Transactions & concurrency

Isolation levels are promises about what concurrent transactions can see.
08

Internals & tuning

Read the plan, fix the estimate, watch the bloat — the tuning loop.
09

Putting it together

Design and tune a real query system end to end.

Build with this track

Guided projects that exercise what you learn here.

◆ Projects

At-least-once job queue

Build a durable job queue on Postgres with visibility timeouts and idempotent consumers, so a crashed worker never drops a job.

◆ Projects

Idempotent ETL Pipeline

Pipelines don't fail gracefully — they fail at 3 a.m., halfway through a load, and someone re-runs them. This project teaches the one property that separates a hobby script from production data engineering: a run you can repeat any number of times and still land exactly one copy of each row. You'll build batch ingestion, an idempotent load, a watermark for incremental pulls, and the data-quality gates that stop bad data before it poisons everything downstream.

◆ Projects

Query plan visualizer

Paste an EXPLAIN (ANALYZE, FORMAT JSON) and render the plan tree with per-node timing and row-estimate error, so a bad join jumps out visually.

◆ Projects

Reporting Schema Optimizer

Reporting is where a database earns or loses its keep: the queries are wide, the tables are big, and 'it's slow' is the most common bug in production analytics. You'll model a sales-and-events domain, write the honest slow versions of the dashboard queries, then make them fast with indexes and materialized views — and you'll read EXPLAIN ANALYZE to prove the speedup instead of guessing at it. This is the heart of the track: turning a vague 'the report is laggy' into a measured, defensible plan change.

◆ Projects

Crash-safe key-value store with a WAL

Build a tiny on-disk KV store that survives a kill -9 mid-write by appending to a write-ahead log before touching the main file.

Next track

JavaScript Engine internals

How V8 runs your code — parsing, bytecode, hidden classes, the JIT, garbage collection, and how to stay fast.