How to reindex product flat data in Magento

When trying to enable and reindex Product Flat Data – getting error from magento

The Flat Catalog module has a limit of 64 filterable and/or sortable attributes. Currently there are 521 of them. Please reduce the number of filterable/sortable attributes in order to use this module.

I can’t understand what this means and from where magento gets this values. In attributes I have only 321 different attributes so from where magento gets value of 521 currently used and where it takes limit for 64 of them?

Chris Stewart Asked on November 25, 2015 in Magento.
Add Comment
1 Answer(s)
Best answer

The method Mage_Catalog_Model_Resource_Product_Flat_Indexer::prepareFlatTable() is throwing this exception, when your product has more than maximum allowed indexes(64 in your case).

This maximum usually is defined in app/code/core/Mage/Catalog/etc/config.xml and matches the maximum number of 64 keys allowed by default mySQL installations, before they error with

ERROR 1069: Too many keys specified. Max 64 keys allowed

The  issue you are experiencing  is not how many attributes your products have, but how many of this attributes are filterable and/or sortable.

Trace Mage_Catalog_Model_Resource_Product_Flat_Indexer::getFlatIndexes() to find out how Magento reaches a total of 521 indexes.

For a quick check you can also have a look at your catalog_eav_attribute table and check how many attributes are filterable (is_filterable = 1) and/or sortable (used_for_sort_by = 1)

So once know how many filterable and/or sortable attributes you have you can eider lower the number of them or increase the max allowed number to match your needs.

Chris Stewart Answered on November 25, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.