Skip to content

MySQL Optimization Textbook

A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 329 companion flashcards using spaced repetition.

8 chapters · 329 cards · Updated

Chapters

  1. 1Foundations of MySQL Optimization

    The primary goal of MySQL optimization is to reduce query response times and resource consumption while improving the database's ability to scale with growing workload. Optimizatio...

  2. 2Understanding Query Execution with EXPLAIN

    The EXPLAIN command is the primary tool for inspecting how MySQL plans to execute a SELECT query. Its output reveals the table access order, the join type used for each table, whic...

  3. 3Mastering Indexes

    An index is a data structure that lets MySQL locate rows quickly based on column values, accelerating lookups, range filters, joins, and sorted access. By narrowing the rows MySQL...

  4. 4Schema Design and Data Types

    Good schema design begins with choosing appropriate data types for each column. Smaller and simpler types consume less storage, fit more rows per page, improve cache hit rates, and...

  5. 5Writing Efficient Queries

    The way a query is written often matters more than the configuration surrounding it. SELECT * is a common performance anti-pattern because it reads every column, preventing index-o...

  6. 6InnoDB Internals, Configuration, and Hardware

    Because InnoDB is MySQL's default storage engine, its internals strongly shape overall performance. The InnoDB buffer pool caches data and index pages in memory, so innodb_buffer_p...

  7. 7Concurrency, Transactions, and Locking

    InnoDB uses Multi-Version Concurrency Control (MVCC) to allow readers to see a consistent snapshot without blocking writers, which dramatically improves concurrency compared to sim...

  8. 8Monitoring, Scaling, and Operational Excellence

    Effective optimization depends on good observability. The slow query log, enabled via slow_query_log and thresholded by long_query_time, captures queries that exceed runtime budget...

← Back to the MySQL Optimization deck