We could not reindex customer_grid_flat
nor we can open Customer menu at the left side in Magento 2 admin. It gives an error. Looking around i found this similar issue Then we tried to open DB table Customer_grid_flat but it says table is empty. Anyone an idea?
-
Did you attempt the steps that user HostMyBus provided in the answer to the question you link to? It looks like they're saying in their case the MySQL database storage files saved on the hard drive became corrupted so he made a backup of the database and loaded that into a temp db, then ran the query that failed manually on the temp db, then copied the temp db's storage files for the corrupted table back to his main DB...– Bryan 'BJ' Hoffpauir Jr.Sep 7, 2017 at 20:47
2 Answers
Try to execute the reindex command:
php bin/magento indexer:reindex
I had the same problem and I didn't understand why in the admin panel instead to retrieve data from customer_entity
table Magento use customer_grid_flat
.
When You create an account all information are registered only in customer_entity
but not in customer_grid_flat
, to force the system to register the new account data in customer_grid_flat
you must execute the reindex command or execute a cron job.
I have not yet understood why, but it is so.
I think it's a performance issue.
-
Did you have to do anything else besides run the re-indexer? The other question and answer linked to in OP's questions points to some possible file corruption in the underlying MySQL storage files and I would imagine that the reindex alone might not be able to resolve this... PS - This is about M1 & Catalog Tables, the same principle applies to M2 & Customers - Magento uses "flat" tables to aggregate data that is split across many different subtables in their EAV model to improve performance of read operations. Sep 7, 2017 at 20:52
-
Also Index is helpful for this - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'decure_magento.catalog_product_flat_2' doesn't exist– Team18Sep 11, 2018 at 12:48
Try the following:
php bin/magento i:rei customer_grid
If you are not able to reindex the customer_grid
, run this instead:
php bin/magento i:reset customer_grid && php bin/magento i:rei customer_grid
then run php bin/magento indexer:reindex