Magento Reindexing problem

Many time we are facing issues with re-indexing in magento.  Its getting stuck,  take too long time or many time giving error todo so.

This problem could be with various reasons..

  • Huge number of products
  • Apache memory limit / execution time
  • Locked files are still there from the previous time can preventing it running again

Fixing This,

First you can increase the memory limit and excution time from the .htaccess file

# php_value memory_limit 64M
 php_value memory_limit 128M
 php_value max_execution_time 18000

Now get connected with server ussing shell/terminal
go to “public_html/app/shell”

there you will find indexer.php, execute the below command, will reindec all indexers.

php indexer.php --reindex all

-*-*-*-*-*-*-*-*-*

Some time you can also get error to re-index through shell, while you have large number of product data. In such case from database delete/truncate bellow table(s),

catalog_product_flat_* (can be catalog_product_flat_1, catalog_product_flat_2,…)

mysql > truncate table ´catalog_product_flat_1´;
mysql > truncate table ´catalog_product_flat_2´;

-*-*-*-*-*-*-*-*-*

If you wish to reindex only few of them, run bellow command. Gives you list of all allowed indexers

php indexer.php --info

you can reindex indevidually as bellow,

php indexer.php --reindex catalog_product_attribute (Reindex Product Attribute)
php indexer.php --reindex catalog_product_price (Reindex Products prices)

If you do not have the SSH/command prompt access then try with bellow script to magento reindex all programmatically

<?php
require_once 'Mage.php';
$app = Mage::app('admin');
for ($indexer = 1; $indexer <= 9; $indexer++)
{
     $reindexProcess = Mage::getModel('index/process')->load($indexer);
     $reindexProcess->reindexAll();
}
/*
where $indexer ids are for
1 = Product Attributes
2 = Product Price
3 = Catalog URL Rewrites
4 = Product Flat Data
5 = Category Flat Data
6 = Category Products
7 = Catalog Search Index
8 = Stock Status
9 = Tag Aggregation Data
*/
?>
Advertisements

6 thoughts on “Magento Reindexing problem

  1. Pingback: Magento Reindexing problem | Kenneth Carnesi

  2. Pingback: Magento Indexes Issue – status stay Processing | Tech Bandhu

  3. Pingback: Magento – Indexes Issue – status stay Processing | nikunj-vadariya

  4. Pingback: Magento Reindexing problem | Kenneth Carnesi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s