Running Magento indexer from command line (shell)

Magento maintain various index tables to make data access faster. Magento core updates the indexes itself when you save a product but in some cases you may be required to update the indexes yourself. There are two ways to update the indexes from Magento admin or using the command line.

Updating Indexes from Admin

To updates index from admin follow the path Admin >> System >> Index Management

Updating Indexes from command line/shell

Magento Indexing

The command line script “indexer.php” is located in the “shell” directory of your Magento install. There are a number of options things you can do with this script.

Login with your SSH account and go to the shell scripts folder

cd [MAGENTO_ROOT]/shell/

Type the following to view the options available

php -f indexer.php help


In Magento there are 8 indexers, type the following to get the list of indexers

php -f indexer.php info


To view the current status of all indices type

php -f indexer.php status

To reindex you need to run commands like

php -f indexer.php -- --reindex catalog_product_attrbute


To rebuild all indices run the following command

php -f indexer.php reindexall

It is not recommended to execute full reindex in one step as it may overload the database server. Running indexer one by one will be faster and will generate less load on database server.

Leave a Comment

Back to top