Home » Magento27 November 2009

Magento: Describing Flat Catalog

Difference between EAV and Flat Catalog

In EAV database model, data are stored in different smaller tables rather than storing in a single table.

Like,
product name is stored in catalog_product_entity_varchar table

product id is stored in catalog_product_entity_int table

product price is stored in catalog_product_entity_decimal table

EAV database model is used by Magento for easy upgrade and development as this model gives more flexibility to play with data and attributes.

When flat catalog is enabled in Magento then all the above product attributes (id, name, price) are kept in one table named like catalog_product_flat. Then Magento fetches product data from the flat table rather than joining all the other smaller tables.

There are two types of Flat Catalog:
1) Flat Catalog Product
2) Flat Catalog Category

– Flat Categories are recommended for any Magento installation for improved performance.
– Flat Products is designed and recommended for catalogs that have over 1000 SKU’s.

Enable Flat Catalog Category:

Old Magento version
– Go to Admin Panel->System->Cache Management->Rebuild Flat Catalog Category
– Go to Admin Panel->System->Configuration->Catalog->Frontend->Use Flat Catalog Category = Yes

New Magento version
– Go to Admin Panel->System->Index Management
– Select ‘Product Flat Data’
– Click ‘Reindex Data’ link for that row
– Go to Admin Panel->System->Configuration->Catalog->Frontend->Use Flat Catalog Category = Yes

Enable Flat Catalog Product:

Old Magento version
– Go to Admin Panel->System->Cache Management->Rebuild Flat Catalog Product
– Go to Admin Panel->System->Configuration->Catalog->Frontend->Use Flat Catalog Product = Yes

New Magento version
– Go to Admin Panel->System->Index Management
– Select ‘Category Flat Data’
– Click ‘Reindex Data’ link for that row
– Go to Admin Panel->System->Configuration->Catalog->Frontend->Use Flat Catalog Product = Yes

Remember that, initially the selection list of

Admin Panel->System->Configuration->Catalog->Frontend->Use Flat Catalog Product
OR,
Admin Panel->System->Configuration->Catalog->Frontend->Use Flat Catalog Product

is non-editable. You have to rebuild Flat Catalog from Cache Management (old Magento version) or Index Management (new Magento version). Only then the selection list becomes editable.

Hope this helps. Thanks.

From Mukesh Chapagain's Blog, post Magento: Describing Flat Catalog

php magento mukesh chapagain

Get New Post by Email

Find me on

Facebook Twitter Google+ LinkedIn RSS Feed
  • http://www.kedaisouvenir.com Arata

    Thank you for the explanation.
    Now I can choose which option suit my store’s best.

    -cheers-

  • Eddy

    nice explanation , i search this article for several hours…. TKS..

  • VoltzRo

    thx a lot, good information.

  • C Castrillo

    Hi, that was a good explanation, but I have a question… it might sound silly but I need to know…  Let´s put it as an example to explain myself better:
    – say that you enable the Flat Category and Flat Product options… the Index is built and form now on each of the new products or categories I insert will be store on a single flat table.
    – Suddenly I realize that this option somehow conflicts with some other extension I´m using so I want to go bat to the EAV data model…

    What would it happened with all those modifications I did while using the Flat model? THey have been store on a different way on the database??  Will Magento reindex or build the other Model too?

    I might sound stupid but I would like to have this clear before I go for it…

    Thanx

    Tino

  • C Castrillo

    Hi, that was a good explanation, but I have a question… it might sound silly but I need to know…  Let´s put it as an example to explain myself better:
    – say that you enable the Flat Category and Flat Product options… the Index is built and form now on each of the new products or categories I insert will be store on a single flat table.
    – Suddenly I realize that this option somehow conflicts with some other extension I´m using so I want to go bat to the EAV data model…

    What would it happened with all those modifications I did while using the Flat model? THey have been store on a different way on the database??  Will Magento reindex or build the other Model too?

    I might sound stupid but I would like to have this clear before I go for it…

    Thanx

    Tino

  • Bulkpusta

    @53c6f96d653c6572dcd077d042659222:disqus 
    Everything you will change (add new attribute, change value for product, add new products, …. is written inside EAV tables.
    You import products into EAV tables, magento then ardd new lines into flat tables.
    Flat tables are created in background (If you change something big, they are probably deleted and created again with this new attribute)
    If you add new store (or store view), magento will create new flat table for it.

    Shotrly: don’t worry, everything is still in EAV tables.

  • Bulkpusta

    @53c6f96d653c6572dcd077d042659222:disqus 
    Everything you will change (add new attribute, change value for product, add new products, …. is written inside EAV tables.
    You import products into EAV tables, magento then ardd new lines into flat tables.
    Flat tables are created in background (If you change something big, they are probably deleted and created again with this new attribute)
    If you add new store (or store view), magento will create new flat table for it.

    Shotrly: don’t worry, everything is still in EAV tables.

  • http://jeffreyibarra.webs.com/ Richard Nicholson

    I’m impressed, I must say. Really rarely do I encounter a blog that’s both educative and entertaining, and let me tell you, you have hit the nail on the head. Your idea is outstanding; the issue is something that not enough people are speaking intelligently about. I am very happy that I stumbled across this in my search for something relating to this.

  • http://bloggink.com/willieatkins/ Michael Browning

    After study a few of the blog poasts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.

  • http://www.facebook.com/asheeshkumar.singh.3 Asheesh Kumar Singh

    Thank a lots .. i think its a new way to think apart from EAV :)

  • MrJoshuaPack

    The EAV data model is still being populated while using the flat model. The flat model actually comes from the EAV data.