A database in Magento eCommerce Platform has quite complicated structure, but each user needs to have at least basic knowledge about it. We will now review what the architecture of EAV database is and how it works.
General information about EAV
EAV is an abbreviation for Entity, Attribute and Value. Each of these components has its own very important meaning for Magento platform functionality. Let us review each component in details.
Entity – is a so-called Magento entity. It is represented by such elements as products, categories, potential and existing customers, and orders (both pending and processed ones).
Attribute – as the name of this element says, it is responsible for various attributes of products and categories. For example, each product has such attributes as price, color, size, processing status, etc.
Value – this parameter is responsible for each specific attribute.
In simple language, in Magento each product has specific entities, each item, in its turn, has specific set of attributes which have their own values and characteristics.
EAV principle of work
Standard web store databases have quite simple appearance. Each database is responsible for storing specific data, e.g. one of them stores the information about product categories, the other one – about specific product class while the third database combines the information from the first two ones. But after Magento eCommerce Platform was created the things became more complicated. This engine uses several dozens of different databases to run a web store, and each of them has its own peculiarities.
In order to understand why so many databases are needed it is first important to understand how the data is stored on this platform. A large amount of data used to be stored in one database table, but it is not always convenient. Magento splits the data between several database tables. The tables have their own hierarchy as well as all Magento files do. The most important and the main one is catalog_product_entity table.
It stores the most important information about all products in the web store and their attributes. For instance, this table contains the data about SKU (product number). This table is used for building of a logical product list with the description of the main attributes.
The next one in the hierarchy is eav_attribute table which plays the role of the main entity storage. Here you can see a lot of similar attributes, often even with the same names. Based on this, it appears to be almost impossible to determine to which entity this or that attribute belongs. But it is only at first sight. In order to distinguish the attributes the system needs entity_type_id.
Entity_type_id contains a special numeric code which, in its turn, is checked by other database tables. All such attributes correspond to their products so there are no problems distinguishing them.
Further in the hierarchy, there are different tables containing information about all prices and characteristics of a certain product. They can be easily recognized by name as it always corresponds to the data format.
The question why we need to use EAV can be answered in the following way: this database configuration system can be scaled which is not a feature of a standard database. This is very convenient for large data storages (especially for web stores).
At the same time, you may notice slow operation of databases when EAV is used. The system uses a lot of resources to check and create new tables and attributes which may cause some slowness.
Also please check Magento Modules which could be useful for you as well.
If you have any questions about Magento EAV you are welcome to contact GoMage specialists and request our assistance.