How to Benchmark MySQL Performance

Database benchmarks are helpful frameworks that allow users to compare their databases against a set standard. Using a set standard allows for a better understanding of the performance which can be expected from a specific system.

How to Benchmark MySQL Performance

image_pdfimage_print

MySQL benchmarking has evolved significantly since 2022, with new tools and methodologies emerging to address the challenges of modern database environments. This updated guide incorporates the latest benchmarking approaches, tools, and MySQL optimizations available in 2025.

New and Improved Benchmarking Tools for 2025

The MySQL benchmarking landscape has expanded with several powerful new options since the original publication of this guide.

Sysbench Advancements

Sysbench remains a cornerstone tool but has received significant improvements in recent versions. The latest versions offer enhanced capabilities including:

  • Improved latency histograms for more detailed performance insights
  • Better error handling in LUA scripts to catch and manage issues during testing
  • Enhanced support for various data distribution patterns to simulate different real-world scenarios

Finch: A Modern Benchmarking Alternative

Released in 2023, Finch has emerged as a powerful alternative to traditional benchmarking tools with several advantages:

  • Built-in CSV statistics export, making data analysis and visualization much simpler
  • Multi-node benchmarking capabilities for simulating distributed application workloads
  • Client/server (leader/follower) architecture that forms a benchmarking bot network
  • Simplified configuration with automatic distribution of benchmarking details from server to clients

Percona Toolkit 3.7.0 (2024)

The December 2024 release of Percona Toolkit 3.7.0 brings important improvements:

  • Full support for MySQL 8.4, allowing benchmarking of the latest MySQL features
  • Enhanced pt-secure-collect tool with improved encryption capabilities
  • Updated pt-mysql-summary for better performance diagnostics

MySQL Shell Performance Tooling

MySQL Shell has evolved into a powerful performance analysis platform:

  • Network and query performance optimization capabilities built directly into the shell
  • Ability to monitor active queries and check for network latency in real-time
  • Support for creating reusable shell scripts that simplify frequent performance testing

Cloud-Native Benchmarking Approaches

As more MySQL deployments move to cloud environments, benchmarking techniques must adapt accordingly.

Amazon RDS Performance Insights

Performance Insights has become an essential tool for RDS MySQL instances:

  • Visual database load assessment that helps quickly identify performance issues
  • Ability to track which SQL statements are causing database load
  • On-demand analysis now available in all commercial regions as of December 2024
  • Up to two years of performance history retention (beyond the free 7-day retention)

Azure Query Performance Insight

For those using Azure Database for MySQL:

  • “Intelligent” query analysis for both single and pooled databases
  • Identification of resource-intensive and long-running queries
  • Database advisors that provide customized recommendations based on workload patterns

Monitoring I/O Performance in the Cloud

Cloud-based monitoring tools have become essential for complete performance visibility:

  • CloudWatch metrics for RDS track critical disk I/O metrics including ReadIOPS, WriteIOPS, and DiskQueueDepth
  • Datadog integration provides comprehensive MySQL monitoring by connecting to the database at regular intervals
  • SolarWinds Database Observability offers detailed performance metrics starting at $117/database/month

TPC Benchmarks for Different Workload Types

Understanding which benchmark matches your workload is crucial:

  • TPC-C targets OLTP workloads, simulating real-time transactional systems with metrics measured in transactions per minute (tpmC)
  • TPC-H focuses on OLAP workloads, modeling complex business decision-support queries with metrics in queries per hour (QphH)
  • Choosing the right benchmark ensures realistic performance assessment for your specific use case

Advanced Query Profiling Techniques

The latest MySQL versions offer sophisticated tools for in-depth query analysis.

EXPLAIN ANALYZE

MySQL 8.0.18+ introduced EXPLAIN ANALYZE, a powerful profiling tool:

  • Shows where MySQL spends time on your query and why
  • Instruments and executes queries while counting rows and measuring execution time
  • In MySQL 9.0, adds support for saving output to user variables for automated analysis

Histograms and Indexing Improvements

MySQL 8.4 represents a major advancement in query optimization:

  • Automated histogram updates eliminate the need for manual maintenance of statistics
  • Adaptive histograms adjust dynamically to query patterns, improving execution speed
  • Machine learning used to intelligently automate operations, increasing DBA productivity

HeatWave Accelerator for OLAP Workloads

For analytical workloads, HeatWave offers game-changing performance:

  • Integrated in-memory query accelerator for MySQL Database Service
  • Up to 1100X faster than Amazon Aurora according to Oracle benchmarks
  • Allows running both OLTP and OLAP workloads directly from MySQL database

AI-Powered Analysis

The integration of artificial intelligence into database monitoring has transformed benchmarking.

Dynatrace’s AI-Driven Analytics

Dynatrace now offers sophisticated AI capabilities for MySQL monitoring:

  • Top Queries view identifies resource-intensive queries
  • Query execution plans provide insights into database engine execution
  • AI-driven diagnostics to pinpoint slow queries and performance bottlenecks
  • Automated end-to-end tracing with detailed insights into SQL statements

Performance Pattern Recognition

Modern monitoring tools employ machine learning to identify patterns:

  • Baseline performance creation through automatic comparison of current metrics with historical data
  • Anomaly detection to identify unusual database behavior before it becomes problematic

Performance Improvements in Recent MySQL Versions

MySQL performance continues to improve with each release:

MySQL 8.4 Enhancements

MySQL 8.4.5 (released April 15, 2025) includes numerous performance improvements:

  • Optimizations for systems with more than 128 processors, providing better CPU usage statistics
  • Fixed issue with ALTER TABLE operations on empty tables, now using INPLACE algorithm by default
  • Improvements to tablespace file scan performance at startup

MySQL 9.0 and Beyond

MySQL 9.x introduces significant performance optimizations:

  • Enhanced optimizer with support for more comparison operations in subquery transformations
  • Improved hash joins with reduced processing time
  • JavaScript stored procedures via Multilingual Engine Component for Enterprise Edition users
  • New VECTOR data type for machine learning and AI applications

JOIN Performance Optimization

Recent MySQL versions have significantly improved JOIN performance:

  • Strategic indexing on JOIN columns reduces computational cost and maximizes query speed
  • Improved query execution with JOINs showing 2.17% average improvement in recent benchmarks
  • Better optimization of LEFT JOIN operations with filtering conditions

Step-by-Step MySQL Benchmarking for 2025

Now that we’ve covered the latest tools and techniques, let’s walk through an updated benchmarking process.

Step 1: Install and Configure Sysbench

Installation procedures remain similar to previous versions but with updated repositories:

bash

# For Debian/Ubuntu:

curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | sudo bash

sudo apt -y install sysbench

# For RHEL/CentOS:

curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash

sudo yum -y install sysbench

Step 2: Clone the Percona TPCC Repository

For OLTP workload simulation:

bash

git clone https://github.com/Percona-Lab/sysbench-tpcc.git /usr/share/sysbench/percona

cp /usr/share/sysbench/percona/* /usr/share/sysbench/

Step 3: Prepare the Database for Benchmarking

Create a database and prepare it for testing:

bashsysbench /usr/share/sysbench/tpcc.lua –threads=48 –tables=10 –scale=100 –db-driver=mysql –mysql-db=sbtest –mysql-user=DBtest –mysql-password=’password’ prepare

Step 4: Run the Benchmark

Execute the benchmark with appropriate parameters:

bash

sysbench /usr/share/sysbench/tpcc.lua –threads=512 –time=300 –tables=10 –scale=100 –db-driver=mysql –mysql-db=sbtest –mysql-user=DBtest –mysql-password=’password’ run

Step 5: Analyze Results

The benchmark will produce output with key metrics:

  • Transactions per second
  • Query latency statistics
  • Thread fairness metrics1

Step 6: Clean Up

After completing the benchmark:

bash

sysbench /usr/share/sysbench/tpcc.lua –threads=48 –tables=10 –scale=100 –db-driver=mysql –mysql-db=sbtest –mysql-user=DBtest –mysql-password=’password’ cleanup

Advanced Analysis with EXPLAIN ANALYZE

For deeper query optimization, use EXPLAIN ANALYZE to examine execution plans:

sql

EXPLAIN ANALYZE SELECT * FROM orders JOIN customers ON orders.customer_id = customers.customer_id WHERE orders.order_date > ‘2025-01-01’;

The output will show a detailed execution plan with actual timing information for each step, helping identify bottlenecks.

Conclusion

MySQL benchmarking has become more sophisticated in 2025, with tools that provide deeper insights and automation to handle increasingly complex database environments. Whether you’re running MySQL in the cloud or on-premises, these updated benchmarking techniques will help you identify performance bottlenecks and optimize your database for maximum efficiency.

By leveraging the latest benchmarking tools like Finch and Sysbench, along with cloud-native monitoring solutions and advanced query analysis features, you can ensure your MySQL deployments meet the demanding performance requirements of modern applications.