Backend development

Stage 2 of 7 · 11 lessons · ~3 months

Relational databases and SQL

Almost every backend is a careful wrapper around a relational database. Learn to model data, write SQL by hand, index it for real queries and understand what your ORM does on your behalf.

Start: Queries and joins

Lessons· one lesson for each topic, in this order

  1. 1Queries and joins
  2. 2Grouping and aggregates
  3. 3Data modelling and normalisation
  4. 4Keys, constraints and relationships
  5. 5Indexes
  6. 6Reading query plans with EXPLAIN
  7. 7Transactions and ACID
  8. 8Isolation levels and locking
  9. 9database/sql, pgx or sqlc
  10. 10Schema migrations
  11. 11The N+1 query problem

Start with· follow one of these

Practise

Also worth your time

Before moving on: Design a PostgreSQL schema for a small booking or ordering system, write the ten queries it needs by hand, add indexes and show with EXPLAIN ANALYZE that they are used.

Tauseef's advice
Write raw SQL first, and in Go you may never need an ORM: database/sql or pgx with sqlc keeps queries visible and type-safe. Learn on PostgreSQL; it is the safest default and what most new projects pick.

Mark this stage as not done?