---
title: "Shopware on PostgreSQL: it runs. Should it?"
description: "Shopware on PostgreSQL works: same code on four databases, DAL tests green, still slower than MariaDB. What the research found and why it helps MySQL shops."
url: "https://brocksi.net/blog/shopware-on-postgresql-it-runs-should-it/"
author: "Björn Meyer"
published: "2026-12-09"
lang: "en"
categories: ["Shopware 6", "Performance", "PHP", "Learnings"]
---

# Shopware on PostgreSQL: it runs. Should it?

“Why doesn’t Shopware run on PostgreSQL?” I hear that question every few months. From agencies whose hosting partner prefers it. From enterprise teams whose database team only runs PostgreSQL. From developers who simply like it better.

The honest answer was always some form of “it’s complicated”. I never liked giving that answer. It sounds like an excuse, and nobody, me included, had ever checked how complicated it really is. So I wanted a better one. I took the Shopware open source core and tried to make the database exchangeable: MySQL 8.4, MariaDB 10.11, PostgreSQL 18, and SQLite as a stress test for the idea.

Short version: **it runs.** The first time a checkout went through on PostgreSQL, I just sat there for a moment and grinned. The same code installs and works on all four databases. PostgreSQL is still slower than MariaDB, so it is not a reason to switch today. And the most valuable results are fixes for Shopware on MySQL, the database almost every shop runs.

This first part is the overview: the question, why I asked it, the answer and what should happen next. The other parts each take one topic and go deep.

> **Note:** This is research, not a feature. Nothing here is supported or planned for a release, apart from a few core fixes that came out of it. The code lives on a proof-of-concept branch, and the open questions below are real.

## Why this is harder than it sounds

Shopware talks to the database in two ways. Most code goes through the DAL (the Data Abstraction Layer), which builds SQL from Criteria objects. A lot of code also writes SQL directly, because it is faster or because the DAL does not fit. Both were written for MySQL, and it shows.

When I started counting, the first numbers looked like this:

- **446 files** outside the DAL and the migrations use the Doctrine Connection directly, and **241** of them contain SQL that only MySQL understands.
- **715 columns**, almost all of them ids, are binary(16), and 309 files outside the migrations convert ids between hex strings and bytes by hand, with calls like Uuid::fromHexToBytes().
- **507 text columns** rely on the case- and accent-insensitive collation utf8mb4\_unicode\_ci.
- **910 migrations** are written in MySQL DDL (CREATE TABLE, ALTER TABLE), and every fresh install runs them.

That is not a driver you swap. That is years of MySQL assumptions spread across a large codebase, plus thousands of extensions that make the same assumptions.

## Why I do crazy projects like this

A year ago I would not have started this. The question looked too big. Weeks of work just to find out it doesn’t work? Hard to justify for a side question.

AI changed that maths. I ran the project in ten waves over eight days, from 18 to 25 November 2026. Each wave was a set of work packages that agent sessions worked on in parallel, while I wrote the questions, set the rules and checked the results. Exploring got cheap. When exploring is cheap, the expensive mistake is no longer a failed experiment. It is the question you never asked.

So here is what I want you to take from this part, even if you never touch a database:

- **Ask “what would it take?” instead of “is this allowed?”** Most big questions are not blocked by anyone. They just look too expensive to try.
- **Break things on purpose.** The research branch is now 194 commits on top of trunk, with 774 files changed. It was never meant to be merged. It was meant to break every assumption it could find, because breaking things is how you learn what holds them together.
- **Make “no” a valid result.** One written rule of the project was that disproving something counts as a result, and then the plan changes. That rule mattered: some of the most useful answers in this series are a clear “no”.
- **Keep the bar high when it gets cheap.** Cheap code makes it easy to fool yourself. Another rule: a timing only counted if the result was equal to the result of the existing code. Fast and wrong does not count.

Thinking outside the box does not mean ignoring the box. It means not being afraid to open it up.

## The answer

**It works on all four databases.** One command, scripts/switch-db.sh postgresql (or mysql, mariadb, sqlite), installs Shopware from an empty database, loads demo data and runs smoke tests from the storefront to checkout. That takes about 30 to 50 seconds on every database. The DAL integration suite passes all **804 tests** on PostgreSQL, and outside the DAL all but 90 of 8,072 integration tests pass as well, not counting tests that fail on MariaDB too. A production-like setup with a replica, TLS, OpenSearch, background workers and PgBouncer ran end to end.

**PostgreSQL is still slower.** Storefront pages without the HTTP cache take **1.13x to 1.30x** as long as on MariaDB, and a single bulk write about **1.8x**. With parallel writes, PostgreSQL manages only a third of MariaDB’s throughput. That is after closing a gap that started at 2.6x to 3.6x. That first benchmark hurt. How that gap closed, and why I stopped trusting single benchmark runs, is part 3.

**The useful part is not PostgreSQL.** A second database is a mirror: it shows everything MySQL forgives without telling you. That was humbling. I went looking for what PostgreSQL needs and mostly found what MySQL had been hiding from us. The project collected **50 findings** for the Shopware core, and most of them are bugs, weak spots or performance problems on MySQL and MariaDB today. That is part 2.

**And the biggest speed win had nothing to do with which database you run.** Serving finished product documents from OpenSearch instead of rebuilding them from MySQL cut MySQL CPU by 84 % at 150,000 products. That, and why Shopware should keep its DAL instead of switching to an ORM, is part 4.

## The sceptical voice

Not everybody liked the idea, and that is good. When I shared the results, a Shopware core developer pushed back. PostgreSQL maintainers had told them years ago that database benchmarks are mostly synthetic, and that several applications got slower after moving from MySQL or MariaDB to PostgreSQL. On top of that, the whole ecosystem around Shopware, from extensions to hosting to tooling, is built on MySQL.

My own numbers point the same way. PostgreSQL stayed slower on every storefront and write scenario I ran. Only the install was faster.

The ecosystem point is just as real. I scanned every Shopware 6 plugin in the store, and more than half contain raw SQL of some kind. **9.4 %** use SQL that even the automatic SQL translator I built cannot handle. What that means for plugin vendors is in part 2.

So, should Shopware run on PostgreSQL? Not as a switch you flip next year. Maybe as a long-term option, if there is a business case: managed cloud databases, enterprise requirements, hosting partners. That is a business decision, not a technical one.

## What happens next

Because the useful findings help MySQL first, the order I propose is:

1. **MySQL hygiene and a better DAL.** Fix the findings and make the DAL faster from the inside. Pays off for every shop today.
2. **A read store for the storefront**, in parallel: finished product documents in OpenSearch. It does not depend on the database question at all.
3. **Database groundwork, without any PostgreSQL code.** One place for database-specific SQL, a single way to handle ids, and a database-neutral migration API.
4. **PostgreSQL**, only if someone makes the business case. Experimental first.

I turned the core work into issues for Shopware. 37 are filed so far. One fix is already merged and four more are in review, as of 2 December 2026; part 2 has the details. The issues are grouped into these epics:

- [DAL and core SQL: stop relying on lenient MySQL behaviour](https://github.com/shopware/shopware/issues/23287)
- [Fewer statements and fewer deadlocks in product writes and search](https://github.com/shopware/shopware/issues/23300)
- [DAL v2: keep the DAL and make it faster and typed](https://github.com/shopware/shopware/issues/23304)
- [Database abstraction groundwork: SQL dialect, id binding and neutral migrations](https://github.com/shopware/shopware/issues/23317)

If one of them touches code you know well, a comment or a pull request helps more than a thumbs-up.

All docs, numbers and the method are public in the research repository: [BrocksiNet/shopware-db-independent](https://github.com/BrocksiNet/shopware-db-independent).

## TL;DR

- Shopware runs on MySQL, MariaDB, PostgreSQL and SQLite from the same code. All DAL tests pass on PostgreSQL.
- PostgreSQL is 1.13x to 1.30x slower on uncached storefront pages and about 1.8x slower on a single bulk write. Not a reason to switch today.
- The real value is 50 findings that make Shopware on MySQL better. 37 issues are filed.
- PostgreSQL support is a business decision. The groundwork pays off either way.
- Ask big questions. Exploring is cheap now. Not asking is the expensive part.

Next up in part 2: what MySQL quietly does for you, and what that means for your own SQL and plugins.
