From 270 to 192 database queries: how we made a Shopware product page faster
· 4 min read · Flashport
A product page in the BerryBase shop triggered 270 database queries. Today it is 192, and customers see no difference in how the page looks. What was behind it, and what you can check in your own shop.
Measure first
Before we change anything, we count. For every key page – home, category, product, checkout – we measure how many database queries one visit triggers and which of them are duplicates.
BerryBase is a Shopware 6 shop with more than 20,000 products and three country storefronts for Germany, Switzerland and Austria. The product page was at 270 queries per visit.
Load the same data only once
Many queries happen because the same data is loaded in several places. A cache that lives only for the duration of one request makes sure every piece of information comes from the database exactly once per page view.
Skip work that changes nothing
Shopware recalculates the cart to apply promotions. When no promotion is active, that calculation is pure load. In that case we skip it.
Move cache and sessions out of the database
Redis takes over cache and sessions, so the database handles data rather than temporary storage. On top of that, OpenSearch handles search, and Cloudflare in front of the shop serves content before the server is even asked.
The result
The product page now needs 192 queries instead of 270. None of the changes is exotic. Slow shops usually share the same few causes.
A checklist for your shop
- How many database queries does your product page trigger?
- Is the same data loaded several times per page view?
- Is work running that changes nothing in your shop – such as promotion calculations with no active promotion?
- Are cache and sessions still in the database?
- Is there a cache such as Cloudflare in front of the shop, and is it configured properly?