Reindexing Magento Data via Shell
The fastest and recommended way to do reindexing in Magento is run it through Shell. To do so go to your Magento Web root directory( eg. /var/www/html/).
To execute all the indexes at once run the following command.
gt; php shell/indexer.php reindexall
If you only have to index one or two indexes, it is not recommended running the indexing for entire data. Individual indexing syntax for
#Category Flat Data
gt; php shell/indexer.php –reindex catalog_category_flat
#Product Flat Data
gt; php shell/indexer.php –reindex catalog_product_flat
#Stock Status
gt; php shell/indexer.php –reindex cataloginventory_stock
#Catalog product price
gt; php shell/indexer.php –reindex catalog_product_price
#Category URL Rewrites
gt; php shell/indexer.php –reindex catalog_url_category
#Product URL Rewrites
gt; php shell/indexer.php –reindex catalog_url_product
#All URL Redirects
gt; php shell/indexer.php –reindex url_redirect
#Catalog Category/Product
gt; php shell/indexer.php –reindex catalog_category_product
#Catalog Search
gt; php shell/indexer.php –reindex catalogsearch_fulltext
#Tag Aggregation Data
gt; php shell/indexer.php –reindex tag_summary
#Product Attributes
gt; php shell/indexer.php –reindex catalog_product_attribute
Magento strongly recommends this method if your store got more products. This method usually avoids time-out issues and also limit the chances of getting any database error.
Re-indexing needs more resources, you should run this while there are few users online.