Knowledgebase

Reducing the Number of Queries Per Page Print

  • databasesphpmyadmin, databases, plugins, caching, database, themes, performance, troubleshooting
  • 0

Fewer requests to the database.

WHY IT MATTERS

Each query has overhead. A page running four hundred queries is slow even if each is fast individually.

FINDING THE COUNT

A query monitoring plugin reports the total per page and which components generate them.

WHAT IS REASONABLE

A simple page running a few dozen queries is normal.

Several hundred indicates something is wrong.

THE COMMON CAUSES

A plugin running a query inside a loop, once per item A poorly built theme fetching data repeatedly Too many plugins, each adding its own queries A widget or block that queries on every page

THE FIXES

Caching, which eliminates the queries entirely for cached pages Object caching, where available, which reuses query results Removing plugins that contribute disproportionately Replacing a badly built component

THE PRACTICAL PRIORITY

Enable page caching first. It resolves the symptom for most visitors regardless of the underlying count.

Then address the worst contributor, which the monitoring plugin names.


Was this answer helpful?
Back

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


Trustpilot