Reindex Magento data faster by using the shell

Submitted by metaharper - 5 years ago

Reindexing from the admin panel - while convenient - is more time intensive and in my experience, has even managed to eat up enough system resources to bring down a production server. Since that day, I've primarily kept to triggering an index update over SSH when dealing with larger sites. Here are some tips for doing just that.

// Once connected over SSH, cd into your shell directory from document root (e.g. /var/www/html/shell)

cd shell

// Begin a reindex using this command:

php indexer.php reindexall

// It is possible to get full list of Magento indexer commands using the following

php indexer.php help

// To get a list of available indexes, execute this command

php indexer.php info

// Here are the 8 indexes in Magento

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

// Individual commands for re-indexing:

php indexer.php --reindex catalog_product_attribute
php indexer.php --reindex catalog_product_price
php indexer.php --reindex catalog_url
php indexer.php --reindex catalog_product_flat
php indexer.php --reindex catalog_category_flat
php indexer.php --reindex catalog_category_product
php indexer.php --reindex catalogsearch_fulltext
php indexer.php --reindex cataloginventory_stock
php indexer.php --reindex tag_summary
Learn PHP
comments powered by Disqus
Proudly hosted on Digital Ocean