Skip to content

Performance

wp-slow-query-investigation

Investigate slow WordPress queries

Finds costly WordPress database queries, traces them to their code, reads execution plans and tests the safest fix with before and after measurements.

Area
Performance
Checked against
WordPress 7.1.2, Query Monitor 4.0.7, WooCommerce 11.1.2, WP-CLI 2.12.0
Last verified
26 September 2026
Files
SKILL.md, 12 references, 5 scripts

How it works

  1. 1Record the site, database, cache, schema and query state with read-only checks.
  2. 2Rank expensive query shapes by total time across available traffic evidence.
  3. 3Tie each costly query to its request, caller and component.
  4. 4Match the query to its WordPress or WooCommerce pattern and likely fixes.
  5. 5Read its execution plan and measure selected queries on staging.
  6. 6Choose the cheapest safe fix, testing an index only when the evidence supports one.
  7. 7Make one approved change, repeat the measurements and report the result.

Use it when

  • Investigate pages, admin screens, Ajax or REST requests spending time in the database.
  • Trace statements found in slow logs or Query Monitor.
  • Diagnose high database load from repeated or expensive queries.
  • Evaluate an index before adding it to a WordPress table.

How it stays safe

  • Starts read-only and asks for owner approval before each change.
  • Measures executing query plans only on staging or a replica.
  • Tests every proposed index on a copy before production.
  • Keeps query logs private and shares only masked digests.

Install it

Copy the whole wp-slow-query-investigation folder into your agent's skills folder, not only SKILL.md.

git clone --depth 1 https://github.com/hamzaahmadaslam/agent-skills.git
cp -R agent-skills/wp-slow-query-investigation "<your agent's skills folder>/"

More skills in the collection

All 11 skills