Introduction to Magento EAV

Here we’ll discuss the database architecture used behind Magento. Hence the CMS follow the Magento EAV – Entity Attribute Value database structure. Further the CMS uses such structures for products, categories & customer details etc. However before the Mage revolution (Mage Version 1.4x or earlier) the Magento EAV structure was used for orders too. But after Mage 1.4x the flat structure are being used instead of Magento EAV.

However, our hosting has both SSD cloud hosting & servers. Next Pro & Plus hosting plans include services like Web development, transfer support & Aspiration CDN. Hence, our basic plan begins for just $9.899 per month. So, enjoy our dedicated cloud 4GB server for $149/mo . Enjoy various Aspiration rewards often. Visit our site for more information & support.
Tanzia Farin Chy – Aspiration Hosting

 E for Entity – Magento EAV

Here from the definition Entity refers to the Magento Data items. So, following is the list of entity tables for customer details, products & categories etc.:

  • catalog_category_entity
  • customer_entity
  • customer_address_entity

A for Attribute – Magento EAV

Next Attributes indicates the various attributes of a subject.  

In general, same attributes for an entity comes under in a single table in Mage Database. For example, eav_attribute is differs with each other by the term entity_type_id.

By using the following SQL query, we are able to see all attributes comes under an entity. Here we’ll check attributes for product:

SELECT
attribute_code,
attribute_id,
backend_type
FROM
eav_attribute
WHERE entity_type_id =
(SELECT
entity_type_id
FROM
eav_entity_type
WHERE entity_type_code = ‘catalog_product’)

Now a screen pops up with all attributes under single entity(here product): magento eav

In the same way, we can see the attributes for all entities using following as entity_type_code:

  • catalog_category
  • customer
  • customer_address

V for Value – Magento EAV

Last but not least, value means the real value of attributes of an entity. In terms of product, catalog_product_entity_[backend_type] tables store the Mage attribute values of entity. Here [backend_type] actually is the value of the field.

Further note: except value “static”,backend_type of table: eav_attribute.  

By the way, using following SQL query to find [backend_types] whom are related to product entity.

Here, following SQL is used to find all the backend types related to a product entity:

SELECT DISTINCT
backend_type
FROM
eav_attribute
WHERE entity_type_id =
(SELECT
entity_type_id
FROM
eav_entity_type
WHERE entity_type_code = ‘catalog_product’)

Next we’ll see the following results:

  • backend_type
  • text
  • int
  • varchar
  • decimal
  • static
  • datetime

And tables are storing values for attributes :

catalog_product_entity_text
catalog_product_entity_int
catalog_product_entity_varchar
catalog_product_entity_decimal
catalog_product_entity_datetime

In conclusion, EAV relates database tables based on backend_type and attributes .