Categories: Magento Tutorials

How To Reindex Magento Using SSH

Disclaimer: Magenticians does not necessarily agree with the views expressed in this guest post. They are presented to bring to light all diverse views in the Magento and general ecommerce community.

Indexing is a fundamental operation in Magento that greatly affects the performance of the store in several ways. Magento uses an Entity-Attribute-Value (EAV) database structure that often requires heavy database queries to retrieve simple results. Keeping this in mind, Magento developers have implemented index tables that query and store all the data into a single table structure, allowing Magento to query the single Index table rather than joining through complex JOIN queries that span multiple tables. In simpler terms, indexing does not alter the data in the database. It just transfers the data about the users, products, and categories into a more efficient table system that significantly improves the speed and effectiveness of the store. For this purpose, Magento uses several special objects called indexers. A recommended best practice in the case of indexing is to reindex after every modification in database’s data. For instance, when the price(s) change, it is best to reindex the change so that the storefront always display the latest price. Filing to reindex in this case could result in performance drop and in worst cases, cart abandonment. To reindex in Magento 1 follow the procedure. In the Admin Panel, go to System > Index Management, check all the indexes that you wish to reindex and then submit the request. In Magento 2, you could follow almost a similar procedure. However, the great thing about Magento 2 is that it has an impressive system Command Line Interface (CLI) based system that is ideal for a large set of products. Magento 1 includes an indexing script indexer.php, which is found in the MAGENTO_ROOT/shell folder. This shell script could be used to reindex Magento using SSH or CLI. To try out the script, you need to have access to the SSH Terminal, and then cd to MAGENTO_ROOT/shell. To get help from the indexer.php shell script, you will need to execute the command php indexer.php help. The following response will appear: To check the status of all indexes, type php indexer.php –status. The result should be something like: Each index has its index key that is used as a reference when reindexing in Magento. To get the list of indexers and their keys, you can use the php indexer.php info command: To reindex a single index, run the php indexer.php –reindex [Index Option Code] command: The above command can also be comma delimited for multiple indexers: You can also initiate a blanket reindex (reindexall) across the store. However, this is not a recommended practice because it could cause MySql/Server overload. Reindexall calls eight indexers in a row and the process of reindexing all indexers can cause database LOCK on some tables. The command php indexer.php –reindexall will reindex all the indexers at once: Index Management is an essential activity of every Magento based online store. It is important that the store administrator(s) take out time to learn how to reindex Magento using SSH terminal. I hope this post will prove helpful. Thanks for reading! Please leave a comment if you wish to ask a question or add to the discussion.
Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. He contributes as a Guest Author at Magenticians to share his knowledge with the Magento Community. Fayyaz is a food lover and enjoys driving.

Share
Published by
Fayyaz Khattak

Recent Posts

Building Employee Trust and Dedication – A Complete Guide

In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More

3 months ago

12 Winning Strategies for Small Businesses Marketing

In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More

3 months ago

Top 10 App Development Companies in Dubai 2024

With one of the highest internet penetration rates, the UAE has set out to revolutionize… Read More

3 months ago

Transforming Industries: How Amazons GPT44X is Revolutionizing AI Technology

Artificial Intelligence (AI) has been continually evolving, leading to remarkable advancements in various industries. Among… Read More

8 months ago

Top Magento 2 Extensions for 2023

Extensions, extensions and lots of extensions. We all love extensions, don’t we? After all, extensions… Read More

11 months ago

Unleashing the Power of Software Testing: Cooperating with a Testing Firm

Software quality is crucial to a firm's success across industries in the quickly changing digital… Read More

11 months ago