---
title: Shopware Database Introduction | Shopware Community Hub
description: A primer on how Shopware leverages databases to persist data.
canonical_url: >-
  https://hub.shopware.com/learn/unit/solutions-architect-shopware-database-introduction
---

# Shopware Database Introduction

<LearningObjectives>

- Understand how Shopware shops different **data entities**.
- Gain a high-level overview of **Shopware’s database schema**.
- Recognize how the schema supports key ecommerce functions, like **product management, orders, and customers**.
- Understand the difference between **DAL** and **DBAL** in Shopware.

</LearningObjectives>

# Database Type

Shopware leverages a Relational type SQL database for persisting data. More specifically, MySQL or MariaDB are recommended per the [requirements](https://developer.shopware.com/docs/guides/installation/requirements.html). However, other types, for example, proprietary cloud-native engines such as AWS Redshift, can also be used.

## Schema

Shopware’s database schema is designed for flexibility and scalability, enabling complex ecommerce operations while allowing for customization. It stores entities such as products, categories, customers, orders, and carts in separate tables, each optimized to support Shopware’s functionalities.

- **Entity-Relationship Structure**: Shopware’s schema is based on an entity-relationship model, where key entities (e.g., `product`, `customer`, `order`) relate to each other through specific keys—more on this in the _Database Abstraction Layer_ section below.

- **Example Entities**:
    - **Product**: `product` table holds core product data, and tables like `product_price` and `product_media` support related information.
    - **Customer**: The `customer` entity contains customer details, with additional tables handling customer addresses, account history, and sales history.
    - **Order**: Orders are managed within the `order` table, and supporting tables hold line items, transactions, and payment details.

- **Media, SEO, and Translations**: Shopware also has dedicated tables for media handling, SEO configurations, and translations, which allow flexibility across different storefronts and languages.

## Database Abstraction Layer

The Data Abstraction Layer (DAL) in Shopware is an intermediary layer that simplifies query writing. Rather than directly querying tables, DAL acts as a wrapper, abstracting away some of the complexities of working with Shopware data.

### Key Concepts and Benefits

**Entity Management:**
The DAL organizes data into entities, representing products, customers, and orders, among other things. Each entity has a set of fields, such as product_name for products or email for customers.
The DAL provides a standardized way to retrieve, update, and manage these entities.

**Data Consistency and Integrity:**
Using DAL, Shopware ensures that data remains consistent across different platform parts. When data is accessed, modified, or linked (e.g., associating a product with a category), DAL applies standardized rules to ensure that all changes are synchronized and validated.

**Compatibility and Upgradability:**
With DAL as a middle layer, changes to the underlying database structure (such as new tables or changes in table relationships) don’t require rewriting every data access point.

The DAL also allows for cross-database compatibility (like using MySQL or MariaDB), as developers work with DAL functions rather than directly with SQL syntax.

**Data Indexing and Search:**
DAL includes an indexing feature that enhances data retrieval speed. When products or categories are queried, the index helps retrieve information faster, improving the store’s performance.

**Event System Integration:**
DAL is integrated with Shopware’s event system, meaning that actions like data creation, updates, or deletions trigger corresponding events. This feature allows developers to set up automated responses (like updating stock or sending notifications) without needing custom code for each action.

Read more in this article: [Shopware DAL](https://developer.shopware.com/docs/concepts/framework/data-abstraction-layer.html).

## Excursus: DAL vs. DBAL in Shopware

| Feature              | DAL                                                           | DBAL                                              |
|----------------------|---------------------------------------------------------------|---------------------------------------------------|
| Level of Abstraction | High-level abstraction with entities and repositories         | Low-level SQL access                              |
| Use case             | Application logic: read/write data using Shopware conventions | Direct SQL: Migrations, performance-heavy queries |
| Query language       | Criteria objects and repository methods                       | Raw SQL-Strings                                   |
| Extensibility        | Events and entity extension support                           | No Shopware-specific extension logic              |
| Use in Shopware      | Preferred for most business logic                             | Used in migrations or special internal operations |
| Data integrity       | Handles entity definitions                                    | Pure data access without entity awareness         |

<Callout title="DAL or DBAL – Which one to use?" type="info">

Use DAL if you're building features on top of Shopware's entity system.  
Use DBAL if you're writing migrations, raw SQL queries, or need full control over the query structure.

</Callout>
