# Sehr langsame Abfrage beim Kategoriewechsel

**URL:** <https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325>\
**Category:** Allgemein\
**Created:** [3. Dezember 2019 um 18:22 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325 "2019-12-03T18:22:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jschmidw](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jschmidw](https://forum.shopware.com/u/jschmidw)\
**Post date:** [3. Dezember 2019 um 18:22 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/1 "2019-12-03T18:22:03Z")

</div>

Hallo,

Ich habe eine Frage, seit einiger Zeit fällt mir auf, dass das Umblättern in den Kategorien sehr lange dauert. Wenn es nicht im Cache ist, sogar bis zu 10-15 Sekunden. Ich habe dann in Mysql nach slow queries gesucht, und diese hier gefunden, die ca. 10 Sekunden dauert. Kann mir jemand sagen, ob man hieran vielleicht erkennen kann, dass ein Plugin dafür verantwortlich ist, oder ob dies die “Originalquery” ist, und tatsächlich so langsam ist? WIr haben ca. 30.000 aktive Artikel. VIelleicht gibt es ja eine Option, die ich anwählen kann, die den Select weniger umfangreich macht? Topseller rausnehmen, oder sonst etwas? Hat jemand eine Idee?

SELECT product.id as \_\_product\_id, variant.id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as \_\_variant\_id, variant.ordernumber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as \_\_variant\_ordernumber FROM s\_articles product INNER JOIN s\_articles\_details variant ON variant.id = product.main\_detail\_id  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND variant.active = 1  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND product.active = 1 INNER JOIN s\_articles\_categories\_ro productCategory ON productCategory.articleID = product.id  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND productCategory.categoryID IN (3) LEFT JOIN s\_articles\_avoid\_customergroups avoidCustomerGroup ON avoidCustomerGroup.articleID = product.id  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND avoidCustomerGroup.customerGroupId IN (15) INNER JOIN s\_articles\_categories similarMain ON similarMain.articleID = product.id  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND similarMain.articleID != ‘136693’ INNER JOIN s\_articles\_categories similarSub ON similarSub.categoryID = similarMain.categoryID  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND similarMain.articleID != similarSub.articleID  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND similarSub.articleID = ‘136693’ LEFT JOIN s\_articles\_top\_seller\_ro topSeller ON topSeller.article\_id = product.id INNER JOIN s\_articles\_attributes productAttribute ON productAttribute.articledetailsID = variant.id WHERE avoidCustomerGroup.articleID IS NULL GROUP BY product.id ORDER BY topSeller.sales ASC, variant.id ASC LIMIT 3;

&nbsp;

---

<div class="post-metadata">

**Author:** ![raymond](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@raymond](https://forum.shopware.com/u/raymond)\
**Post date:** [3. Dezember 2019 um 21:16 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/2 "2019-12-03T21:16:49Z")

</div>

Shopware Version? Wieviele Produkte in einer Kategorie so durchschnittlich? Tritt auch bei Kategorien auf wo beispielsweise nur 20 Artikel enthalten sind? Welche PHP und MySQL Version? Mal mit&nbsp;Standard Theme probiert? Tritt es bei Artikel mit vielen Varianten auf oder auch mit Artikeln ohne Varianten?

Siehe erster Satz von dir: also war es mal Problem? Was hat sich dann geändert? Irgendein Plugin installiert?

---

<div class="post-metadata">

**Author:** ![TimmeHosting](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/timmehosting/32/15580_2.png) [@TimmeHosting](https://forum.shopware.com/u/TimmeHosting)\
**Post date:** [4. Dezember 2019 um 09:37 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/3 "2019-12-04T09:37:04Z")

</div>

Hast Du die Datenbanktabellen schonmal optimiert (geht über phpMyAdmin z.B. ganz einfach)? Ich würde Dir empfehlen, auch mal mysqltuner auf der Kommandozeile laufen zu lassen, der gibt Dir im Optimalfal wertvolle Hinweise zur Optimierung der Datenbankkonfiguration.

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/385eaa628505df573ebf33722f780335f53ac1b2.png)

Timme Hosting - schnelles nginx-Hosting

[www.timmehosting.de](https://timmehosting.de/)

---

<div class="post-metadata">

**Author:** ![raymond](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@raymond](https://forum.shopware.com/u/raymond)\
**Post date:** [6. Dezember 2019 um 16:21 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/4 "2019-12-06T16:21:00Z")

</div>

Ansonsten: was für ein Hoster und Hostingpaket? Für 30.000&nbsp;Artikel braucht man schon etwas Leistung.

---

<div class="post-metadata">

**Author:** ![jschmidw](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jschmidw](https://forum.shopware.com/u/jschmidw)\
**Post date:** [8. Dezember 2019 um 14:34 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/5 "2019-12-08T14:34:04Z")

</div>

Hallo, wir haben eigentlich einen recht flotten Server (eigene Hardware, 8 Prozessoren). Zusätzlich zu den aktiven Artikeln haben wir noch 45000 inaktive Artikel. Aber das war ja bislang auch kein Problem. Ich vermute dass die o.g. Abfrage einfach sehr komplex ist. Aber vielleicht kann man ja in Shopware irgend etwas tun, so dass keine so komplexe Abfrage generiert wird? Das Ergebnis dieser Abfrage sind 3 Zeilen. Ich vermute damit wird ein Variantenartikel ausgewählt:

\_\_product\_id,\_\_variant\_id,\_\_variant\_ordernumber  
48078,48077,AC500458697  
48079,48078,AC500458698  
48080,48079,AC500458699

&nbsp;

Betriebssystem Debian 8.11

Wir haben folgende Mysql-Version:  
mysql&nbsp; Ver 15.1 Distrib 10.0.38-MariaDB, for debian-linux-gnu (x86\_64)

Ich habe das Gefühl, dass es seit einigen Wochen so ist, es könnte vielleicht mit Variantenartikeln zusammenhängen. Die hatten wir früher nicht. Ansonsten haben wir ausser den regelmäßigen Updates nichts verändert. Während der sehr lang dauernden Abfrage geht die CPU -Benutzung des mysql-Prozesses deutlich hoch.

Auszug aus /proc/cpuinfo

processor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0  
vendor\_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : GenuineIntel  
cpu family&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 6  
model&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 60  
model name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Intel® Core™ i7-4790K CPU @ 4.00GHz  
stepping&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 3  
microcode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0x19  
cpu MHz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 4236.718  
cache size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 8192 KB  
physical id&nbsp;&nbsp;&nbsp;&nbsp; : 0  
siblings&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 8  
core id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 2  
cpu cores&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 4  
apicid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 4  
initial apicid&nbsp; : 4  
fpu&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : yes  
fpu\_exception&nbsp;&nbsp; : yes  
cpuid level&nbsp;&nbsp;&nbsp;&nbsp; : 13  
wp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : yes  
flags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scp lm constant\_tsc arch\_perfmon pebs bts rep\_good nopl xtopology nonstop\_tsc ap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; erfmperf eagerfpu pni pclmulqdq dtes64 monitor ds\_cpl vmx est tm2 ssse3 fma cx16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xtpr pdcm pcid sse4\_1 sse4\_2 x2apic movbe popcnt tsc\_deadline\_timer aes xsave a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vx f16c rdrand lahf\_lm abm ida arat xsaveopt pln pts dtherm tpr\_shadow vnmi flex&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; priority ept vpid fsgsbase tsc\_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm  
bogomips&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 7999.97  
clflush size&nbsp;&nbsp;&nbsp; : 64  
cache\_alignment : 64  
address sizes&nbsp;&nbsp; : 39 bits physical, 48 bits virtual  
power management:

&nbsp;

---

<div class="post-metadata">

**Author:** ![jschmidw](https://avatars.discourse-cdn.com/v4/letter/j/b3f665/32.png) [@jschmidw](https://forum.shopware.com/u/jschmidw)\
**Post date:** [8. Dezember 2019 um 14:42 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/6 "2019-12-08T14:42:21Z")

</div>

Achja, wir haben Shopware 5.6.2. Mysqltuner habe ich installiert, und auch schon Tabellen reorganisiert.

&nbsp;

---

<div class="post-metadata">

**Author:** ![raymond](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@raymond](https://forum.shopware.com/u/raymond)\
**Post date:** [8. Dezember 2019 um 14:45 UTC](https://forum.shopware.com/t/sehr-langsame-abfrage-beim-kategoriewechsel/63325/7 "2019-12-08T14:45:11Z")

</div>

Das mal lesen:&nbsp;[https://www.shopware.com/de/news/praxistipp-performance-optimierung-fuer-onlineshops/](https://www.shopware.com/de/news/praxistipp-performance-optimierung-fuer-onlineshops/)

Probiere auch mal die HTML Komprimierung zu deaktivieren:&nbsp;[https://forum.shopware.com/discussion/comment/259427/#Comment\_259427](https://forum.shopware.com/discussion/comment/259427/#Comment_259427)

Ansonsten müsste da mal ne Agentur darüber schauen.

Zudem: Debian 8 hat noch Support bis&nbsp;2020-06. Vielleicht auf aktuelles debian wechseln (lassen)?
