Jump to content

Медленный запрос в базу


Recommended Posts

Хостинг жалуется, что производится очень долгий запрос в базу и отключил меня до решения проблемы. Вопрос что это за запрос и как его можно оптимизировать или решить эту проблему.

use gb_motodef;
SET timestamp=1405498465;
SELECT
				p.*,
				product_shop.*,
				product_shop.id_category_default,
				pl.*,
				MAX(image_shop.`id_image`) id_image,
				il.legend, 
				m.name manufacturer_name,
				MAX(product_attribute_shop.id_product_attribute) id_product_attribute,

				DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(), INTERVAL 180
DAY)) > 0 AS new,
				stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity
			FROM `ps_category_product` cp
			LEFT JOIN ps_category c ON (c.id_category = cp.id_category)
			LEFT JOIN `ps_product` p ON p.`id_product` = cp.`id_product`
			 INNER JOIN ps_product_shop product_shop
		ON (product_shop.id_product = p.id_product AND product_shop.id_shop
= 1)
			 LEFT 
			JOIN ps_stock_available stock
			ON (stock.id_product = p.id_product AND stock.id_shop = 1  )
			LEFT JOIN ps_product_lang pl ON (pl.id_product = p.id_product AND
pl.id_shop = 1  AND pl.id_lang = 2)
			LEFT JOIN `ps_image` i  ON (i.`id_product` = p.`id_product`) LEFT
JOIN ps_image_shop image_shop
		ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND
image_shop.cover=1)
			LEFT JOIN `ps_image_lang` il ON (image_shop.`id_image` = il.`id_image`
AND il.`id_lang` = 2)
			LEFT JOIN ps_manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
			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)
			WHERE product_shop.`active` = 1 AND product_shop.`visibility` IN
("both", "catalog")
			AND c.nleft >= 4 AND c.nright <= 51
			AND c.active = 1
			AND p.id_product IN (22,25,28,29,31,105,107,108,109,110,111,112,
113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,132,
133,134,136,137,138,139,140,141,142,143,144,148,154,155,156,175,263,
264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,
281,282,283,285,286,289,290,291,292,293,294,370,403,404,405,406,407,
408,409,411,412,414,415,416,419,420,421,422,423,424,425,426,427,428,
429,430,431,433,434,435,436,437,438,439,440,441,442,443,445,446,447,
448,449,450,451,452,453,455,456,457,458,459,460,461,462,463,464,465,
466,467,468,469,470,471,472,473,475,476,477,478,479,480,481,483,484,
486,487,488,489,490,491,492,535,538,539,561,562,563,564,565,566,567,
568,569,570,571,580,581,582,591,592,593,594,595,596,597,599,600,645,
646,647,648,649,650,651,652,653,654,655,656,657,658,660,661,662,664,
665,666,667,671,672,673,674,675,678,679,681,682,685,686,687,690,695,
696,697,698,700,701,702,710,711,712,713,714,715,716,717,718,719,720,
722,724,725,726,727,728,729,732,733,734,735,736,737,738,739,740,741,
742,743,744,745,746,747,748,749,750,751,752,753,754,756,757,758,759,
760,762,763,764,768,774,775,781,783,784,785,786,787,788,789,791,792,
793,794,795,796,797,798,805,806,807,808,809,811,812,813,815,816,817,
818,819,820,821,823,824,825,826,827,831,833,836,838,878,880,881,882,
883,884,885,886,887,888,890)
			GROUP BY product_shop.id_product
			ORDER BY quantity desc LIMIT 0,12;
Link to comment
Share on other sites

Меняйте хостинг.

1. Обновите модуль на более новый если есть.

2. Уменьшите время новых товаров

3. Уменьшите кол-во вывода товаров

 

Я так понял модуль на главной висит

Link to comment
Share on other sites

Это модуль многоуровневой навигации.

В настройках можно отключить использование свойств и комбинаций

Link to comment
Share on other sites

Лучше хостинг поменять) если даже шаред ваш выбор, плачу за jino.ru 192р в месяц и че я там тока не делал не кто не писал мне что у меня медленные запросы..

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