Sehr langsame query optimieren?

Hey,

sowohl meine Listenansichten (Kategorieübersicht) als auch die Detailsseiten laden sehr lange.
Nutze die Community Version 4.7.2

Hauptgrund scheint folgende Query zu sein die im Durchschnitt > 3 Sekunden dauert:


SELECT oxv_oxarticles_de.oxid as oxid 
FROM oxobject2category as oc 
                    left join oxv_oxarticles_de
                    ON oxv_oxarticles_de.oxid = oc.oxobjectid
                    WHERE (  oxv_oxarticles_de.oxactive = 1   
and ( oxv_oxarticles_de.oxstockflag != 2 
or ( oxv_oxarticles_de.oxstock + oxv_oxarticles_de.oxvarstock ) > 0  )  
and IF( oxv_oxarticles_de.oxvarcount = 0, 1, ( select 1 from oxv_oxarticles_de as art where art.oxparentid=oxv_oxarticles_de.oxid and ( art.oxactive = 1  ) 
and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) )  )  
and oxv_oxarticles_de.oxparentid = ''
and oc.oxcatnid = '482yhly8HEGmPlTJPXc3Zw'  ORDER BY  oc.oxpos, oc.oxobjectid;

Mein erstes Problem: Ich finde den Aufrufort der query nicht. Hat jemand eine Idee bzw. kann mir Hinweise geben wie ich die Aufruffunktion am besten finde?

Zweites Problem: Die lange Dauer der query liegt offensichtlich an der Größe der Tabelle (>50.000 Artikel in der problematischen Kategorie).

Meine erste Idee war das Erstellen einer materialized view und anschließendes ersetzen des Aufrufs durch einen Aufruf auf die view. Sieht jemand grundsätzliche Probleme mit diesem Ansatz oder könnte das gut funktionieren?

Ich bin für jegliche Hinweise und Anregungen sehr dankbar.

Freundliche Grüße,
Thomas

Düfte in oxArticleList::_getCategorySelect() sein.

Vielen dank. Hatte es die ganze Zeit in oxArticleList::loadCategoryArticles() vermutet aber da hat die Optimierung nichts gebracht.

Aus meinem Log mit Queries > 1 Sekunde ist sie nun verschwunden. Gefühlt dauert das Laden dooferweise immer noch genauso lange :confused: