Magento Indexers and Cron: Why Your Changes Do Not Appear

It is one of the most common Magento questions. A price is changed, a product is enabled or added to a category, and the store front carries on showing the old version. Nothing is broken, exactly. Magento is doing what it was designed to do, and the fix depends on which of three separate mechanisms is holding on to the old data.

Indexers: the pre-built tables

Magento stores products in a very flexible structure that is slow to read directly. To keep the store front fast, it builds indexes: simplified copies of prices, stock, category assignments, URLs and search data that the store front reads instead. When a change is saved in the admin, the relevant index has to be updated before customers see it.

Each indexer runs in one of two modes:

  • Update on Save updates the index at the moment you save. Simple, but it makes saving slower, and bulk changes and imports can become very slow.
  • Update by Schedule records what changed and lets a background job process the changes shortly afterwards. From Magento 2.4.8 this is the default for every indexer, on new installations and upgrades alike.

Update by Schedule depends entirely on cron. If cron is not running, changes queue up and never reach the store front.

Checking the indexers

Over SSH, in the store’s root directory, run:

bin/magento indexer:status

Each indexer is listed with its mode and status. Ready is what you want to see. Reindex required means the index is out of date and needs rebuilding. For indexers on Update by Schedule, the output also shows how many changes are waiting, which is the quickest way to tell whether cron is keeping up.

To rebuild the indexes once:

bin/magento indexer:reindex

On a large catalogue this takes time and uses a lot of resources, so on a busy store run it at a quiet time. A full reindex is a one-off fix, not a solution. If the indexes keep falling behind, the real problem is cron.

Cron: the part that is usually missing

Magento relies on cron for far more than indexing: processing the scheduled index updates, running message queue consumers, sending emails when asynchronous sending is enabled, generating sitemaps, updating currency rates and cleaning up old data. A store without working cron can look fine for a while and then build up a collection of strange problems.

Magento can install its own cron entry for the user the store runs as:

bin/magento cron:install

Confirm it is there with crontab -l, then confirm it is actually running by looking at the cron_schedule database table, where each job records when it was scheduled, when it ran and how it finished. A table full of jobs stuck at pending, with nothing recent marked success, means cron is not being triggered at all. A job that keeps finishing with error or missed shows you where to look next.

The cache: the final layer

Even with the indexes up to date, a page served from the full page cache will show the old version until that cached copy is cleared. Magento normally clears the affected entries itself, so this is mainly a problem after changes made directly in the database, through an import tool, or by an extension that does not clear the cache properly.

bin/magento cache:clean

This clears Magento’s enabled cache types and is the one to try first. bin/magento cache:flush empties the underlying cache storage completely, which can also affect anything else using the same storage. Use it if cleaning has not helped. If the store sits behind Varnish or a CDN, that has its own cache as well.

Working through it in order

  1. Run bin/magento indexer:status. If indexes need rebuilding or have a large backlog, go to step 2. If everything is Ready, go to step 4.
  2. Check that cron is installed and that cron_schedule shows recent successful runs.
  3. Fix cron, then let the backlog clear, or run a one-off reindex if the store needs to be right immediately.
  4. Clean the cache, and flush it only if cleaning does not help.

Magento’s constant background work is one of the main reasons it needs more from its hosting than a typical website, which we covered in why Magento needs more than ordinary shared hosting.