EAV stands for Entity Attribute Value Model.
EAV also known as object attribute value model and open schema.
Entity (E): Entity actually refers to data item. For example we can consider it as customer, category or product.
Attribute (A): Attribute refers to the different attributes of the Entity. Like for example product have different attributes like color, size, price, etc.
Value (V): Value refers to the actual value of the attribute of the entity. Like color has value red, price has value $25, etc.
Below is the basic structure of the EAV (Considering product as an example):
Entity:
product_id
Attribute:
attribute_id
product_id
attribute_name
Value:
attribute_id
product_id
attribute_value
Sample data are as below:
Entity:
product_id (1)
Attribute:
attribute_id (1) attribute_id (2)
product_id (1) product_id (1)
attribute_name (color) attribute_name (price)
Value:
attribute_id (1) attribute_id (2)
product_id (1) product_id (1)
attribute_value (red) attribute_value (290)
As per the above table structure, magento stores entry in three tables (actually more than three, but for this point it’s three). When you enter product in magento you have to insert different attributes of the product. So when you insert one product it will make one main entry in entity table. Then after with the reference of that entity id it will insert the various attributes (only name) of entity. At last with reference of entity id and attribute ids it will insert the actual value of the different attributes.
This is the basic structure of EAV which magento use. There may be (actually there are) some more complex structure of the EAV available but the main concept will remain same.
Why to use EAV?
EAV used because of scalability. We can insert anything without changing its structure. This is the main benefit of this structure.
Main problem with EAV structure is that, it is much slower than custom made solution because of SQL query complexity.
You need to make few join to retrieve just a single entity and in opposite in custom made solution we just have to make one simple select query to retrieve single entity.
Magento uses EAV structure because its designed to be scalable, regardless of speed problem.
[…] This post was mentioned on Twitter by Avinash Zala, Avi. Avi said: What is EAV model in Magento?: EAV stands for Entity Attribute Value Model. EAV also known as object attribute val… http://bit.ly/d3YjmE […]
[…] because of the EAV database structure. To more about the EAV database structure see my post on EAV database structure in Magento. But EAV database model is not much faster in terms of the performance. This is because we need […]
Yeah.. Magento have very high scalability. And because of that have problem on loading process.
Maybe there is one of reason why is recomended to enable catalog flat table and always keep index is up to date on magento backend.
Because when index process is running, they are collecting summary data from entity into only one table (catalog_product_flat_). CMIIW. :)
Hi Ferry,
Thanks for sharing this information.
Very nice and useful article. Thank you very much
I am new to magento and found that good understanding of EAV model of magento is a key to good grasp on magento.
In your article, I realized that why the magento was slow. Thanks :)
[…] Article on Magento after very long time. Last article which I have posted about magento is about Magento EAV Database structure. In that article I have explained the reason for the flexibility […]
thanks ,the information is very helpful :)
Thanks this is very useful content.
very good explaination