I'm looking to add indexes the table to it to make lookups faster. If you manually add an index in MySQL, it will disappear at the next Magento "reindexing" event.

1 Answer 1


This happens here \Mage_Catalog_Model_Resource_Product_Flat_Indexer::prepareFlatTable

The table is built with magentos DDL $table = $adapter->newTable($tableName);

$table->setComment("Catalog Product Flat (Store {$storeId})");

And if you are looking for a nice event, I think catalog_product_flat_rebuild should do

public function updateEventAttributes($storeId = null)
    Mage::dispatchEvent('catalog_product_flat_rebuild', array(
        'store_id' => $storeId,
        'table'    => $this->getFlatTableName($storeId)

This method is called in

public function rebuild($store = null)
    // ...
    // ...

But I only read code, so please test, whether this works as expected :-)

  • What do you think about copying this file to the local folder and editing public function getFlatIndexes and adding my own $this->_indexes['IDX_MYCOLUMN'] = array('type'=>'unique','fields'=>array('my_column'))? Commented Mar 21, 2014 at 6:14
  • I prefer always events, because with the next magento update (and if something was changed) you burn in hell with this approach :-) Commented Mar 21, 2014 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.