Due to the sophisticated architecture, Magento gathers a lot of merchant’s data, e.g.: catalog info, prices, users, stores, in many database tables. To optimize the Magento 2 frontend performance the most important information is stored into special tables using indexers that gathering the data. You need to keep the indexes up-to-date to show actual data on the storefront.
In Magento 2 reindex is required for these 8 indexers when any changes are made:
E.g.: when updating a product price the data should be reindexed to be correctly displayed on the frontend. The indexation sufficiently reduces time spent on calculating a final order price including cart price rules, bundle pricing, discounts, tier pricing, etc.
In older Magento versions indexation is dependent on the indexer.php file placed under the shell folder. In Magento 2 it’s managed by the bin/magento instead.
To reindex indexes in Magento 2 you can use several ways: reindex via a cron job and use manual reindex from the admin panel.
Reindex Magento 2 via a cron job is very convenient way. In this case reindexing runs every minute (you can set an appropriate period) eliminating the necessity to manage the process manually . To configure a cron job correctly follow the guide.
You can use Magento 2 manual reindex via the command line:
However, reindexing of all indexers can take long, therefore, you’d better manage a cron job for the issue.
Helpful hint: If you need a complex solution to prevent your M2 store from lags due to the too long loading, try out this Reindex from Admin. Having installed it, you'll reindex data in a click right from the admin panel, automate the reindexing, check the reindex process in a live regime.