cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 - SQLSTATE[42S02]: Base table or view not found when running a reindex

Magento 2 - SQLSTATE[42S02]: Base table or view not found when running a reindex

I am getting the following error on terminal when running bin/magento indexer:reindex:

***SQLSTATE[42S02]: Base table or view not found: 1146 Table 'catalog_product_index_price_cfg_opt_temp' doesn't exist, query was: DESCRIBE `catalog_product_index_price_cfg_opt_temp.

 

I have checked the website database and can confirm the table does exist but with no data.

 

cZ8Pz.png  

 

When I manually run the SQL query (DESCRIBE `catalog_product_index_price_cfg_opt_temp) it created data.

However, when I try re-running the bin/magento indexer:reindex command following this, it removed the data created when running the above SQL command and i still get the same below error on terminal

 

***SQLSTATE[42S02]: Base table or view not found: 1146 Table 'catalog_product_index_price_cfg_opt_temp' doesn't exist, query was: DESCRIBE `catalog_product_index_price_cfg_opt_temp.

 

Hopefully you can help me to resolve this. Thank you!

1 REPLY 1

Re: Magento 2 - SQLSTATE[42S02]: Base table or view not found when running a reindex

Hello @harrisnuma4eec 

 

The error message "Base table or view not found: 1146 Table 'catalog_product_index_price_cfg_opt_temp' doesn't exist" in Magento 2 indicates that the catalog product price index table is missing from the database. This error can occur when the Magento 2 upgrade process fails to complete, or when there are issues with the indexing process. Please follow the steps below in order to resolve this issue:

  • Check the database:
    • First, check the Magento 2 database to see if the 'catalog_product_index_price_cfg_opt_temp' table exists. If it does not exist, this may be the cause of the error.
  • Rebuild the catalog product price index:
    • To rebuild the catalog product price index, run the following command in the command line interface: 
      php bin/magento indexer:reindex catalog_product_price
  • This will rebuild the catalog product price index and create the missing 'catalog_product_index_price_cfg_opt_temp' table.
  • Check for errors during indexing:
    • If the error persists, check the Magento 2 logs for any errors related to the indexing process. This can help identify any issues that may be preventing the index from being rebuilt correctly.
  • Check for incomplete upgrade process:
    • If the error occurred after a Magento 2 upgrade process, it is possible that the upgrade process was incomplete. Check the Magento 2 logs for any errors related to the upgrade process and complete any necessary steps to ensure that the upgrade is completed successfully.

In summary, the error "Base table or view not found: 1146 Table

'catalog_product_index_price_cfg_opt_temp' doesn't exist" in Magento 2 can be resolved by checking the database for the missing table, rebuilding the catalog product price index, checking for errors during indexing, or completing any incomplete upgrade process.

 

If you find our reply helpful, please give us kudos.

 

A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

 

WebDesk Solution Support Team

Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9