Magento 2 Database Overview

This documentation provides a comprehensive guide to the Magento 2 database structure, designed to help data analysts and developers understand the relationships between tables and their purposes. Magento 2 uses a complex database schema with over 300 tables organized into different modules.

Database Architecture

Magento 2 uses a modular architecture where each module has its own set of database tables. The database follows these key design patterns:

Key Database Modules

Common ID Patterns

Understanding these common ID patterns will help you navigate the database:

Table Naming Conventions

Magento 2 follows consistent naming patterns:

PatternDescriptionExample
module_entityMain entity tablessales_order, catalog_product_entity
entity_typeRelated data tablessales_order_item, sales_order_address
entity_eav_attributeEAV attribute valuescatalog_product_entity_varchar
entity_gridAdmin grid tables (denormalized)sales_order_grid
entity_entityMany-to-many relationship tablescatalog_product_website

Getting Started

For new data analysts, we recommend starting with these essential tables:

  • sales_order and sales_order_item - For order and revenue analysis
  • customer_entity - For customer demographics and segmentation
  • catalog_product_entity - For product catalog analysis
  • sales_order_grid - Denormalized view with most order information

Click on any module card above to explore detailed table structures, relationships, and common queries for that module.

Understanding the EAV System

The Entity-Attribute-Value (EAV) model is a key architectural pattern in Magento 2. Unlike traditional table columns, EAV stores attributes as rows, allowing for:

EAV Tables Structure

Each EAV entity type (product, customer, category) has multiple tables:

Table TypePurposeExample
*_entityMain entity datacatalog_product_entity
*_entity_varcharText attribute valuescatalog_product_entity_varchar
*_entity_intInteger attribute valuescatalog_product_entity_int
*_entity_decimalDecimal attribute values (prices, weights)catalog_product_entity_decimal
*_entity_datetimeDate/time attribute valuescatalog_product_entity_datetime
*_entity_textLong text attribute valuescatalog_product_entity_text