Re-Index issue in Magento

Its a big issue with Index management of magento. Generally it works fine but some of the cases its taking too long or sometime you will get timeout error from browser.
This probelm is due to lots of products, categories, attributes etc in your database.

You can get rid of this by reindex from command line or shell. You can find a shell directory under ROOT directory of magento. Goto the path by cd command and run “php -f indexer.php help” then you will get the following response.

$ php -f indexer.php help
  --status             Show Indexer(s) Status
  --mode               Show Indexer(s) Index Mode
  --mode-realtime      Set index mode type "Update on Save"
  --mode-manual        Set index mode type "Manual Update"
  --reindex            Reindex Data
  info                          Show allowed indexers
  reindexall                    Reindex Data by all indexers
  help                          This help

       Comma separated indexer codes or value "all" for all indexers

You can see that there is a reindexall option but this is not recommended because of mysql overload if database is huge which may cause database LOCK(few tables).

You can execute the reindex one by one so that you can smoothly complete the reindex process without interrupt. There are 8 indexers in magento and if you want to see run the following command.

$ php -f indexer.php info

When you run this command you will get the following output:

catalog_product_attribute     Product Attributes
catalog_product_price         Product Prices
catalog_url                   Catalog Url Rewrites
catalog_product_flat          Product Flat Data
catalog_category_flat         Category Flat Data
catalog_category_product      Category Products
catalogsearch_fulltext        Catalog Search Index
cataloginventory_stock        Stock status

For example if you want to reindex the Product Attributes then run the following command:

$ php -f indexer.php -- -reindex catalog_product_attribute
Product Attributes index was rebuilt successfully

Also you can use the same for other indexers. Run indexer from command line makes low impact on server resources.

Hope this helps 🙂

You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *