Magento 2 Indexer – Manage indexer using command line Magento 2

Magento 2  Indexer – Indexing is how Magento transforms data ( products, categories … ) to improve the performance of your storefront. Magento stores lots of data (including catalog data, prices, users, stores … ) in many database tables. To optimize storefront performance, Magento accumulates data into special tables using indexers.

For example, suppose you change the price of an item from $4.99 to $3.99. Magento must reindex the price change to display it on your storefront.

Without indexing, loading the product information would take a long time, possibly resulting in cart abandonment.

1. Magento 2 indexers

In default, there are 10 indexers:

  • Design Config Grid ( name: design_config_grid )
  • Customer Grid ( name : customer_grid )
  • Category products ( name: catalog_category_product )
  • Product categories ( name: catalog_product_category)
  • Product price ( name: catalog_product_price)
  • Product entity attribute value ( name: catalog_product_attribute)
  • Catalog search ( name: catalogsearch_fulltext)
  • Stock ( name: cataloginventory_stock)
  • Catalog rule product ( name: catalogrule_rule)
  • Catalog product rule ( name: catalogrule_product)

We can get indexer info using command:

2. Indexer status

An indexer status can be one of following:

  • valid: data is synchronized, no reindex required
  • invalid: the original data was changed, the index should be updated
  • working: indexing is in progress

We can get indexer status using command:

3. Indexing modes

Re-indexing can be performed in two modes:

  • Update on Save: index tables are updated immediately after the dictionary data ( product, category, store…) is changed.
  • Update by Schedule: index tables are updated by cron job according to the configured schedule.

We can check indexer’s mode using command:

To change indexer mode, we use command

“realtime” is equal to  “Update on Save” and “schedule” is equal to “Update by Schedule”.

4. Re-index

Besides using “System -> Index Management” in Magento backend, we also can re-index using command:

We will get the result like:

5. Reset indexer when it’s locked.

During re-index process, you may get the message like:

So we need to reset that indexer status to be able to re-index ( in this case, it’s “cataloginventory_stock” )

We can reset indexer using command:


That’s how we can manage Magento 2 indexers. Please leave a comment or contact us if you have any question.


One thought on “Magento 2 Indexer – Manage indexer using command line Magento 2

  1. Hello,

    I have upgraded my magento version from 2.1.0 to 2.1.7
    Earlier the reindex time for Product Categories was 00:03:08 and now it has increased to 01:12:00
    Can anyone help me understand the reason behind this?

Leave a Reply

Your email address will not be published.