Jump to content
Sign in to follow this  
Magicie

PrestaShop - problem s vytizenosti DB

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?

Share this post


Link to post
Share on other sites

Mam na eshopu 17k+ produktu a 25k+ kategorii a vsechno chodi jak z praku... samo na dedikovanem serveru.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More