Magento – How to get rid of Base table or view not found: 1146 Table ‘catalog_category_flat_store_1’ doesn’t exist

databaseerrorflat-catalogmagento-1.9

Base table or view not found: 1146 Table
'catalog_category_flat_store_1' doesn't exist

I have see some answer for this question but its quick fix after some time I have same issue. But I get this error frequently. We can't say customer always to try again or refresh page. If I refresh page or do re-index I can see table available.

As part of debug I tried to DROP table manually and then visit pages but I can't see any error but I found that when table is not exits Magento will disable Flat table option in admin. so here I am not sure when this error occurs and what is the best solution to get rid of this.

If anybody found any solution to get rid of this problem permanently?
For your information I have repair database as well as I replace flat table with fresh Magento table but still no luck I get error again after 2 days.

Best Answer

If you are running a store with a very small number of products/categories you may want to simply disable the flat tables in System > Settings > Catalog. This can also sometimes be the case for very large catalogs as there is an obvious trade off to flattening the EAV tables. 1) It's less indexing that has to happen. 2) It can sometimes be faster if certain scenarios mentioned above are the case.

How are you normally re-indexing via the CLI? Do you receive any Exception or error messages when running it from the command line? php -f shell/indexer.php reindexall ?

You should also take a look in var/log/exception.log & var/log/system.log to see if there is any insight into the indexing failing. As what may be occurring is when your integration cron runs for Magmi, a reindex could be triggered that is failing, a normal operation for the *_flat tables is to drop the table before rebuilding it, it's a temporary table as you mentioned dropping the table manually works briefly. With this in mind, the indexer may start, hit an issue causing the indexer to fail and leaving the _flat table missing until a manual reindex happens. More details on your store's setup, integrations and reviewing logs to help pinpoint WHEN it happens may help with the process of elimination to locate the issue and fix it. Disabling your Magmi integration briefly may be something to consider as well to determine if the table still is missing or not. Anyhow, hope this helps and here's some further reading on the flat table/indexing:

Resources: