Slow performance, slow and long running crons
CREATED FOR:
- Developer
This article describes how to solve site performance issues and slow running and stuck crons caused by flat tables and indexers having been enabled.
AFFECTED PRODUCTS AND VERSIONS
- Adobe Commerce on cloud infrastructure 2.1.x and above
- Adobe Commerce on-premises 2.1.x and above
- Magento Open Source 2.1.x and above
Issue
Flat indexers can cause:
- Heavy SQL load and site performance issues.
- Long running and stuck crons.
Cause
Flat tables and indexers enabled.
Solution
Starting with Adobe Commerce and Magento Open Source 2.1.x and above, the use of a flat catalog is no longer a best practice and is not recommended. Continued use of this feature is known to cause performance degradation and other indexing issues. To disable the flat catalog:
-
In the Admin, navigate to Stores > Settings > Configuration.
-
In the panel on the left under Catalog , choose Catalog.
-
Expand the Storefront section, and do the following:
- Set Use Flat Catalog Category to No.
- Set Use Flat Catalog Product to No.
-
When complete, click Save Config. Then when prompted, refresh the cache.
-
Flush cache by running
php bin/magento cache:flush
.
If you can’t change the Use Flat Catalog Category and Use Flat Catalog Product to No because the options are greyed out, disable flat indexers in app/etc/config.php
:
- Run this command to make sure all indexers are set to Update by schedule:
php bin/magento indexer:set-mode schedule
. - Edit
app/etc/config.php
and locate the lines withflat_catalog_product
andflat_catalog_category
- change them from 1 to 0 to disable them. - Run the command
php bin/magento app:config:import
- Run this command to confirm that the flat indexers are disabled:
php bin/magento indexer:status
. - Flush cache by running
php bin/magento cache:flush
.
Related Information
Reset stuck Adobe Commerce cron jobs manually on Cloud in our support knowledge base.