cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 'Product Flat Data' reindex issue

Magento 'Product Flat Data' reindex issue

Hello,

I have problem in "Product Flat Data" Indexing. When I tried to reindex through shell it gives me the following error.

-----------------------------------------------------------------------------------

Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write; duplicate key in table '#sql-2f55_15e9'' in /home/stdiamo/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/stdiamo/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/stdiamo/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/stdiamo/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/stdiamo/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home/stdiamo/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `mg...', Array)
#5 /home/stdiamo/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `mg...', Array)
#6 /home/stdiamo/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(423): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `mg...')
#7 /home/stdiamo/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2833): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `mg...')
#8 /home/stdiamo/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(815): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_MG_MG_CAT_PR...', 'mg_catalog_prod...', 'entity_id', 'mg_catalog_prod...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/stdiamo/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1389): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/stdiamo/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /home/stdiamo/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(350): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /home/stdiamo/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /home/stdiamo/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
#14 /home/stdiamo/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
#15 /home/stdiamo/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
#16 {main}

-----------------------------------------------------------------------------------

I have tried many solutions, such as Truncate the "mg_catalog_product_flat_1" and reindex. But same issue.

 

I was also tried with truncating "catalog_category_product_index" table but no success, even all my products disappear on frontend.

 

Any help on this.

Thanks

 

 

 

reindex-issue.png

1 REPLY 1

Re: Magento 'Product Flat Data' reindex issue

Did you manage to solve this? I'm having the SAME issue on a production environment.