Jump to content

PrestaShop - problem s vytizenosti DB


Magicie

Recommended Posts

Jiz nekolik dni a bohuzel neuspesne resime problem s vytizenosti vsech procesoru serveru na kterem bezi DB a tudiz rovnez Apache proxy u nejnovejsi verze PrestaShopu.

Vyzkouseli jsme snad jiz veskere nastaveni v administraci a take jelikoz mame k jeho nastaveni pristup take na strane serveru, ktere se nam podarilo na internetu dohledat a vypada to v tuto chvili tak, ze jedine reseni je hrubsi zasah do kodu samotne aplikace.

Na PrestaShopu mame navesenych cca 25 - 30 tis. produktu a SQL dotaz si je stahne prijde mi to snad vsechny jen proto, aby jich pak na strance zobrazil dejme tomu 20., tzn. az pote je v PHP strankuje.

Pokud kliknu na "+" u kategorie a tuto rozbalim na podkategorie, kdy nasledne jednu z nich vyberu, tak je vse v poradku a jednotlive produkty se nactou. Stejne tak kategorie, ktera ma "jen" 2388 radku.

Pri rozkliknuti se spousti tento dotaz:

SELECT p.`id_product`, p.`condition`, p.`id_manufacturer`, p.`quantity`, p.`weight`,
       (SELECT GROUP_CONCAT(`id_category`) FROM `ps_category_product` cp WHERE cp.`id_product` = p.`id_product`) as ids_cat,
           (SELECT GROUP_CONCAT(`id_feature_value`) FROM `ps_feature_product` fp WHERE fp.`id_product` = p.`id_product`) as ids_feat,
           (SELECT GROUP_CONCAT(DISTINCT(pac.`id_attribute`)) 
               FROM `ps_product_attribute_combination` pac 
               LEFT JOIN `ps_product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`) 
               WHERE pa.`id_product` = p.`id_product` ) as ids_attr
       FROM ps_product p 
       WHERE p.`active` = 1 AND p.`id_product` IN ( SELECT id_product FROM `ps_category_product` cp WHERE cp.`id_category` = 678)



Kdyz vsak kliknu primo na kategorii s vetsim poctem produktu, tak zrejme MySQL databaze nestihne odpovedet a celek skonci 504 gateway timeoutem, popr. 502 proxy errorem.

Nelze nejakym zpusobem vice optimalizovat dotazy, popr. upravit nastaveni tak, aby se nam to podarilo rozchodit?

Link to comment
Share on other sites

  • 1 year later...
  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...