Jump to content

database take too long to execute


Buaha

Recommended Posts

Hi, i have problem with database. My server provider sent me email that one of database have very long execute time for one query with over a minute. Is there anything i can do to decrease this time? I think that because of this very often on frontend i cant see product. I see blank white page.

 

# Time: 170302 22:19:43
# User@Host: host [host] @  [192.168.45.12]
# Thread_id: 146  Schema: secretlashes.pl  QC_hit: No
# Query_time: 19.600707  Lock_time: 0.016750  Rows_sent: 10  Rows_examined: 5506747
SET timestamp=1488489583;
SELECT DISTINCT od.product_id, pl.name, pl.description_short, pl.link_rewrite, p.reference, i.id_image, product_shop.show_price,
                                                cl.link_rewrite category, p.ean13, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity
                                        FROM ps_order_detail od
                                        LEFT JOIN ps_product p ON (p.id_product = od.product_id)
                                         INNER JOIN ps_product_shop product_shop
                ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)LEFT JOIN `ps_product_attribute` pa
                                        ON (p.`id_product` = pa.`id_product`)
                                         LEFT JOIN ps_product_attribute_shop product_attribute_shop
                ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)
                                         LEFT
                        JOIN ps_stock_available stock
                        ON (stock.id_product = p.id_product AND stock.id_product_attribute = IFNULL(`product_attribute_shop`.id_product_attribute, 0) AND stock.id_shop = 1  AND stock.id_shop_group = 0  )
                                        LEFT JOIN ps_product_lang pl ON (pl.id_product = od.product_id AND pl.id_shop = 1 )
                                        LEFT JOIN ps_category_lang cl ON (cl.id_category = product_shop.id_category_default AND cl.id_shop = 1 )
                                        LEFT JOIN ps_image i ON (i.id_product = od.product_id)

                                        LEFT JOIN `ps_category_product` cp ON (cp.`id_category` = product_shop.id_category_default
                                                AND cp.id_product = product_shop.id_product)
                                        LEFT JOIN `ps_category_group` cg ON (cp.`id_category` = cg.`id_category`)
                                        WHERE od.id_order IN

 

 

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