Jump to content

Product List In Back Office Takes Too Long


bksoft

Recommended Posts

I installed prestashop 1.6.1.4 an d I have 25K products. In front office all is OK, but when I try to display the product catalog on the back office, the query takes up to 5 minutes to complete (only display the catalog).

When I debug, the query that takes too long, find 250 Millions of rows!!

I thing that the trouble is in the JOINs. For example, if I truncate the ps_image_shop table, to 2K rows the query is fast (max 10-20 seconds), but if I change to the true table (25K rows), the query takes too long.

 

The query is in AdminProductsController in the "construct".

 



SELECT SQL_NO_CACHE COUNT(*) AS `ps_product`
FROM `ps_product` a
LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1)
LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
AND sav.id_shop = 1 AND sav.id_shop_group = 0 ) JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)
LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)
LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default)
LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default)
LEFT JOIN `ps_image` i ON (i.`id_image` = image_shop.`id_image`)
LEFT JOIN `ps_product_download` pd ON (pd.`id_product` = a.`id_product`)
WHERE 1 LIMIT 1


 

Somebody have any solution to this?

Link to comment
Share on other sites

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...