a-prods Posted January 17, 2011 Share Posted January 17, 2011 Bonjour,J'ai un serveur qui a plante plusieurs fois. le suuport m'a envoye le mysql-slow.log en me disant: Voici la liste des requêtes MySQL mal codées (longues, manque d'index ...) et la je vois plusieurs requete de prestashop qui y sont reference.Enquoi se style de requete peut faire plante un serveur?Je ne comprend pas trop ce log, si quelqu'un pouvait meclairer se serait sympa.# Time: 110117 14:43:47 # User@Host: XXXXXXXXXXX @ localhost [] # Query_time: 14 Lock_time: 8 Rows_sent: 10 Rows_examined: 115 use nappesetco; SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, i.`id_image`, il.`legend`, t.`rate`, (p.`reduction_price` + (p.`reduction_percent` * p.`price`)) AS myprice, m.`name` AS manufacturer_name FROM `ps_product` p LEFT JOIN `ps_product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = 2) LEFT JOIN `ps_image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `ps_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = 2) LEFT JOIN `ps_tax` t ON (t.`id_tax` = p.`id_tax`) LEFT JOIN `ps_manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) WHERE (`reduction_price` > 0 OR `reduction_percent` > 0) AND (`reduction_from` = `reduction_to` OR (`reduction_from` <= '2011-01-17 14:01:43' AND `reduction_to` >= '2011-01-17 14:01:43')) AND p.`active` = 1 AND p.`id_product` IN ( SELECT cp.`id_product` FROM `ps_category_group` cg LEFT JOIN `ps_category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` IN (SELECT id_group FROM ps_customer_group WHERE id_customer = 19) ) ORDER BY `myprice` DESC LIMIT 0, 10; Je pourait mettre tout le log, mais je ne sais pas ci c'est une bonne idee car il y a toutes les requettes et le nom des bases. est ce risque? Link to comment Share on other sites More sharing options...
Apaccy Posted January 17, 2011 Share Posted January 17, 2011 Bonsoir,Voici peut être quelques pistes a prendre :1] Faire un EXPLAIN de ta requête, (et nous montrer le résultat)2] Optimiser la requête en évitant de les imbriquer3] Reconstruire tes index@+ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now