MySQL Optimization

Table of Contents

60. Optimization Overview
MySQL Design Limitations/Tradeoffs
Portability
What We Have Used MySQL For
The MySQL Benchmark Suite
Using Your Own Benchmarks
61. Optimizing SELECT Statements and Other Queries
EXPLAIN Syntax (Get Information About a SELECT)
Estimating Query Performance
Speed of SELECT Queries
How MySQL Optimizes WHERE Clauses
How MySQL Optimizes OR Clauses
How MySQL Optimizes IS NULL
How MySQL Optimizes DISTINCT
How MySQL Optimizes LEFT JOIN and RIGHT JOIN
How MySQL Optimizes ORDER BY
How MySQL Optimizes LIMIT
Speed of INSERT Queries
Speed of UPDATE Queries
Speed of DELETE Queries
Other Optimization Tips
62. Locking Issues
How MySQL Locks Tables
Table Locking Issues
63. Optimizing Database Structure
Design Choices
Get Your Data as Small as Possible
How MySQL Uses Indexes
Column Indexes
Multiple-Column Indexes
How MySQL Counts Open Tables
How MySQL Opens and Closes Tables
Drawbacks to Creating Large Numbers of Tables in the Same Database
64. Optimizing the MySQL Server
System/Compile Time and Startup Parameter Tuning
Tuning Server Parameters
How Compiling and Linking Affects the Speed of MySQL
How MySQL Uses Memory
How MySQL uses DNS
SET Syntax
65. Disk Issues
Using Symbolic Links
Using Symbolic Links for Databases on Unix
Using Symbolic Links for Tables on Unix
Using Symbolic Links for Databases on Windows

Optimization is a complicated task because it ultimately requires understanding of the whole system. While it may be possible to perform some local optimizations with small knowledge of your system or application, the more optimal you want your system to become the more you will have to know about it.

This chapter tries to explain and give some examples of different ways to optimize MySQL. Remember, however, that there are always some (increasingly harder) additional ways to make the system even faster.