How to Change Magento2 Indexing Mode
How to Change Magento2 Indexing Mode
If you need to know How to Change Magento2 Indexing Mode, you can do so using the command line. Magento2 provides different indexing modes to optimize performance, and switching between them correctly can significantly improve store efficiency.
php bin/magento indexer:set-mode {realtime|schedule} [indexer-name]
“Realtime” corresponds to “Update on Save”, while “Schedule” refers to “Update by Schedule”.
Magento2 Indexing Overview
Indexing is how Magento transforms data such as products and categories to improve storefront performance. Whenever data changes, it must be reindexed to reflect those changes efficiently. Magento’s architecture stores vast amounts of merchant data, including catalog data, prices, users, and store information, across multiple database tables. To ensure smooth performance, Magento consolidates this data into optimized tables using indexers.
Magento2 Indexing Modes
Reindexing in Magento2 can be performed in two different modes:
- Update on Save - Index tables are updated immediately after the related data is changed.
This mode requires additional custom code (such as plugins or event observers) to trigger reindexing when entities are created, updated, or deleted. - Update by Schedule - Index tables are updated according to a cron job schedule.
This mode does not support thecustomer_grid
indexer, meaning you must either use the Update on Save method or manually trigger reindexing with the following command:bin/magento indexer:reindex customer_grid
.
Magento2 Indexing Types
Each indexer in Magento2 supports different types of reindexing operations:
- Full Reindex – This process rebuilds all indexing-related database tables.
A full reindex is typically required when major changes occur, such as creating a new store view or adding a new customer group. It can also be triggered manually using the command line. - Partial Reindex – This process updates only the parts of the database that have changed.
Partial reindexing occurs when minor modifications, such as updating a product price or attribute, are made.
The type of reindexing performed depends on the specific changes made within Magento2. Each indexer follows predefined rules to determine whether a full or partial reindex is necessary.
Reference
For further details, refer to the official Magento 2 Developer Documentation: Indexing Overview | Magento 2 Developer Documentation.