AITeky Learn

AiTeky Original Interactive Learning & Practice Intermediate

PostgreSQL and MySQL in practice: SQL, concurrency and tuning

Write the SQL that day-to-day work needs (common table expressions, window functions, upserts), see how snapshots let readers and writers work at once, read a query plan, and tune a slow month-end report with measured results.

PostgreSQL and MySQL are the two most used open-source relational databases. They share the same core ideas: tables, SQL, transactions, indexes and a query planner. This course teaches those ideas in a small database that runs in your browser (SQLite), because the concepts and the SQL you write day to day are the same, and every result is something you can run and change.

Where PostgreSQL and MySQL differ (their data types, their extra features, their settings and some syntax), this course says so and does not pretend to run their exact commands. Check each product's own documentation for the details. All tables and numbers are made up.

  • Learn lessons explain one idea at a time and let you run it.
  • Industry ready lessons decide and justify, and end with interview questions.

You need basic SQL: SELECT, WHERE, GROUP BY and JOIN. The SQL course in the AI & Data Science library covers that.

Locked. Sign up free

Learn

Understand each idea with everyday examples. No coding background needed.

  1. 00 25 min πŸ”’ AiTeky Pass Start here: tables, rows, keys and first queries Learn what a relational database stores, why every row needs a key, and write your first queries to filter, count and join two tables.
  2. 01 35 min Free sample πŸ”’ AiTeky Pass CTEs, window functions and upserts Break a long query into named steps with a common table expression, rank and total rows without collapsing them using window functions, and insert-or-update in one statement with an upsert, on a small sales table.
  3. 02 35 min πŸ”’ AiTeky Pass Snapshots: how readers and writers work at the same time Build a tiny database that keeps several versions of each row, see how a reader that took a snapshot is not disturbed by a writer, reproduce a dirty read and a non-repeatable read in a database without snapshots, and meet the lost update that a snapshot alone does not prevent.
  4. 03 35 min πŸ”’ AiTeky Pass Reading a query plan and rewriting a slow query Run the same question three ways, a correlated sub-query, the same with an index and a single grouped pass, count the database work of each, read the plan the database chose, and learn which rewrite helps when an index is not enough.

Industry ready

Real problems from real jobs, and the questions interviewers ask about them.

  1. 04 40 min πŸ”’ AiTeky Pass On the job: fixing the month-end report The month-end revenue report takes so long that it slows the live app. Measure four fixes (an index, a rewrite, a nightly summary table and a read replica) by the work they do and what they cost, pick one, and write the recommendation for the engineering lead.

We use essential cookies to run the site. With your permission we also set one anonymous ID to count unique visitors, and analytics cookies to see which pages help learners. Cookie notice

Join AiTeky Learn. It's free.

Create a free account to track your progress, save items for later and get study suggestions.

Sign up free Log in