You are previewing MySQL Troubleshooting.
O'Reilly logo
MySQL Troubleshooting

Book Description

Sometimes applications can go mad: tables contain wrong data, users get random replies, server stop working, and so on. Several easy methods allow users to often find the problems quickly. This book, based on successful conference presentations by the author, cover SQL problems, memory and other server problems, replication, and problems related to particular storage engines.

Table of Contents

  1. MySQL Troubleshooting
  2. SPECIAL OFFER: Upgrade this ebook with O’Reilly
  3. Foreword
  4. Preface
    1. Audience
    2. How to Solve a Problem
    3. How This Book Is Organized
    4. Some Choices Made in This Book
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
  5. 1. Basics
    1. Incorrect Syntax
    2. Wrong Results from a SELECT
    3. When the Problem May Have Been a Previous Update
    4. Getting Information About a Query
    5. Tracing Back Errors in Data
    6. Slow Queries
      1. Tuning a Query with Information from EXPLAIN
      2. Table Tuning and Indexes
      3. When to Stop Optimizing
      4. Effects of Options
      5. Queries That Modify Data
      6. No Silver Bullet
    7. When the Server Does Not Answer
    8. Issues with Solutions Specific to Storage Engines
      1. MyISAM Corruption
        1. Repairing a MyISAM table from SQL
        2. Repairing a MyISAM table using myisamchk
      2. InnoDB Corruption
    9. Permission Issues
  6. 2. You Are Not Alone: Concurrency Issues
    1. Locks and Transactions
    2. Locks
      1. Table Locks
      2. Row Locks
    3. Transactions
      1. Hidden Queries
      2. Deadlocks
      3. Implicit Commits
    4. Metadata Locking
      1. Metadata Locking Versus the Old Model
    5. How Concurrency Affects Performance
      1. Monitoring InnoDB Transactions for Concurrency Problems
      2. Monitoring Other Resources for Concurrency Problems
    6. Other Locking Issues
    7. Replication and Concurrency
      1. Statement-Based Replication Issues
      2. Mixing Transactional and Nontransactional Tables
      3. Issues on the Slave
    8. Effectively Using MySQL Troubleshooting Tools
      1. SHOW PROCESSLIST and the INFORMATION_SCHEMA.PROCESSLIST Table
      2. SHOW ENGINE INNODB STATUS and InnoDB Monitors
      3. INFORMATION_SCHEMA Tables
      4. PERFORMANCE_SCHEMA Tables
      5. Log Files
  7. 3. Effects of Server Options
    1. Service Options
    2. Variables That Are Supposed to Change the Server Behavior
    3. Options That Limit Hardware Resources
    4. Using the --no-defaults Option
    5. Performance Options
    6. Haste Makes Waste
    7. The SET Statement
    8. How to Check Whether Changes Had an Effect
    9. Descriptions of Variables
      1. Options That Affect Server and Client Behavior
        1. Server-related options
        2. Replication options
        3. Engine options
          1. InnoDB options
          2. MyISAM options
        4. Connection-related options
          1. Timeouts
          2. Security-related options
      2. Performance-Related Options
        1. Buffers and maximums
        2. Options that control the optimizer
        3. Engine-related options
          1. InnoDB options
          2. MyISAM options
      3. Calculating Safe Values for Options
        1. Options set for the whole server
        2. Thread options
        3. Buffers allocated for a specific operation
  8. 4. MySQL’s Environment
    1. Physical Hardware Limits
      1. RAM
      2. Processors and Their Cores
      3. Disk I/O
      4. Network Bandwidth
      5. Example of the Effect of Latencies
    2. Operating System Limits
    3. Effects of Other Software
  9. 5. Troubleshooting Replication
    1. Displaying Slave Status
    2. Problems with the I/O Thread
    3. Problems with the SQL Thread
      1. When Data Is Different on the Master and Slave
      2. Circular Replication and Nonreplication Writes on the Slave
      3. Incomplete or Altered SQL Statements
      4. Different Errors on the Master and Slave
      5. Configuration
      6. When the Slave Lags Far Behind the Master
  10. 6. Troubleshooting Techniques and Tools
    1. The Query
      1. Slow Query Log
      2. Tools That Can Be Customized
      3. The MySQL Command-Line Interface
    2. Effects of the Environment
    3. Sandboxes
    4. Errors and Logs
      1. Error Information, Again
      2. Crashes
        1. Core file
        2. General log file
    5. Information-Gathering Tools
      1. Information Schema
      2. InnoDB Information Schema Tables
      3. InnoDB Monitors
      4. Performance Schema
      5. SHOW [GLOBAL] STATUS
    6. Localizing the Problem (Minimizing the Test Case)
    7. General Steps to Take in Troubleshooting
    8. Testing Methods
      1. Try the Query in a Newer Version
      2. Check for Known Bugs
      3. Workarounds
    9. Special Testing Tools
      1. Benchmarking Tools
        1. mysqlslap
        2. SysBench
      2. Gypsy
      3. MySQL Test Framework
    10. Maintenance Tools
  11. 7. Best Practices
    1. Backups
      1. Planning Backups
      2. Types of Backups
      3. Tools
    2. Gathering the Information You Need
      1. What Does It All Mean?
    3. Testing
    4. Prevention
      1. Privileges
      2. Environment
    5. Think About It!
  12. A. Information Resources
    1. Resources Containing Information That Is Usually Useful
    2. Bug and Knowledge Databases
    3. Expert Knowledge Online
    4. Places Where You Can Ask for Help
    5. Books
  13. Index
  14. About the Author
  15. Colophon
  16. SPECIAL OFFER: Upgrade this ebook with O’Reilly