Slow Queries - Database Error

We have been getting a number of database errors lately and have been investigating and can not find the cause of this. Any help would be appreciated.

I have been checking on Mysql and sometimes these queries will go on for over 60 seconds.

We are in a shared hosting environment but surely this will not cause such a poor performance, considering we have a low volume of traffic. This is a new installation of 4.20 and our old installation on the same server with CS Cart 2.14 did not have any of these issues.

Sometimes these errors occur before/after a user is placing an order but other times it happens randomly in the middle of the night. Usually it will be a burst of errors for around 30 mins and then it stops only to continue after a few hours.

Error:[color=#333333] [/color][color=#333333]Query execution was interrupted (1317)[/color]

Query:[color=#333333] [/color][color=#333333]SELECT SQL_CALC_FOUND_ROWS products.*, descr1.product as product, MIN(IF(prices.percentage_discount = 0, prices.price, prices.price - (prices.price * prices.percentage_discount)/100)) as price, descr1.short_description, IF(descr1.short_description = ‘’, descr1.full_description, ‘’) as full_description, GROUP_CONCAT(IF(products_categories.link_type = ‘M’, CONCAT(products_categories.category_id, ‘M’), products_categories.category_id)) as category_ids, products_categories.position, IF(shared_descr.product_id IS NOT NULL, shared_descr.product, descr1.product) as product, IF(shared_descr.product_id IS NOT NULL, shared_descr.short_description, descr1.short_description) as short_description, IF(shared_descr.product_id IS NOT NULL, IF(shared_descr.short_description = ‘’, shared_descr.full_description, ‘’), IF(descr1.short_description = ‘’, descr1.full_description, ‘’)) as full_description, IF(shared_descr.product_id IS NOT NULL, shared_descr.meta_keywords, descr1.meta_keywords) as meta_keywords, IF(shared_descr.product_id IS NOT NULL, shared_descr.meta_description, descr1.meta_description) as meta_description, IF(shared_descr.product_id IS NOT NULL, shared_descr.search_words, descr1.search_words) as search_words, IF(shared_descr.product_id IS NOT NULL, shared_descr.promo_text, descr1.promo_text) as promo_text, IF(shared_prices.product_id IS NOT NULL,MIN(IF(shared_prices.percentage_discount = 0, shared_prices.price, shared_prices.price - (shared_prices.price * shared_prices.percentage_discount)/100)),MIN(IF(prices.percentage_discount = 0, prices.price, prices.price - (prices.price * prices.percentage_discount)/100))) as price, as seo_name, cscart_seo_names.path as seo_path, AVG(cscart_discussion_rating.rating_value) AS average_rating FROM cscart_products as products LEFT JOIN cscart_product_features_values ON cscart_product_features_values.product_id = products.product_id AND cscart_product_features_values.lang_code = ‘en’ LEFT JOIN cscart_product_features_values as var_val_2_1 ON var_val_2_1.product_id = products.product_id AND var_val_2_1.lang_code = ‘en’ LEFT JOIN cscart_product_features_values as var_val_2_2 ON var_val_2_2.product_id = products.product_id AND var_val_2_2.lang_code = ‘en’ LEFT JOIN cscart_product_features_values as var_val_2_3 ON var_val_2_3.product_id = products.product_id AND var_val_2_3.lang_code = ‘en’ LEFT JOIN cscart_product_features_values as var_val_2_6 ON var_val_2_6.product_id = products.product_id AND var_val_2_6.lang_code = ‘en’ LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id AND descr1.lang_code = ‘en’ LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id AND prices.lower_limit = 1 INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id AND (cscart_categories.usergroup_ids = ‘’ OR FIND_IN_SET(0, cscart_categories.usergroup_ids) OR FIND_IN_SET(1, cscart_categories.usergroup_ids)) AND cscart_categories.status IN (‘A’, ‘H’) LEFT JOIN cscart_ult_product_descriptions shared_descr ON shared_descr.product_id = products.product_id AND shared_descr.company_id = 1 AND shared_descr.lang_code = ‘en’ LEFT JOIN cscart_ult_product_prices as shared_prices ON shared_prices.product_id = products.product_id AND shared_prices.lower_limit = 1 AND shared_prices.usergroup_id IN (0, 0, 1) AND shared_prices.company_id = 1 LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = products.product_id AND cscart_seo_names.type = ‘p’ AND cscart_seo_names.dispatch = ‘’ AND cscart_seo_names.lang_code = ‘en’ AND ( cscart_seo_names.company_id = 1 OR cscart_seo_names.company_id = 0) LEFT JOIN cscart_discussion ON cscart_discussion.object_id = products.product_id AND cscart_discussion.object_type = ‘P’ AND cscart_discussion.company_id = 1 LEFT JOIN cscart_discussion_rating ON cscart_discussion.thread_id = cscart_discussion_rating.thread_id LEFT JOIN cscart_discussion_posts ON cscart_discussion_posts.post_id = cscart_discussion_rating.post_id AND cscart_discussion_posts.status = ‘A’ WHERE 1 AND ((var_val_2_1.value_int >= 400 AND var_val_2_1.value_int <= 499 AND var_val_2_1.value = ‘’ AND var_val_2_1.feature_id = 11) OR (var_val_2_2.value_int >= 500 AND var_val_2_2.value_int <= 699 AND var_val_2_2.value = ‘’ AND var_val_2_2.feature_id = 11) OR (var_val_2_3.value_int >= 0 AND var_val_2_3.value_int <= 99 AND var_val_2_3.value = ‘’ AND var_val_2_3.feature_id = 11) OR (var_val_2_6.value_int >= 300 AND var_val_2_6.value_int <= 399 AND var_val_2_6.value = ‘’ AND var_val_2_6.feature_id = 11)) AND cscart_categories.category_id IN (16) AND cscart_categories.company_id = 1 AND (products.usergroup_ids = ‘’ OR FIND_IN_SET(0, products.usergroup_ids) OR FIND_IN_SET(1, products.usergroup_ids)) AND products.status IN (‘A’) AND prices.usergroup_id IN (0, 0, 1) GROUP BY products.product_id ORDER BY descr1.product desc LIMIT 0, 48[/color]

It may not be you that is slowing down the DB on your shared hosting environment. That's why most experienced users of cs-cart recommend that you use a VPS so you have more control over your environment. Would you share 3 parking spaces in your brick-n-mortar business with 20 other businesses?