Magento Indexing

Why Magento needs indexing?

Magento Indexing is used to improve speed or performance of our web store. Indexing is how Magento changes data such as products, categories etc. As data changes, the changes data must be changed or re-indexed.
For Example: Suppose you change the price of an product from $4.99 to $3.99. Magento must reindex the price change to display it on your Front-End.

How to executing Magento Indexer?

There are different ways to executing Magento Indexer

  1. From Magento Admin (Admin Configuration)
  2. Through Shell
  3. Set by Cron
1. From Magento Admin (Admin Configuration)

To understand how indexing works and to reindex when needed. Go to Magento Admin Panel
System -> Index Management

01
 
 
02

2. Through shell:

Magento: Performing Magento Indexer from shell.

Magento uses re-index data from the Admin Panel. A good way to re-index data from command shell because in some condition when we want to re-index data we will get an error message and re-index process will be broken.
In Magento, there is a folder with name “shell” in this folder, you will find with name indexer.php.
This is a shell script for re-indexing.
Shell folder path: Go to your [ROOT FOLDER/shell]

  • First, cd [Your project url]/shell
  • After that, Get indexing info using following command

    Command: php indexer.php

    magento-indexing-php-reindexer

  • Execute reindex-data using following command

    Command: php indexer.php –reindex

    magento-indexing-php-indexer

    By default there are 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

    Following are the individual commands for re-indexing

    1. hp indexer.php –reindex catalog_product_attribute
    2. php indexer.php –reindex catalog_product_price
    3. php indexer.php –reindex catalog_url
    4. php indexer.php –reindex catalog_product_flat
    5. php indexer.php –reindex catalog_category_flat
    6. php indexer.php –reindex catalog_category_product
    7. php indexer.php –reindex catalogsearch_fulltext
    8. php indexer.php –reindex cataloginventory_stock