The database structure of Magento is designed to store and manage various aspects of an e-commerce website, including products, orders, customers, and more.
Understanding the Magento database structure is crucial for developers and administrators working with Magento.
Magento uses the Entity-Attribute-Value (EAV) database model, which allows for flexible and extensible data storage. Here's a brief overview of key components in the Magento database structure:
-
Core Tables:
- These tables store essential information about the store and its configuration. Examples include
core_config_data
for configuration settings andcore_store
for store-related information.
- These tables store essential information about the store and its configuration. Examples include
-
EAV Tables:
- Magento uses EAV tables for storing dynamic and flexible data, such as product attributes. Some key EAV tables include
eav_entity
,eav_attribute
, and tables related to specific entities likecatalog_product_entity
for products andcustomer_entity
for customers.
- Magento uses EAV tables for storing dynamic and flexible data, such as product attributes. Some key EAV tables include
-
Catalogue Tables:
- These tables store information related to products and categories. For example,
catalog_product_entity
contains basic product information, whilecatalog_product_entity_varchar
stores varchar-type attribute values for products.
- These tables store information related to products and categories. For example,
-
Sales Tables:
- Tables like
sales_order
andsales_order_item
store information related to orders. The structure allows for detailed tracking of each item within an order.
- Tables like
-
Customer Tables:
- Tables like
customer_entity
andcustomer_address_entity
store customer-related information. The EAV model is used to accommodate various customer attributes.
- Tables like
-
Index Tables:
- Magento uses indexing to optimise database queries for improved performance. Index tables, such as
catalog_product_index_price
andcatalog_category_product_index
, store precomputed values to speed up common queries.
- Magento uses indexing to optimise database queries for improved performance. Index tables, such as
-
Log Tables:
- Magento keeps log information in tables like
report_event
andlog_visitor
. These tables store data related to customer activity, reports, and system logs.
- Magento keeps log information in tables like
-
Review and Rating Tables:
- Tables like
review
andrating
store information related to product reviews and ratings.
- Tables like
When working with the Magento Framework, developers interact with the database using models. Models in Magento are PHP classes that map to database tables, making it easier to retrieve, update, and manipulate data. The framework also includes a Resource Model layer that abstracts the database interaction, providing a consistent and secure way to perform CRUD (Create, Read, Update, Delete) operations.
The Magento database structure follows the EAV model for flexibility, with dedicated tables for core configuration, catalogue, sales, customer data, and more. The Magento Framework provides models and resource models to interact with the database, making it easier for developers to work with the data within the application.
My Magento Expertise
If you are planning a new e‑commerce store, considering a platform upgrade or looking for ongoing Magento support, I can provide the expertise you need. Based in Northern Ireland and working with clients locally and internationally, I deliver solutions that help businesses grow.