What is EAV Architecture in Magento ?


EAV stands for Entity, Attribute and Value. EAV is an database architecture. In magento EAV db architecture was used.



Entity      => Attribute      => value

Product  => Name => Laptop
=> Price => 500$

Customer   => Name => SJRANJAN
=> City => Bangalore

EAV in Magento

Magento stores product information in EAV structure. Magento does not keep product and category information in one or two tables. It uses many tables to store this information.

If you add a new product to magento it starts storing information of the product from “catalog_product_entity” table. The “catalog_product_entity” table holds the basic information about a product.

The “eav_attribute” table holds common attributes for the product. In this table there exists one field “backend_type” which actually decides where the value(data) would be stored.

i.e if the “backend_type” holds the value “varchar” then the value will be stored in “product_entity_varchar“. if the “backend_type” holds “text”, then value will be stored in to “product_entity_text” table.

This is how magento EAV structure works.

Advantage & Disadvantage of EAV structure

The advantage with this system is to add a new attribute to an entity (i.e. product), we dont need to alter db structure.

The disadvantage is time consumption. As it requires to join multiple tables for data, it takes time to get the process done.

Share on :