You are previewing Expert MySQL, Second Edition.
O'Reilly logo
Expert MySQL, Second Edition

Book Description

Expert MySQL is the leading reference for learning, understanding, and extending the MySQL server. It unlocks the full promise of open source by showing how to modify the code, create your own storage engine, build your own authentication plugins, and even add your own functions and commands to the SQL language. No other book provides the level of detail or the extensive examples of the inner workings of MySQL that have taken engineers years to master. Expert MySQL is a must have book for all systems integrators, engineers, and software developers working with the MySQL server code.

Expert MySQL is also a wealth of information on key aspects of MySQL internals. You'll learn about internal query representation, how the optimizer creates execution plans, and how to exert control over those plans for optimal performance in your environment. You'll even learn to build your own query optimizer, giving insight that can help you understand and resolve tough performance problems. High-availability and replication are also covered, making Expert MySQL a must-have book for anyone doing high-end work involving MySQL.

  • Shows how to customize MySQL and its storage and authentication engines

  • Provides in-depth knowledge of internals for use in query tuning and performance troubleshooting

  • Covers high-end features such as high-availability and replication

What you'll learn

  • Learn the inner workings of MySQL

  • Diagnose and improve poorly performing queries

  • Implement high-availablity solutions and replication

  • Modify and debug the server code

  • Build your own pluggable storage engines and authentication modules

  • Implement new SQL functions and syntax

  • Build your own query optimizer

Who this book is for

Expert MySQL is written for systems integrators, software developers, and database administrators who are using MySQL and desire a deeper knowledge of MySQL internals in support of high-end work such as performance troubleshooting, customization of the engine and its plugins, query optimizaion, building of high-availability environments, replication of data, and so forth.

Table of Contents

  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewers
  7. Acknowledgments
  8. Introduction
  9. Part 1: Getting Started with MySQL Development
    1. Chapter 1: MySQL and The Open Source Revolution
      1. What Is Open Source Software?
      2. Developing with MySQL
      3. A Real-World Example: TiVo
      4. Summary
    2. Chapter 2: The Anatomy of a Database System
      1. Types of Database Systems
      2. Relational Database System Architecture
      3. The MySQL Database System
      4. Summary
    3. Chapter 3: A Tour of the MySQL Source Code
      1. Getting Started
      2. The MySQL Source Code
      3. Coding Guidelines
      4. Building the System for the First Time
      5. Summary
    4. Chapter 4: Test-Driven MySQL Development
      1. Background
      2. MySQL Testing
      3. Summary
  10. Part 2: Extending MySQL
    1. Chapter 5: Debugging
      1. Debugging Explained
      2. Approaches to Debugging
      3. External Debuggers
      4. Debugging MySQL
      5. Debugging in Linux
      6. Debugging in Windows
      7. Summary
    2. Chapter 6: Embedded MySQL
      1. Building Embedded Applications
      2. What Is an Embedded System?
      3. Types of Embedded Systems
      4. Embedded Database Systems
      5. Embedding MySQL
      6. Methods of Embedding MySQL
      7. Resource Requirements
      8. Security Concerns
      9. Advantages of MySQL Embedding
      10. Limitations of MySQL Embedding
      11. The MySQL C API
      12. Getting Started
      13. Most Commonly Used Functions
      14. Creating an Embedded Server
      15. Initializing the Server
      16. Setting Options
      17. Connecting to the Server
      18. Running Queries
      19. Retrieving Results
      20. Cleanup
      21. Disconnecting from and Finalizing the Server
      22. Putting It All Together
      23. Error Handling
      24. Building Embedded MySQL Applications
      25. Compiling the Library (libmysqld)
      26. What About Debugging?
      27. What About the Data?
      28. Creating a Basic Embedded Server
      29. What About Error Handling?
      30. Embedded Server Application
      31. Managed vs. unmanaged code
      32. Summary
    3. Chapter 7: Adding Functions and Commands to MySQL
      1. Adding User-Defined Functions
      2. Adding Native Functions
      3. Compiling and Testing the New Native Function
      4. Adding SQL Commands
      5. Adding to the Information Schema
      6. Summary
    4. Chapter 8: Extending MySQL High Availability
      1. What is Replication?
      2. Basic Replication Setup
      3. The Binary Log
      4. Replication Architecture
      5. A Brief Tour of the Replication Source Code
      6. Extending Replication
      7. Summary
    5. Chapter 9: Developing MySQL Plugins
      1. MySQL Plugins Explained
      2. The RFID Authentication Plugin
      3. Summary
    6. Chapter 10: Building Your Own Storage Engine
      1. MySQL Storage Engine Overview
      2. Storage Engine Development Process
      3. Source Files Needed
      4. Unexpected Help
      5. The Handlerton
      6. The Handler Class
      7. A Brief Tour of a MySQL Storage Engine
      8. The Spartan Storage Engine
      9. Getting Started
      10. Stage 1: Stubbing the Engine
      11. Testing Stage 1 of the Spartan Engine
      12. Stage 2: Working with Tables
      13. Testing Stage 2 of the Spartan Engine
      14. Stage 3: Reading and Writing Data
      15. Testing Stage 3 of the Spartan Engine
      16. Stage 4: Updating and Deleting Data
      17. Testing Stage 4 of the Spartan Engine
      18. Stage 5: Indexing the Data
      19. Testing Stage 5 of the Spartan Engine
      20. Stage 6: Adding Transaction Support
      21. Summary
  11. Part 3: Advanced Database Internals
    1. Chapter 11: Database System Internals
      1. Query Execution
      2. Exploring MySQL Internals
      3. The Database System Internals Experiment
      4. Summary
    2. Chapter 12: Internal Query Representation
      1. The Query Tree
      2. Implementing DBXP Query Trees in MySQL
      3. Summary
    3. Chapter 13: Query Optimization
      1. Types of Query Optimizers
      2. Cost-Based Optimizers
      3. Heuristic Optimization Revisited
      4. The DBXP Query Optimizer
      5. Stubbing the DBXP_SELECT Command
      6. Important MySQL Structures and Classes
      7. Compiling and Testing the Code
      8. Summary
    4. Chapter 14: Query Execution
      1. Query Execution Revisited
      2. DBXP Query Execution
      3. Summary
  12. Appendix
    1. Bibliography
    2. Sample Database
    3. Chapter Exercise Notes
  13. Index