Black Friday: 25% off Yearly and Lifetime with code BLACKFRIDAY25. Until Mon 1 Dec, 23:59 UTC. See pricing
Database Performance

WordPress MySQL Indexes Missing? Prove It Before You Add One

A missing index usually hides inside one slow query. WordPress does not show a database-wide warning. Slow Query Analyzer catches that query in wp-admin, runs EXPLAIN, and offers a checked index only when the plan supports one.

Read our reviews on Trustpilot ↗

What a Missing Index Looks Like in WordPress

There is no dashboard warning that says an index is missing. You see a Posts screen that thinks for seconds, a WooCommerce filter that spins, or a plugin settings page that hits the database hard every time it opens.

Inside MySQL the sign is usually simple: EXPLAIN reports a full scan, no usable key, or thousands of rows examined to return a handful. WordPress itself does not ship unindexed core tables. The problem is the gap between the indexes that exist and the query a plugin actually runs.

The expensive pattern

A query looks selective in the code, but MySQL cannot prove it with an index. So it reads row after row, throws almost all of them away, and does the same work again on the next admin page load.

That is why I would not add an index because a blog post says a table needs one. First catch the query that is slow, then look at its plan.

Where Missing Indexes Hide

Most WordPress queries are fine because core already indexes its normal access patterns. The ugly ones usually come from plugins that query data in a way the original schema did not expect.

Place What usually happens
Post metadata lookups A plugin filters by one meta key and then by post or value. The single-column indexes help only part of the predicate, so a busy meta table turns into a scan.
Custom plugin tables A table grows quietly for months. The first indexes were chosen when it was empty, and nobody revisits them when real queries appear.
Queue and log tables Status, date and group columns get queried together. One column is indexed, the combination is not, and the database still reads far more history than the screen needs.
Search and filter screens A LIKE filter or a sort order cannot use the index the owner expected. The query is valid SQL; it is just expensive at the table's real size.

The table name alone does not prove anything. wp_postmeta can be fine on one site and miserable on another. The query, its cardinality and the existing keys decide.

Catch the Real Query Before Touching the Schema

Slow Query Analyzer is the WP Multitool module for this job. It is a Pro module and it ships off by default, so query capture starts only when you turn the module on.

Once enabled, it watches wp-admin requests for users who can manage the site. Queries slower than the 100 ms default threshold are stored with the caller, the component that ran them, the best and worst duration, and a normalized fingerprint so repeats collapse into one row.

  • New captures are explained automatically. SELECT, UPDATE and DELETE statements get EXPLAIN analysis during shutdown of the same request that captured them.
  • Repeat offenders stay visible. The log keeps counts and duration ranges instead of drowning you in identical copies of the same query.
  • The log is bounded. It keeps the latest 5,000 rows rather than becoming another database problem of its own.
  • The source is named. Core, theme, mu-plugin or the plugin directory is attached where the caller reveals it.

The caller shows which code ran the query, so you can judge the missing-index hint against the schema, the query, and the plugin doing the work.

A Checked CREATE INDEX, Rebuilt Server-Side

When EXPLAIN says an index may help, the module builds a suggestion locally. It does not paste whatever the browser sends back into MySQL. The proposed statement is treated as a request, then rebuilt server-side.

  • Validate the shape. Only a plain CREATE INDEX on one table with plain key parts is accepted.
  • Validate the schema. The table and columns are checked against information_schema before anything runs.
  • Respect column types. TEXT and BLOB columns get a safe prefix length; JSON and spatial columns are refused when a plain B-tree index cannot cover them.
  • Check existing keys. A duplicate or already-covered index is reported as already applied instead of creating noise.
  • Track the change. Indexes created by WP Multitool are listed separately and can be reverted from the same screen.

Nothing is applied automatically. You click Apply Index, MySQL runs the rebuilt statement, and the result is reported. If the index was created by WP Multitool, a Revert action can drop it again.

The cost is real

An index costs disk and makes writes more expensive. On a large table, CREATE INDEX can also take time or lock work depending on the engine and MySQL version. Test on staging or pick a quiet window.

Slow Query Analyzer is a Pro module - $79/year for one site, and every paid plan includes all 19 modules. Turn it on when the database stops being a guessing game.

Get Pro - from $79/year

When an Index Is the Wrong Fix

A slow query is not automatically an indexing problem. Sometimes the query asks for the wrong data, reads the same rows inside a loop, sorts a result it could have limited, or filters with a function that defeats every sensible key.

The analyzer is deliberately conservative here. It can point out full scans, filesorts, temporary tables and missing key use, but it withholds index suggestions for query shapes it cannot prove. A missed suggestion costs nothing. A wrong index can sit there forever and tax every write.

That is the outcome I want: fewer superstitions, more evidence. If the fix is an index, apply a checked one. If the fix is a query rewrite, you know which plugin and which query to take upstream.

What Slow Query Analyzer Will Not Do

  • It does not scan the whole schema looking for missing indexes. It analyzes queries that were actually captured because they crossed the threshold.
  • It never captures frontend queries. The capture gate is admin context plus a user with manage_options, because query text can contain sensitive literals.
  • It cannot explain every statement. EXPLAIN analysis is attempted for SELECT, UPDATE and DELETE captures; other statement types are logged without an execution plan.
  • It does not apply indexes automatically. Every CREATE INDEX is an explicit click, and the module rebuilds the statement before running it.
  • It cannot revert someone else's index. Revert is limited to indexes WP Multitool created and tracked itself.
  • It is not a backup tool. Adding or dropping an index changes no table rows, but it is still a schema change. Use your normal backup and staging discipline.

Missing Database Indexes FAQ

Does WordPress warn me when a MySQL index is missing?

No. MySQL simply chooses the best plan it can with the indexes that exist. The symptom is usually a slow screen or a query that examines far more rows than it returns. EXPLAIN is how you see it.

Are the indexes on wp_postmeta missing by default?

No. Core ships indexes for its normal access patterns. Trouble starts when a plugin queries metadata in a different combination, often meta key plus post or value. That is a query-to-index mismatch inside a normal WordPress install.

Will Slow Query Analyzer add indexes automatically?

No. It can suggest a checked CREATE INDEX statement, but applying it is an explicit click. The module validates the table, columns, key lengths and existing indexes before MySQL runs anything.

Can I revert an index after applying it?

Yes, when WP Multitool created and tracked that index. The Applied Indexes list has a revert action. It refuses to drop indexes it did not create.

Does EXPLAIN change the database?

No. EXPLAIN asks MySQL how it would execute the query. It is a read-only planning step; applying an index is the separate action that changes the schema.

Why not index every column?

Every extra index costs disk and makes INSERT, UPDATE and DELETE work harder. Too many indexes can also give the optimizer more bad choices. Index the proven query pattern, not the whole table.

Will it catch slow frontend queries?

No. Capture is intentionally admin-only. A slow frontend usually needs a different measurement path, while wp-admin and admin-ajax.php are inside the module's capture surface.

Prove the Index Before You Create It

Slow Query Analyzer is a Pro module - $79/year for one site, and every paid plan includes all 19 modules. Turn it on when the database stops being a guessing game.

Get Pro - from $79/year Slow Queries Guide All plans on the pricing page →