https://embed.notionlytics.com/wt/ZXlKd1lXZGxTV1FpT2lKaFlUZG1PR014WkRVd1ltWTBORGd5T1RVd05qZzBNekF4WTJJd1kyRTJPU0lzSW5kdmNtdHpjR0ZqWlZSeVlXTnJaWEpKWkNJNklrbGpiM1pzV2pOcU1VUnBRM1ZUUm1WNFRtdHlJbjA9

Magento implements the Entity-Attribute-Value (EAV) model. This means Magento is capable of managing any amount of entities. These entities may have any amount of assigned attributes.

The EAV model is an abstraction that allows extending Magento functionality by adding more entities or more attributes without writing too much boilerplate code.

What are Magento 2 entities?

As an eCommerce platform responsible for most processes of online retail business, Magento has to manage multiple entities. Here is their schema:

Untitled

Each of these entities may have attributes that describe each instance of that entity. Products may have color, categories may have a description. Managing entity attributes is a very important process. Magento solves it by introducing the Entity-Attribute-Value (EAV) model.

How are attributes of entities managed?

This model stores data the following way:

Untitled

And this is how the EAV model works! We have skipped over a few tables to avoid confusion.

Why is entity information indexed?

As you may see, the information of each entity attribute is split into several tables. On a scale, with 100.000 entities and 400 attributes, this results in 100.000.000 entries in attribute tables. This is very hard to manage for any SQL engine. This is especially apparent when querying by entities by their attribute value.