Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Mysql Tuning?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-mysql-tuning-anvil)
---
name: mysql-tuning
description: Tune MySQL/InnoDB performance through composite index design, EXPLAIN plans, lock reduction, and safe online DDL
---
<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->
# MySQL tuning
Use when optimizing slow MySQL queries, reducing InnoDB lock contention, or altering large production tables.
## Indexes and query plans
- Order composite index columns for equality predicates first, range columns next, and sort/covering columns last (`leftmost prefix` rule).
- Never wrap indexed columns in functions (`WHERE DATE(created_at) = ...`); rewrite filters as sargable range bounds (`>=` and `<`).
- Inspect `EXPLAIN FORMAT=TREE` / `EXPLAIN ANALYZE` to check `type` (`const`/`ref`/`range` vs full `ALL`) and estimated vs actual rows.
## Locks and schema changes
- Keep InnoDB transactions small and ordered consistently to minimize gap-lock and deadlock rates (`SHOW ENGINE INNODB STATUS`).
- Use `ALGORITHM=INPLACE, LOCK=NONE` (or online tools like `gh-ost` / `pt-online-schema-change` on huge tables) to avoid metadata/write stalls.
- Configure `innodb_buffer_pool_size` appropriately and set `sql_mode` strictly (`STRICT_TRANS_TABLES`).
## Verify
Run `EXPLAIN ANALYZE` on representative data volumes and confirm p95 query latency and lock-wait metrics drop under load.