inflearn logo

Practical MySQL Databases — Design, Indexes, Execution Plans, Transactions, and Locks for Backend Developers, Reproduced Hands-On with a Practicing DBA

I run MySQL 8.4 in Docker on my laptop and reproduce all 82 lessons hands-on, using one million orders to verify the schema, data types, indexes, execution plans, transactions, MVCC, locks, deadlocks, connections, replication, and backups with real numbers. The screens for Lessons 1–31 are actual terminal captures; from Lesson 32 onward, they show the original output from the practice database, copied verbatim. Each lesson includes a hands-on kit you can run right away.

3 learners are taking this course

Level Intermediate

Course period Unlimited

MySQL
MySQL
SQL
SQL
query-optimization
query-optimization
indexing
indexing
Transaction Management
Transaction Management
MySQL
MySQL
SQL
SQL
query-optimization
query-optimization
indexing
indexing
Transaction Management
Transaction Management

What you will gain after the course

  • Design requirements as tables, keys, and relationships, then compare the costs of normalization and denormalization numerically.

  • We read execution plans (EXPLAIN, EXPLAIN ANALYZE, and optimizer traces) and identify bottlenecks based on the number of rows read.

  • Design composite and covering indexes to match query patterns, and identify cases where indexes actually make things slower.

  • Learn how to reproduce and stop isolation levels, MVCC, gap locks, deadlocks, and metadata locks firsthand using two sessions.

  • I implement concurrency-safe code for scenarios like inventory deduction and first-come, first-served coupons, without lost updates.

  • We handle pagination, bulk processing, online schema changes, connection pooling, replication lag, backups, and point-in-time recovery without incidents.

Have you directly verified with numbers what this query and this transaction do in production?

Run MySQL 8.4 in Docker on your laptop and use one million orders to directly reproduce all 82 lessons—from schema design, data types, indexes, and execution plans to transactions, MVCC, locks, deadlocks, connections, replication, and backups—and verify the results with numbers. Each lesson includes the exact commands used and a hands-on practice kit you can run right away.

We go beyond indexes and execution plans to cover MVCC, undo, long-running transactions, reproducing gap locks and deadlocks, metadata locks, concurrency issues with inventory and coupons, connection pools, replication lag, backups and point-in-time recovery, and incident reproduction—all from an operations DBA perspective. Every number comes from results run directly on the practice database.

By the end of this course, you will be able to

  • Diagnose slow queries using execution plans and rows read, fix them with composite and covering indexes, and prove the improvement with before-and-after numbers.

  • Reproduce isolation levels and locks across two sessions, and write concurrency code for inventory, coupons, and similar cases without lost updates, deadlocks, or gap locks.

  • Identify and stop long transactions, metadata lock waits, and connection exhaustion using status values.

  • Perform bulk processing, online schema changes, backups, and point-in-time recovery without incidents.

Recommended for:

  • Backend developers who know the basics of SQL but lack confidence when working with production databases

  • Developers with 1–5 years of experience who need to diagnose slow queries, lock waits, and deadlocks themselves

  • Developers who have to manage MySQL without a DBA

  • For those who want to master MySQL from design through operations in one place

Curriculum (12 sections · 82 lessons · about 972 minutes, 16 hours 12 minutes)

  • Section 1. Getting Started — MySQL in Numbers — The power of a single index — reduce rows read from 1 million to 20 and verify with an execution plan; hands-on environment — launch MySQL 8.4 and Loop Market data with Docker; MySQL architecture at a glance — inspect connections, the optimizer, InnoDB, and the buffer pool through status variables.

  • Section 2. Design and Modeling — From Requirements to Tables — Modeling Loop Market’s Order Domain, Key Design — Natural Keys and Surrogate Keys, Measuring Insertion Speed: AUTO_INCREMENT vs. UUID, Relationships and Foreign Keys — 1:N, N:M, and 1:1; Locks Imposed by Foreign Keys, Normalization — Create an Update Anomaly and Fix It with 1NF, 2NF, and 3NF, Denormalization and Aggregate Tables — When to Break the Rules and What to Accept, Practical Design Patterns — Status, History, and Soft Deletes, JSON and Generated Columns — The Cost of Flexibility and Backing It Up with Indexes

  • Section 3. Data Types — Numeric types — integer ranges, DECIMAL vs. FLOAT and rounding errors in monetary calculations; string types — utf8mb4, collations, case sensitivity and whitespace comparisons; dates and times — DATETIME vs. TIMESTAMP and time zones; type mismatches kill indexes — reproducing implicit type conversion

  • Section 4. Indexes — B+Tree index structure — measuring pages and height in practice, clustered and secondary indexes — the cost of retrieving the PK, composite index column order — equality conditions first, ranges later, covering indexes — queries that don’t read the table, sorting and grouping with indexes — eliminating filesort and temporary tables, reproducing seven cases where indexes aren’t used, selectivity, statistics, and histograms — the numbers the optimizer sees, the cost of indexes — write speed, duplicate indexes, and safe removal

  • Section 5. Reading Execution Plans — How to read EXPLAIN — type·key·rows·filtered·Extra, EXPLAIN ANALYZE — estimated and actual side by side, optimizer trace — why it chose that plan, join algorithms — nested loop·hash join·driving table, subquery optimization — semi-join·IN·EXISTS·derived table, hints and plan stability — when to use them and when to avoid them, slow query log and performance_schema — finding problematic queries

  • Section 6. Practical Query Tuning Cases — Case: The admin order list is slow, Case: Product search with LIKE — leading wildcards and full-text search, Case: Order statistics by member — reducing random reads from joins, Case: OR conditions — index merge and rewriting as UNION, COUNT(*) is slow — exact counts versus sufficient counts, How to prove your tuning worked — repeatedly measuring the same conditions and reporting the results

  • Section 7. Pagination, Bulk Processing, and Schema Changes — How OFFSET pagination slows down, keyset pagination and deferred joins, bulk INSERT — comparing one row at a time, multiple rows, and LOAD DATA, bulk UPDATE·DELETE — deleting in batches, online schema changes — INSTANT·INPLACE·COPY and metadata locks

  • Section 8. Transactions and MVCC — Transaction basics — commit, rollback, and auto-commit pitfalls, the four isolation levels — reproduce anomalies yourself, MVCC and undo — why aren’t reads blocked?, REPEATABLE READ pitfalls — ordinary reads and locking reads, lost updates, long transactions — while the history list piles up, designing transaction boundaries — what happens when you put an external call inside, optimistic and pessimistic locking — version columns and FOR UPDATE

  • Section 9. Locks, Deadlocks, and Concurrency — InnoDB lock types — viewing record, gap, and next-key locks with data_locks, an UPDATE without an index locks the table, reproducing an INSERT blocked by a gap lock, reproducing a deadlock and reading the logs, reducing deadlocks — ordering, indexes, short transactions, and retries, concurrency in inventory deduction — from lost updates to conditional UPDATEs, first-come-first-served coupons — unique keys, INSERT IGNORE, and SKIP LOCKED, metadata lock wait queue — one ALTER blocks everything, tracking lock waits — lock wait timeout and sys views

  • Section 10. Connections and Server Operations — Connection Limits — Reproducing “Too many connections,” Connection Count and Throughput — Is a Bigger Pool Always Better?, Buffer Pool, Temporary Tables, and Sort Buffer — Putting Numbers to Memory, Reviewing Key Settings — Defaults You Shouldn’t Leave As Is

  • Section 11. Replication, Backups, and Incident Reproduction — Replication Setup — Starting Up a GTID Source and Replica, Replication Lag and Read-After-Write Issues, Backups — mysqldump Consistency and Restore Time, Point-in-Time Recovery with Binary Logs, Incident Reproduction Capstone 1 — When a Single Slow Query Consumes All Connections, Incident Reproduction Capstone 2 and Wrap-Up — Operations Checklist

  • Section 12. Recreating Real-World Cases — Revisiting Them with Incident Cards — One click on the bulk coupon button makes writes buckle, repeated clicks on the delete button — the same bulk deletes run concurrently, a daily aggregation UPSERT batch deadlocks with daytime orders, the SELECT in the deadlock dump isn’t the culprit, code deployed before the column, a trigger can’t find the partition and payments fail, one banner list consumes all the read replica’s CPU, an integration feature scans the entire inventory every few minutes, a query called once per product — seeing N+1 at the database level, order keyword searches that are slow only for heavy users, an API that fetches millions of rows at once, COUNT queries that won’t stop after a sale opens, an UPDATE of the last login time on every login, running an analytics query on the write node caused orders to be rejected, a batch has been failing for days and nobody noticed, the execution plan changed after an upgrade

Practice Environment

We’ll run MySQL 8.4 primary and replica nodes in Docker on your laptop. A fixed set of rules generates data for Loop Market, a fictional sports and outdoor goods store (100,000 members, 20,000 products, 1 million orders, 2 million order items, and 200,000 reviews), so everyone sees the same numbers. There are no cloud costs. Each lesson includes a hands-on kit with a PDF guide, ready-to-run SQL, and scenario scripts. A ZIP of the complete practice environment is available in Lessons 2 and 66.

Prerequisites

  • SQL Basics (SELECT, JOIN, UPDATE)

  • Run commands in the terminal

  • Docker installation (for hands-on practice; 4 GB of memory or more recommended)

What This Course Does Not Cover

  • Introduction to SQL Syntax

  • How to use a specific ORM

  • Operating a cloud-managed database console

  • MySQL Source Code Analysis

Guide

The videos were made using slides and synthesized voice (TTS). The screens in lessons 1–31 show actual terminal captures, while from lesson 32 onward, they show the original output copied exactly from executions in the practice database. All numbers and results shown on screen come from actual execution results. All data is fictional and for educational purposes, and numbers may vary depending on the execution environment.

Recommended for
these people

Who is this course right for?

  • A backend developer who knows the basics of SQL but lacks confidence when working with production databases

  • Developers with 1–5 years of experience who need to diagnose slow queries, lock waits, and deadlocks firsthand

  • A startup developer tasked with managing MySQL without a DBA

  • For anyone looking to get a comprehensive grasp of MySQL, from design through operations.

Need to know before starting?

  • SQL Basics (SELECT·JOIN·UPDATE)

  • Run a command in the terminal

  • Docker installation (for hands-on practice; 4 GB or more of memory recommended)

Hello
This is dorian05202988

Career Verified

197

Learners

4

Reviews

3.0

Rating

52

Courses

A data craftsman with over 20 years of experience in databases and IT. As a DBA and manager of a DB Platform team, I work with database platforms and specialize in MySQL, PostgreSQL, Oracle, MongoDB, SQL tuning, AWS, Terraform, and Python. Drawing on experience in the gaming, finance, and IT services industries, I explain database and cloud architecture. I have published 『Oracle Practical Tuning: Learning SQL Patterns』 and 『Oracle Pro*C Practical Project Guide』, and have presented on serverless architectures, database selection, and multi-database strategies at AWS Summit 2018 and 2019 and DataYa Nolja 2020. Recently, I have been working on slow-query analysis and tuning recommendations using Bedrock LLM, automated DB specification sizing, and query workflows through a DB metadata MCP server and Slack bot. I explain database automation for developers and AI applications for non-developers through hands-on exercises tailored to the audience and objectives of each course. Rather than applying AI suggestions as-is, I teach a decision-making framework that verifies result equivalence, execution plans, and observability conditions, and defers action when the supporting evidence is insufficient. Company operational data and credentials are not included in the course materials.

More

Curriculum

All

82 lectures ∙ (16hr 11min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

dorian05202988's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$38.50

23%

$50.60