100% Free · Open Source GPLv2 · Zero setup requiredGet the Plugin

Opens in a new tab
ITX UserOps

Back to Blog

Your Users screen takes forty seconds and the bulk action dies halfway

It was fine at five hundred accounts. It is unusable at fifty thousand, and nobody can point at the change that did it. Where the time actually goes, and why a job that times out is worse than one that refuses to start.

Operations

Nobody notices the day it breaks, because there isn't one.

At five hundred users the Users screen loads instantly. At five thousand it takes a moment. At fifty thousand somebody stops using it and works around it instead, and by then the change happened so gradually that no single deploy is to blame.

Then one day you select four hundred accounts, choose a bulk action, and the page hangs for ninety seconds before returning a 504. You reload. Some of them changed. You cannot tell which.

Where the time goes

Three separate problems that all look like "the admin is slow".

1. Filtering in the browser

The pattern is seductive: fetch every user once, then search and sort in JavaScript. It feels instant, because it is — after the fetch.

At five hundred accounts that fetch is a few hundred kilobytes. At fifty thousand it is tens of megabytes, parsed into tens of thousands of objects, held in memory, re-sorted on every keystroke. The phone in your pocket gives up long before the server does.

The fix is unglamorous: search, sort and pagination all run as SQL, indexed, returning one page. The screen stops caring how many users you have because it never sees more than fifty of them.

2. Per-user rows in wp_options

This one is quieter and worse, because it does not slow down the admin — it slows down the *whole site*.

wp_options has an autoload flag. Everything marked autoload is loaded on every single request, including every cached-miss front-end page view. A plugin that stores per-user state as something_user_1234 puts your user count into the critical path of your home page.

The tell is a site that got slower over eighteen months with no obvious cause, where the slowdown tracks registrations rather than traffic. If you want to know whether you have it:

SELECT COUNT(*), ROUND(SUM(LENGTH(option_value))/1024) AS kb
  FROM wp_options WHERE autoload = 'yes';

A few hundred rows and under a megabyte is healthy. Thousands of rows, growing with your user table, is the problem.

Per-user and per-event data belongs in its own indexed table. A log with ten million rows then costs you disk and nothing else, because no front-end page view touches it.

3. Meta queries you cannot index around

"Users who have not signed in for 90 days" is a query about the *absence* of recent data, and absence is the hardest thing to index.

There is no way around doing that work. There are ways to bound it — a covering index on the meta key and value, and a cutoff so the query has a floor rather than scanning the whole table. What there isn't is a way to make it free, which is why it belongs behind a deliberate filter rather than in the default view.

Why the bulk action is the real problem

Slowness is annoying. A bulk action that times out partway through is something else.

One long request against four hundred accounts means:

  • PHP's max_execution_time decides when to stop, not your code. It stops mid-loop.
  • You get no report, because the response never comes back.
  • Some accounts changed and some did not, and nothing recorded where the boundary was.
  • Retrying repeats the work on the ones that already succeeded — usually harmless, occasionally not.

For a role change that is inconvenient. For a bulk disable it means some people are locked out, some are not, and you cannot tell which without checking four hundred accounts by hand.

The fix is to stop treating it as one request. Batch it — fifty at a time, each batch a request that comfortably finishes, with progress reported as it goes. The job takes the same total time and it *completes*, which is the only property that matters.

Two things follow from batching that are easy to miss:

Refusals have to be per-account. Select four hundred users and include yourself; a batched run should change 399 and tell you which one it refused and why. A run that aborts on the first refusal wastes the work. A run that silently skips it is worse, because you will believe it did what you asked.

Progress has to be honest. "Processing…" is not progress. A count is.

The safety rail nobody thinks about until they need it

A filter that returns more than you expected, feeding a bulk action, is how a site locks itself out.

The specific trap: filters built on the *absence* of data. "Never signed in" means "no sign-in record", and on a plugin installed last week that describes every account on the site. Run a bulk disable over that selection and you have just disabled everybody.

The honest handling is to bound such a filter to accounts registered since the tool started recording, and say that it did. It makes the filter answer the question you were actually asking rather than a technically-correct one that would ruin your afternoon.

What to measure on your own site

Install Query Monitor and check three things:

  1. A front-end page, logged out, plugin active and deactivated. The query count should be identical. If a user-management plugin appears in a logged-out page view, that is the wp_options problem.
  2. Your Users screen with a search term. Look at the slow queries. If you see one returning every row, filtering is happening in the browser.
  3. The autoload query above. Under a megabyte.

None of this shows up in a synthetic benchmark on a fresh install, which is exactly why it ships.

—

*ITX UserOps runs search, sorting and pagination server-side as indexed SQL, keeps activity and session data in their own tables rather than wp_options, and batches every bulk action behind a progress bar with per-account refusals. All of it is in the free plugin — the dashboard, bulk actions and the performance budget are documented in full.*

A clearer WordPress admin
starts here.

Start with the free plugin. Add more control when you need it.

Log in

Vote on ideas, submit your own and join the discussion.