Magento2命令行禁止使用Flat

目前Magento2的flat模式,已不是最佳实践。并且官方说了可能出现bug。


原文:

Magento no longer recommends the use of a flat catalog as a best practice. Continued use of this feature is known to cause performance degradation and other indexing issues. A detailed description and solution is available in the Help Center.

Affected versions include:
- Magento Commerce Cloud 2.1.x and above
- Magento Commerce (On-Premise) 2.1.x and above
- Magento Open Source 2.1.x and above

On any Magento version, some extensions only work with flat tables, thus creating a risk if you disable flat tables. If you know that you have some extensions that use Flat Catalog indexers, you need to be aware of this risk when setting those values to No.

如果需要关闭Magento2的flat product 和 category,可以运行下面命令:

bin/magento config:set catalog/frontend/flat_catalog_category '0'
bin/magento config:set catalog/frontend/flat_catalog_product '0'