
Explore how MySQL separates query processing from data storage through its storage engine architecture, and learn the end-to-end query execution flow—from parsing and optimization to execution and returning results.
Explore how MySQL's SQL layer rewrites queries, uses statistics to estimate costs, and produces an execution plan the optimizer selects, with hints and index design to improve performance.
Discover the storage engine layer in MySQL, where plugin engines like innertube (default) and NDB Cluster store data, and learn how the optimizer uses engine capabilities and costs.
Explore MySQL's layered architecture, from storage engines to query execution, and learn how the optimizer and execution steps influence writing better queries through educated decisions.
Learn to diagnose performance issues by measuring query execution time with the performance schema, using events, statements, and digest to identify the top time-consuming queries and optimize them.
Identify the top ten time-consuming queries via a view that shows total time, percent, executions, and average latency, and use statement analysis to diagnose root causes, including prepared statements.
Review event statements by digest to identify candidate queries for optimization. Look for high rows sent to the client, missing join conditions, and heavy use of temporary tables or sorts.
Analyze how table I/O and file I/O behave for updates and deletes in MySQL, comparing primary key, secondary index, and no-index scenarios and their read-for-change effects.
Master explain and explain analyze basics to view and compare MySQL query plans, safely inspect plans before execution, and choose formats like traditional table format, JSON, or three style format.
Explain analyze reveals the default format of the query plan, highlighting a table scan, a name filter, and per-row cost estimates in MySQL units.
Demonstrates how using a secondary non-unique index on country code makes queries cheaper by performing an index lookup for French cities, highlighting index statistics and row estimates.
Explore a multicolumn primary key on country code and language, and learn how filtering by country code enables index use, noting only the left part of the index is usable.
Explore a two-table query using a subquery to select the ten smallest countries by area, then identify their largest cities by population with a derived table.
Spotting jumps in runtime teaches you to compare explain analyze estimates with actual costs, ensure up-to-date statistics, and fix poor plans by adding appropriate indexes, including expression-based ones.
Learn to use explain analyze to profile queries, see where time is spent, and read execution plans to understand node types, enabling confident production query management.
Examine how index innertube storage engine uses a primary key in index organized tables and why the smallest, monotonically increasing key minimizes random and sequential IO and buffer pool reads.
Explore how clustered indexes organize data by clustering index values, with leaf pages holding four rows and primary keys guiding the cluster, while performance problems arise when changing storage engines.
Insert rows in primary key order using a surrogate key with auto increment to ensure sequential inserts, boosting clustering efficiency and reducing fragmentation and random io overhead.
Learn when to use primary and secondary indexes in MySQL high performance tuning, and how statistics guide their selection to avoid table scans, support filtering, sorting, and fast lookups.
Explore how index statistics guide the optimizer to choose between index access and table scans, considering secondary index lookups and primary key lookups, and random versus sequential I/O considerations.
Increase the number of sampled index pages to improve accuracy of statistics, balancing performance, with persistent statistics preferred for consistency; tune per table for irregular distributions and larger tables.
Assess which index types perform best and avoid common pitfalls with multi-column indexes, using benchmarks to show why a single composite index often beats multiple single-column indexes.
Explore how composite indexes affect performance by comparing a composite index on name and state_id with separate indexes, using a million-row table and explain analyze results.
Explore when redundant indexes help or hinder MySQL performance, benchmarking single vs multi-column indexes on state_id and other columns, and weighing maintenance costs against faster queries.
Identify and drop redundant composite indexes using the information_schema view, because InnoDB includes the primary key in secondary indexes, and extending an index can degrade performance.
Explore how the buffer pool caches data and indexes, grows the working dataset in memory, monitors the hit rate, and increases the global buffer pool size to improve query performance.
Split buffer pool into multiple instances to reduce mutex contention for parallel queries; defaults range from one to eight instances (up to 64), with single-threaded workloads using a single instance.
Preload frequently used pages into the buffer pool at shutdown to warm the cache and reduce slow post-restart queries. However, this increases shutdown time as pages are dumped and loaded.
Balance flushing dirty pages from the buffer pool to the tablespace with the adaptive flash algorithm, considering redo logs, crash recovery, and io capacity max.
Tune the redo log buffer to boost MySQL performance by buffering changes in memory before commit, with a default 16 MB and dynamic resizing for large or many transactions.
Increase redo log file size by configuring innodb_log_file_size and innodb_log_files_in_group in the my.cnf to reduce checkpoints and speed recovery.
Configure the maximum number of threads for parallel execution across all connections and monitor their usage via the performance schema; increase parallel threads when CPU is spare.
Adjust MySQL query buffers, including join and sort buffers, treating configured values as minimums that may expand as needed. Start with small memory and defaults, increasing only for proven gains.
Explore how transactions ensure data integrity while balancing performance by treating a group of queries as a single unit, acquiring locks, and consuming logs and undo logs.
Learn how transactions manage locks to preserve data integrity and performance, and how isolation levels—from dirty reads to repeatable read—shape visibility, with undo logs and memory considerations.
Discover how undo logs store every transaction change, including for read views and consistent snapshots, and how history list length and long transactions affect performance.
Keep transactions small to reduce locking, use indexes and appropriate isolation levels, and split work into smaller batches with preparation outside the main transaction and timely commits or rollbacks.
Explore how transaction isolation levels affect locking and logs, noting that read committed reduces logs compared to repeatable read or serializable.
Explore how locks impact large transactions, learn to minimize lock effects with indexing and smaller transactions, reduce log usage, and review lock monitoring options and Nowata reporting tables.
Explore what scaling means for MySQL as traffic grows, and identify axes to scale safely. Learn read scaling, predictable write strategies, and sharding to meet seasonal patterns and requirements.
Learn to balance read and write loads by splitting tables into functional clusters, using replicas to scale reads, and choosing vertical or data split strategies to avoid scaling both together.
Scale reads with read replicas behind a front-end proxy, using a virtual ip; health checks remove unhealthy replicas and load-balancing distributes queries across the pool.
Use service discovery to automatically identify healthy read replicas for the load balancer, ensuring up processes, responsive ports, replication lag under 30 seconds, and read latency under 100 ms.
Partition data horizontally in MySQL using a partition key such as user id, and map it to shards. Apply list, range, or hash partitioning while preserving foreign key relationships.
Explore strategies for sharding with multiple partition keys, using cross-boundary storage to support user- and article-centric queries without full data duplication.
Most sharded apps require cross-shard queries to aggregate data, which are slow; keep most queries within a single shard and perform cross-shard aggregation in the application while maintaining referential integrity.
MySQL Performance Tuning Online Course Curriculum:
MySQL Architecture
View the steps involved in Query Execution
How the Cient/Server Protocol affects MySQL
Understand how the Query Optimizer does its job
How the Storage Engine Layer makes MySQL unique
Finding Candidates for Query Optimizations
Making use of The Performance Schema, which is a gold mine for spotting querying for optimization because it allows us to measure where the time goes
Finding the few queries that are responsible for most of the load on the system. Checking to the top 1000 queries it’s usually not worth your time to optimize.
How to find the relevant information out of the plethora of performance views and metrics available in MySQL
Understand why UPDATE and DELETE statements are also reads even though they are primarily write statements. This will have an impact on I/O, and therefore to the response time.
Analyzing the Queries
Understand why MySQL creates a query plan, before each query request
How to read query plans, and understand how each of the underlying node types works on MySQL
A series of examples, to show how the EXPLAIN output can be used, to identify where MySQL spends time on your query, and why
Which are the important pieces of information, to look for in order to spot performance issues
The Clustered Index and Choosing the Primary Key
When we work with index-organized tables, as the ones in MySQL, the choice of the primary index, is very important.
We'll see how the primary key, can impact the amount of random, or sequential I/O, the size of secondary indexes, and how many pages need to be read into the buffer pool.
We're going to understand, why an optimal primary key, with respect to the clustered index, is as small (in bytes) as possible, keeps increasing monotonically, and groups the rows we query frequently, and within a short distance of each other.
Indexing for performance
Which are the main function of an index?
We'll see exactly which tables are in need for an index, and which tables are better without one.
We'll check how MySQL relies on statistics to choose the best index, and how we can help it to make better decisions.
Composite Indexes
Common mistakes of composite indexes
How to decide the order of columns for multicolumn indexes
Be able to reason through how indexes work, and to choose them based on that understanding, not on rules of thumb
Which are the use-cases, that make Redundant Indexes useful, and when to avoid them.
Work on some benchmarks, to check the actual performance in numbers.
MySQL Server Configurations
Check how we should approach MySQL configuration changes by considering some best practices, so that we can successfully tune MySQL.
Which are the three options that MySQL is most likely to benefit, from non-default values, and also how to set them.
Go through an overview of the data lifecycle in InnoDB, so that we have background knowledge when making configuration changes.
Adjust parameters that are important for certain use-cases, for example, buffer pool instances for high concurrent workloads, and how to make use of parallel execution for certain queries.
MySQL Transactions and Locks
Transactions are very important to ensure data integrity but when used wrong they can cause severe performance issues.
Get an overview of why locks are needed and some ways to reduce their impact.
How indexes, splitting the transaction and the isolation levels can help to reduce the number of locks
Monitoring options and what reporting tables to check to spot lock problems.
Introduction to Scaling MySQL
What it means to scale MySQL and, we'll walk through the different axes where we may need to scale.
Understand how to scale different kinds of loads
Replication and why we need to make use of Read-Pools, Health Checks, and Service Discovery
Which are the main concerns and pitfalls when deciding to Shard the database
How to partition data in MySQL
Which are the use-cases and advantages for using a Queue
Fundamental Concepts for Scaling Writes with Sharding