EE 4.6.5 - Slow Query / Index Optimierung

Moin,

nachdem wir nun mit vielen internen Erweiterungen und externen Modulen arbeiten, sind wir gezwungen einige Performance-Improvements zu machen. Die DB Last / CPU Leistung geht auch schon relativ hoch, daher wollen wir mal pro aktiv sein.

Bisher laufen wir mit 5 Subshops auf der 4.6.5 EE. Die gängigen Zahlungsartenmodule für Amazon Payments, PayPal, Sofortüberweisung, Kreditkarte/Heidelpay und RatePAY sind integriert. Einiges an Cronjobs hat sich auch gesammelt.

Nach einem Blick ins Slow-Query Log sind mir direkt ein paar externe bzw. Core-Queries aufgefallen, die immer wieder auftauchen. Vielleicht hat ja jemand da bereits optimiert und Verbesserungsvorschläge was Performance-Killer angeht. Wir haben zum Beispiel die Oxid-Statistiken bereits rausgenommen, da diese überall Inserts produzieren, welche die Selects aufhängen.

[B]Rabattgruppen[/B]

select oxv_oxdiscount_2_de.oxid, oxv_oxdiscount_2_de.oxshopid, oxv_oxdiscount_2_de.oxshopincl, oxv_oxdiscount_2_de.oxshopexcl, oxv_oxdiscount_2_de.oxactive, oxv_oxdiscount_2_de.oxactivefrom, oxv_oxdiscount_2_de.oxactiveto, oxv_oxdiscount_2_de.oxtitle, oxv_oxdiscount_2_de.oxamount, oxv_oxdiscount_2_de.oxamountto, oxv_oxdiscount_2_de.oxpriceto, oxv_oxdiscount_2_de.oxprice, oxv_oxdiscount_2_de.oxaddsumtype, oxv_oxdiscount_2_de.oxaddsum, oxv_oxdiscount_2_de.oxitmartid, oxv_oxdiscount_2_de.oxitmamount, oxv_oxdiscount_2_de.oxitmmultiple from oxv_oxdiscount_2_de where  (   oxv_oxdiscount_2_de.oxactive = 1  or  ( oxv_oxdiscount_2_de.oxactivefrom < '2013-04-11 09:13:51' and oxv_oxdiscount_2_de.oxactiveto > '2013-04-11 09:13:51' ) )  and (
            select
                if(EXISTS(select 1 from oxobject2discount, oxv_oxcountry_de where oxv_oxcountry_de.oxid=oxobject2discount.oxobjectid and oxobject2discount.OXDISCOUNTID=oxv_oxdiscount_2_de.OXID and oxobject2discount.oxtype='oxcountry' LIMIT 1),
                        0,
                        1) &&
                if(EXISTS(select 1 from oxobject2discount, oxuser where oxuser.oxid=oxobject2discount.oxobjectid and oxobject2discount.OXDISCOUNTID=oxv_oxdiscount_2_de.OXID and oxobject2discount.oxtype='oxuser' LIMIT 1),
                        0,
                        1) &&
                if(EXISTS(select 1 from oxobject2discount, oxv_oxgroups_de where oxv_oxgroups_de.oxid=oxobject2discount.oxobjectid and oxobject2discount.OXDISCOUNTID=oxv_oxdiscount_2_de.OXID and oxobject2discount.oxtype='oxgroups' LIMIT 1),
                        0,
                        1)
            );

[B]Kunden kauften auch[/B]


select distinct oxv_oxarticles_2_de.* from (
                   select d.oxorderid as suborderid from oxorderarticles as d use index ( oxartid ) where d.oxartid in (  'jdk3c3dfbfeb6c1abbeeecd4e0ce4655' , 'jdkda7c2eeabf6c9f1dcb2f622831cfa' , 'jdk038545aea626e2bd021c029715b45' , 'jdk167f3b029dba40ab89331f81d6dcd' , 'jdk9e9feda59afbc8c488b2e170d27e2'  ) limit 80
               ) as suborder
               left join oxorderarticles force index ( oxorderid ) on suborder.suborderid = oxorderarticles.oxorderid
               left join oxv_oxarticles_2_de on oxv_oxarticles_2_de.oxid = oxorderarticles.oxartid
               where oxv_oxarticles_2_de.oxid not in (  'jdk3c3dfbfeb6c1abbeeecd4e0ce4655' , 'jdkda7c2eeabf6c9f1dcb2f622831cfa' , 'jdk038545aea626e2bd021c029715b45' , 'jdk167f3b029dba40ab89331f81d6dcd' , 'jdk9e9feda59afbc8c488b2e170d27e2'  )
               and ( oxv_oxarticles_2_de.oxissearch = 1 or oxv_oxarticles_2_de.oxparentid <> '' ) and (  oxv_oxarticles_2_de.oxactive = 1   and ( oxv_oxarticles_2_de.oxstockflag != 2 or ( oxv_oxarticles_2_de.oxstock + oxv_oxarticles_2_de.oxvarstock ) > 0  )  and IF( oxv_oxarticles_2_de.oxvarcount = 0, 1, ( select 1 from oxv_oxarticles_2_de as art where art.oxparentid=oxv_oxarticles_2_de.oxid and ( art.oxactive = 1  ) and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) )  )  LIMIT 0, 8;

[B]D3 Module[/B]


SELECT 1 FROM oxtplblocks WHERE oxmodule = 'Y' AND oxshopid = 'X' LIMIT 1;

und

SELECT oxtemplate FROM oxtplblocks WHERE oxmodule = 'Y' AND oxshopid = 'X';

wobei Y folgende Werte annimmt:

d3mod
d3modcfg
d3modcfg_autoloader
d3log
d3clrtmp

und in X die Subshop ID steht {2,3,4,5,6}

Hallo,

die genannten SQLs mit den tplblocks werden vom Shop selbst ausgeführt. Das dort ein “d3XXXXX” enthalten ist, liegt nur daran, das diese Module eigene Blocks nutzen. Diese muss der Shop holen. Das hat jedoch nichts mit den spezifischen Modulen zu tun.

Das die Queries langsam sind hat wohl eher was mit der unglücklichen Kombination von Left Join zwischen Tabellen und Views zu tun. Allgemein sieht die Query danach aus als wäre da wenig mit Indexen zu machen, die andere ist halt ein Meisterwerk der Subselect Kunst, auch nicht unbedingt glücklich.