How Indexing works in Magento 2 admin panel

Overview

To enhance the performance of your storefront, indexing is how Magento transforms data like products and categories. When data changes, then the data must be updated or reindexed. Magento architecture is very sophisticated that stores merchant data like catalog data, prices, users and stores etc. So the Magento use indexers to enhance the storefront performance.

For example, if you change the data like price, categories etc then Magento must reindex the data change to show on your storefront.

Terminology

Dictionary

Dictionaries are formed to facilitate maintenance (updating the data).

Index

Index using some algorithms to re-created data from a dictionary. Indexes can include results of various aggregations and calculations. Representation of the actual data to optimize reading and searching.

Indexer

The object that creates an index

How Magento implements indexing

These components are involved in the process of indexing:

Component Description
Magento_indexer

In Magento1.x, Magento_index is used. But now for all the new development Magento_indexer module is using.

Implementation:

  • Indexer declaration
  • Indexer running
  • indexer running mode configuration
  • indexer status
Magento\Framework\Mview

Implementation:

  • Allows tracking database changes for a certain entity (product, category, etc.) and running change handler.
  • Emulates the materialized view technology for MySQL using triggers and separate materialization process (provides executing PHP code instead of SQL queries, which allows materializing multiple queries).

 

Indexing Types

Each indexing type performs differently:

Full Reindex

Full reindex performs the action to rebuild all the indexing related database tables.

You can easily run full reindex by using the command line:

php bin/magento indexer:reindex

Partial Reindex

Partial Reindex performs the action to only rebuild the database tables of the things that is changed(e.g change the price of a single product.)

To run the reindex for the specific data run the following command:

php bin/magento indexer:reindex [indexer]

Indexer Status

The indexer has different values for the database table and for the indexer grid in the Magento 2 admin panel.

Admin Status Database Status Description
Ready Valid No reindex required
Reindex Required Invalid The actual data was changed, the index needs to update. 
Processing Working Indexing is in progress.

 

Follow the command, to check the indexer status:

To check the full indexer status run this command

php bin/magento indexer:status

To check the partial indexer status run this command

bin/magento indexer:status [indexer]

And to check the status in the Admin panel follow the path in the admin area:

System > Tools > Index Management.

Indexing Modes

Reindex can work in two modes:

Update on Save: Index tables are updated after the data is changed.

Update by Schedule:  According to the configured schedule, index tables are updated by the cron job.

To see these options in the admin panel,

  • Go to System > Tools > Index Management.
  • From the Actions dropdown, you can choose the mode and click Submit.
Related Posts
  1. How To Add Configurable Product In Magento 2
  2. Setup Multiple Stores in Magento 2
  3. BENEFITS OF HAVING MAGENTO 2 UX
  4. Benefits of Magento 2 Improved Layered Navigation
Related Products