Tag Archives: Indexing

How to re-index data from command line in Magento

30 Aug

We all are agree that Magento is a powerful tool for ecommerce site but when it gets loaded with lots of data and images. Sometime it gets slower and you need to index your data.Indexes are additional database tables with some flat data, which allows to organize fast responses from the database.

Today I came up with how to use indexing in magento. If you are a magento developer, you might be familier with Index Management from Admin section of magento(Admin->System->Index Management). But when you have lots of data 10 thousand plus and lots of category, it might takes hours to update the indexes and sometime it shows time out error as it just break because of max_execution_time exceeding in php script. There is a solution, you can run reindex process from the command line.

I am expecting that you have a SSH access to your hosting server, Just login to your account and go to magento root and then in shell directory by typing below command.

cd [MAGENTO_ROOT]/shell/

List all the file by ls -l

You will find php indexer and check its status by tying below in your command line:-

php indexer.php –status

You will see something like this:-

indexes_status

 

 

 

 

 

 

 

To run index rebuild process you can run the next command:

php indexer.php –reindex catalog_product_price

You can use next arguments for different types of indexes:

  • 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

You can also run the process in background by using & key.

Advertisements
%d bloggers like this: