27

While doing bit research for speed issue of magento website i got some links where people says enable "Flat Catalog" to increase performance and speed .

Issue is that why it is not enabled by default is speed is issue.

Will enable "Flat Catalog" had some adverse effect also?

My magento website had 100 products and 500 bundled products and speed is quite issue as i am loading 36 products at once.

Will enabling "Flat Catalog" address my problem?

4 Answers 4

40

Difference between EAV catalog and Flat catalog is as following:

1. Eav Catalog

EAV is entity attribute value database model, where data is fully in normalized form. Each column data value is stored in their respective data type table. Example, for a product,

product ID is stored in catalog_product_entity_int table,

product name in catalog_product_entity_varchar table,

product price in catalog_product_entity_decimal table,

product created date in catalog_product_entity_datetime table,

product description in catalog_product_entity_text table.

EAV is complex as it joins 5-6 tables even if you want to get just one product’s details.

Columns are called attributes in EAV.

2. Flat Catalog

The flat model uses just one table, so it’s not normalized and uses more database space. It clears the EAV overhead,

It’s good when comes to performance, as it will only require one query to load whole product instead of joining 5-6 tables to get just one product’s details.

Columns are called fields in the flat model.

Magento implemented indexers that will periodically query the standard collections and populate flat database tables in the following format. Where * is store id.

catalog_category_flat_store_*
catalog_product_flat_*

These tables have the non-normalized product and category data that are intended to be read-only. This allows Magento to fetch category and product data in a single query.


You can enable flat catalog by navigating to System > Configuration > Catalog > Frontend > Use Flat Catalog Category | Use Flat Catalog Product. Set this to yes.

If you are adding a new attribute in the EAV table for the catalog. Then don't forget to run re-indexing (System > Configuration > Index Management). Re-indexing refreshes your flat catalog tables.

For more information please check “EAV” & “Flat Catalog” in Magento

5
  • ok 1: can i switch between flat to eav and eav to flat anytime ? 2: can dynamic columns be added when using flat also ?
    – mdeveloper
    Mar 9, 2016 at 6:32
  • Yes, You can switch between them. You can also add dynamic columns. But make sure you run re-indexing after adding new attribute to EAV Mar 9, 2016 at 6:34
  • @RohitKundale: Enabling Flat Catalog for product missing many attributes and as a result, I am not getting many features displayed for products. I re-indexed also. Why all the attributes are not indexing for dynamic columns while enabling flat catalog? Oct 24, 2016 at 9:37
  • 2
    @AnuragKhandelwal Check here Oct 27, 2016 at 19:33
  • This should have been the first thing they showed me when I started using magento.
    – Domino
    Mar 30, 2017 at 20:55
5

Magento uses the Entity-Attribute-Value (EAV) model for storing customer, product, and category data in its database. Although the EAV model enables you to have completely extensible attributes for those objects, object attributes are stored in multiple tables rather than one very large table.

Because attributes are stored in many tables—and that includes copies of some of the same attributes—SQL queries can be long and complex. The flat catalog feature creates new tables on the fly, where each row contains all necessary data about a product or category.

In earlier versions of Magento, it was necessary to rebuild the flat catalog every time you made changes to product attributes or product-category associations. In this release, the flat catalog is updated for you—either every minute, or according to your Magento cron job.

Flat catalog options not only enable the flat catalog and flat product indexers but also enable indexing for catalog and shopping cart price rules. If you have a large number of SKUs (500,000 or more), Magento can index catalog and shopping cart price rules quickly if you enable the flat catalog product option.

5
  • In this release, the flat catalog is updated for you—either every minute, or according to your Magento cron job. which version your are referring
    – mdeveloper
    Mar 9, 2016 at 6:42
  • Sorry i am not getting your point
    – Arunendra
    Mar 9, 2016 at 7:22
  • in your option did u refer current version as 1.9. or magento 2
    – mdeveloper
    Mar 9, 2016 at 7:28
  • 1
    It's depend on you which version is suitable for you. Magento 2 has more advantage.
    – Arunendra
    Mar 9, 2016 at 7:56
  • 1
    @Arunendra mdeveloper is asking which version of Magento are you referring to when you say : "In this release, the flat catalog is updated for you". Which release are you talking about? Does Magento 1.9 update it for us? Is it only in Magento 2? In which Magento version did this start getting updated for us?
    – Olivier
    Jul 13, 2017 at 13:57
5

Rohit's answer has been the percieved wisdom for the longest time but as of Magento 2.3 this is changing. It is no longer best practice to use flat catalog due to apparent "performance degradation and other indexing issues". While this seems counter intuitive, intial research seems to show this is due to reworking of how data is retrieved using Elatic Search.

Devdocs 2.3 screenshot

Some tweets here from the community with some Magento team involvement starts to shed light on this:

In Magento 1 this is irrelevant and is likely always advisable to use flat catalog as detailed in Rohit's answer

1

Flat categories are not automagically upgraded even in Magento 1.9.2. I've not checked 1.9.3, as I always manually rebuild indexes after bulk (eg stock level) updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.