Blog background
November 10, 2017|Read • 4 Min

How Magento uses EAV in Database Architecture – Part 1

Written by
Santhosh Sundararajan
Santhosh Sundararajan
How Magento uses EAV in Database Architecture – Part 1

Listen Full Blog Here

Last Updated: Jul 3, 2026

Database

A database is a term we all have heard a lot of times from different people, but what actually is a database? Talking in layman’s language we can say that it’s a storage mechanism for storing the data. But, in technical terms it is the backbone of all the applications, be it mobile applications, web applications or system applications. Databases store the interaction of the users and keep the data intact into a relational schema, for reusability.

Hence we can say that no application is a complete application without a database.

How Magento uses it

For an application platform like Magento, having a market share of about 30% in the e-commerce business, the database is a key element and needs to be scalable, optimized, secure, and customizable. Since Magento provides high scalability (one of the major reason for such high market coverage), accordingly the database should be highly customizable. In order to achieve all the above specifications, Magento selected the EAV-Model to be the best applicable database model for this scenario. Since there are many debates on the acceptability of the Eav as compared to Flat tables, you can weigh the pros and cons of it explained ahead in the blog.

The EAV model used by Magento has three components.

  • E => Entity
  • A => Attribute
  • V => Value

Before we go into Magento database and architecture, let’s discuss them taking a real-life example.



  • Entity – Entity can be anything that has properties, currently what I see in front of me is a small whiteboard marker, here Entity is Marker.
    Attribute – Attribute of a marker can be length, color, thickness, marker_type.
    Value – For each of the attribute will have a value,

    length => 6inch
    color => black
    thickness => .2mm
    marker_type => permanent



  • Entity – Entity can be anything that has properties, currently what I see in front of me is a small whiteboard marker, here Entity is Marker.
  • Attribute – Attribute of a marker can be length, color, thickness, marker_type.
  • Value – For each of the attribute will have a value,

    length => 6inch
    color => black
    thickness => .2mm
    marker_type => permanent

  • length => 6inch
  • color => black
  • thickness => .2mm
  • marker_type => permanent

This is Eav model in a nutshell.

Blog image

How Magento uses a database?

So Magento has customized and optimized the database and added restrictions and functionality accordingly. Talking about the techies, each of them knows about data types as we have them in every language. MySQL already has different data types, and Magento also introduces data types as a layer over it. Data types such as int, DateTime, varchar, text, decimal are introduced in Magento to segregate the values based on the attribute type.

In Magento attribute can be of various types, such as:





  • Textarea
    Text
    Date
    Boolean
    Multi-select
    Select
    Price
    Image





  • Textarea
    Text
    Date
    Boolean
    Multi-select
    Select
    Price
    Image

  • Textarea
  • Text
  • Date
  • Boolean
  • Multi-select
  • Select
  • Price
  • Image

Each of the above attribute types has a different method to save the values and a different architecture to store data, keeping reusability in mind.

(Note: Always consider the usage area in mind while creating any new attribute. For example, if you want the attribute that should filter the products on frontend you must always use the select type or the multi-select type.)

Let’s discuss the attribute type considering our above example, where we discussed a Marker pen.





  • 1. length => 6 inches.





  • 1. length => 6 inches.

Length of the marker can be anything, so we can keep it as a text. (if we are using for only showing this attribute)





  • 2. color => black





  • 2. color => black

Now, this is something that the customer might consider while making the purchase of the marker and might use layered navigation or filters to get the particular one.





  • 3. thickness => .2mm





  • 3. thickness => .2mm

Again, it can be just for showing purpose as it does not affect the user selection.





  • 4. marker_type => permanent





  • 4. marker_type => permanent

Considering marker_type this might be something that can affect the purchase decision of the customer.

Hence, one should make attributes considering the scope of the attribute and usability and this gives us the scalability.

Readers, I know the above this is too complex to understand, so let me explain this a bit more using the same above example in the next topic.


Visit our previous Tutorial


What is x-magento-init?


What is RabbitMQ Used for in Magento 2

*Watch this space for the second part of article


Also Read


How Magento uses EAV in Database Architecture – Part 2

Related Blogs

Loading...

Our Offices Are Here

UAE flag

UAE

DTECH, Techno Hub 1, Dubai Silicon Oasis Authority, United Arab Emirates - Dubai - United Arab Emirates

+971 55 557 8583

Saudi Arabia flag

Saudi Arabia

Level 1, Building 7, Zone A Airport road, Business Gate P.O Box 93597 Riyadh 11683, KSA.

+966 50 809 6356

Oman flag

Oman

Building No. 2/786, Way No. 43, Block No. 336, Al Khud 132, Muscat, Oman

+968 7694 6200

Singapore flag

Singapore

Codilar Digital Pte Ltd, 68 Circular Road, #02-01, 049422, Singapore

India flag

India

7th Floor, Jupiter Block Prestige Tech Park, Kadubeesanahalli, Bellandur Amtankere, Bengaluru, Karnataka 560103

+91 888 49 00 505

Indonesia flag

Indonesia

Satrio Tower, Floor 6, Unit C and D, Desa/Kelurahan Kuningan Timur, Kec. Setiabudi, Kota Adm. Jakarta Selatan, Provinsi DKI Jakarta