Chapter 7. Optimization

Table of Contents

7.1. Optimization Overview
7.2. Optimizing SQL Statements
7.2.1. Optimizing SELECT Statements
7.2.2. Optimizing DML Statements
7.2.3. Optimizing Database Privileges
7.2.4. Optimizing INFORMATION_SCHEMA Queries
7.2.5. Other Optimization Tips
7.3. Optimization and Indexes
7.3.1. How MySQL Uses Indexes
7.3.2. Using Primary Keys
7.3.3. Using Foreign Keys
7.3.4. Column Indexes
7.3.5. Multiple-Column Indexes
7.3.6. Verifying Index Usage
7.3.7. Comparison of B-Tree and Hash Indexes
7.4. Optimizing Database Structure
7.4.1. Optimizing Data Size
7.4.2. Optimizing MySQL Data Types
7.4.3. Optimizing for Many Tables
7.5. Optimizing for InnoDB Tables
7.5.1. Optimizing Storage Layout for InnoDB Tables
7.5.2. Optimizing InnoDB Transaction Management
7.5.3. Optimizing InnoDB Logging
7.5.4. Bulk Data Loading for InnoDB Tables
7.5.5. Optimizing InnoDB Queries
7.5.6. Optimizing InnoDB DDL Operations
7.5.7. Optimizing InnoDB Disk I/O
7.5.8. Optimizing InnoDB Configuration Variables
7.5.9. Optimizing InnoDB for Systems with Many Tables
7.6. Optimizing for MyISAM Tables
7.6.1. Optimizing MyISAM Queries
7.6.2. MyISAM Index Statistics Collection
7.6.3. Bulk Data Loading for MyISAM Tables
7.6.4. Speed of REPAIR TABLE Statements
7.7. Optimizing for MEMORY Tables
7.8. Understanding the Query Execution Plan
7.8.1. Optimizing Queries with EXPLAIN
7.8.2. EXPLAIN Output Format
7.8.3. Estimating Query Performance
7.8.4. Controlling the Query Optimizer
7.9. Buffering and Caching
7.9.1. The InnoDB Buffer Pool
7.9.2. The MyISAM Key Cache
7.9.3. The MySQL Query Cache
7.10. Optimizing Locking Operations
7.10.1. Internal Locking Methods
7.10.2. Table Locking Issues
7.10.3. Concurrent Inserts
7.10.4. Metadata Locking Within Transactions
7.10.5. External Locking
7.11. Optimizing the MySQL Server
7.11.1. System Factors and Startup Parameter Tuning
7.11.2. Tuning Server Parameters
7.11.3. Optimizing Disk I/O
7.11.4. Optimizing Memory Use
7.11.5. Optimizing Network Use
7.12. Measuring Performance (Benchmarking)
7.12.1. Measuring the Speed of Expressions and Functions
7.12.2. The MySQL Benchmark Suite
7.12.3. Using Your Own Benchmarks
7.12.4. Measuring Performance with performance_schema
7.12.5. Examining Thread Information
7.13. Internal Details of MySQL Optimizations
7.13.1. Range Optimization
7.13.2. Index Merge Optimization
7.13.3. Engine Condition Pushdown Optimization
7.13.4. IS NULL Optimization
7.13.5. LEFT JOIN and RIGHT JOIN Optimization
7.13.6. Nested-Loop Join Algorithms
7.13.7. Nested Join Optimization
7.13.8. Outer Join Simplification
7.13.9. ORDER BY Optimization
7.13.10. GROUP BY Optimization
7.13.11. DISTINCT Optimization
7.13.12. Optimizing IN/=ANY Subqueries

This chapter explains how to optimize MySQL performance and provides examples. Optimization involves configuring, tuning, and measuring performance, at several levels. Depending on your job role (developer, DBA, or a combination of both), you might optimize at the level of individual SQL statements, entire applications, a single database server, or multiple networked database servers. Sometimes you can be proactive and plan in advance for performance, while other times you might troubleshoot a configuration or code issue after a problem occurs. Optimizing CPU and memory usage can also improve scalability, allowing the database to handle more load without slowing down.

Copyright © 2010-2023 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout