Finding Slow Queries Print

  • databasesphpmyadmin, databases, performance, plugins, troubleshooting, database, guide, howto
  • 0

Identifying what is actually slow.

DURING A PAGE LOAD

A query monitoring plugin lists every query the page ran, with its duration and the component that triggered it.

That is the fastest route to the culprit, because it also names the plugin responsible.

THE SLOW QUERY LOG

Records queries exceeding a threshold, over time. Useful for catching things that only occur under specific conditions.

Ask us if you need it enabled.

WHAT TO LOOK FOR

Queries taking more than a fraction of a second The same query repeated many times on one page Queries scanning large numbers of rows

READING A SLOW QUERY

Note which table it touches and which columns appear in WHERE and ORDER BY.

Those columns are where an index usually helps.

EXPLAIN

Prefixing a query with EXPLAIN shows how the database intends to run it.

The key detail is whether it uses an index or scans the whole table. A full scan on a large table is the problem.

WHAT TO DO NEXT

Add an index, or address why the query exists at all if a plugin is running it unnecessarily.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot