Question

As a follow-up to a previous question I would like to know:

When should I use the category flat table option?

While googling I found an advice to enable it "when you have very much categories". But what is much?

I can easily understand, that activating flat tables for products is a good decision in terms of performance, but is it really as much important for catalogs?

And what implications conclude from this? I just learned that enabling flat category tables lead to not being able to save category product positions. At least not as easy as without the flat option (thx to Marius for your help). Are there any other mentionable things?

Thanks in advance :)

Was it helpful?

Solution

If you have PHPMyAdmin installed on your server you can take a look at Magento's tables. You'll see that there are a lot starting with catalog_product_... and catalog_category_....

All these are used for each product and category so that means a lot of complicated and heavy queries for every page you call.

To lighten the load on MySQL and speed up your shop Magento offers flat tables. For example catalog_product_flat_1. If you take a look at the structure of this table you'll see it has a lot of the basic product data which means that, for example in the category product list, only one query has to be executed to this table instead of querying the multiple other tables containing the attribute data.

However, this data is aggregated from the data in the other tables, that means that every time you save a product several indexes (System > Configuration > Index Management) are refreshed to compile this product data. In some cases like for example while developing this might be unnecessary. You want to see all changes immediately even though the page load time could take a while.

So in conclusion, whenever you launch a shop to the public, turn them on and when programming try not to use full product or catalog objects but instead use the data provided by the flat indexes.

OTHER TIPS

If you have much categories or many custom made attributes for categories it is a good choice becuase of reduced query complexity. Keep in mind that heavy load benefits even more from it. The main downside is that categories and flat_categories use a very different interface, so often code has to be very carefull in case of enabled flat categories.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top