mysql-query-optimization

Diagnose slow queries and design indexes on Percona Server for MySQL.

1|1|Updated May 29, 2026
One-click install
npx skills add https://github.com/Percona-Lab/skills --skill mysql-query-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mysql-query-optimization
Source: https://github.com/Percona-Lab/skills/tree/main/mysql-query-optimization
Command: npx skills add https://github.com/Percona-Lab/skills --skill mysql-query-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Diagnosing slow queries and designing effective indexing strategies on Percona Server for MySQL to improve performance and resource utilization.

Core Features & Use Cases

  • Analyze slow query logs with EXPLAIN ANALYZE, extended slow log, and optimizer histograms to identify bottlenecks.
  • Evaluate index usage, discover missing or redundant indexes, and plan changes with measurable impact.
  • Leverage Percona-specific diagnostics (userstat, log_slow_verbosity) together with pt-query-digest and PMM Query Analytics to validate improvements.

Quick Start

Run a representative workload on Percona Server for MySQL and review the extended slow query log and per-table statistics to prioritize index changes.

Frequently Asked Questions about mysql-query-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose slow queries on Percona Server for MySQL?

Analyze slow query logs using EXPLAIN ANALYZE, extended slow log, and optimizer histograms on Percona Server for MySQL to identify performance bottlenecks. This process evaluates index usage to discover missing or redundant indexes and plan measurable improvements.

How do I evaluate index usage and find missing or redundant indexes?

Evaluate index usage by leveraging Percona-specific diagnostics like userstat per-table counters alongside pt-query-digest to discover missing or redundant indexes. Plan changes with measurable impact by validating improvements across real workloads.

Does this query optimization approach work with Percona Server 8.x and 8.4+?

Yes, this approach applies directly to workloads using Percona Server 8.x and 8.4+. It leverages specific features like invisible indexes and optimizer histograms to guide indexing decisions on these versions.

What is the best way to analyze slow query logs with pt-query-digest?

Analyze slow query logs by running pt-query-digest combined with PMM Query Analytics and extended slow log data. Validate indexing improvements by evaluating per-table counters and planning changes with measurable impact.

Can I test index changes safely using invisible indexes in MySQL?

Use invisible indexes in MySQL to safely evaluate index usage and validate improvements across real workloads before making permanent changes. This allows testing indexing decisions without affecting active query execution.

Why do I need per-table counters to optimize MySQL indexes?

Per-table counters, or userstat, are needed to identify bottlenecks and evaluate index usage accurately on Percona Server. They provide diagnostic data required to prioritize index changes based on real workload behavior.