Есть магазин на OpenCart 1.5.5.1 на нем 60к товаров, тормозит из-за некоторых запросов к базе данных, запросы нашел но что с ними делать не знаю, помогите пожалуйста.
# Query_time: 9.269401 Lock_time: 0.000231 Rows_sent: 2543 Rows_examined: 5897138
SET timestamp=1458140957;
SELECT
`a`.`attribute_id`,
', ''), ' REPLACE(REPLACE(TRIM(pa.text), '
', '') AS `txt`,
`ad`.`name`,
`agd`.`name` AS `gname`,
`agd`.`attribute_group_id`
FROM
`oc_product` AS `p`
INNER JOIN
`oc_product_to_store` AS `pts`
ON
`p`.`product_id` = `pts`.`product_id` AND `pts`.`store_id` = 0
INNER JOIN
`oc_product_attribute` AS `pa`
ON
`p`.`product_id` = `pa`.`product_id` AND `pa`.`language_id` = 2
INNER JOIN
`oc_attribute` AS `a`
ON
`a`.`attribute_id` = `pa`.`attribute_id`
INNER JOIN
`oc_attribute_description` AS `ad`
ON
`ad`.`attribute_id` = `a`.`attribute_id` AND `ad`.`language_id` = 2
INNER JOIN
`oc_attribute_group` AS `ag`
ON
`ag`.`attribute_group_id` = `a`.`attribute_group_id`
INNER JOIN
`oc_attribute_group_description` AS `agd`
ON
`agd`.`attribute_group_id` = `ag`.`attribute_group_id` AND `agd`.`language_id` = 2
INNER JOIN
`oc_product_to_category` AS `p2c`
ON
`p2c`.`product_id` = `p`.`product_id`
WHERE
`p`.`date_available` <= NOW() AND `p`.`status` = '1' AND `p2c`.`category_id` = '1761'
GROUP BY
`txt`, `pa`.`attribute_id`
HAVING
`txt` != ''
ORDER BY
`a`.`sort_order`,
`txt`;
# Time: 160316 17:07:58
# User@Host: e31461_cshina[e31461_cshina] @ localhost []
# Query_time: 3.587547 Lock_time: 0.000493 Rows_sent: 36 Rows_examined: 124851
use e31461_cshina;
SET timestamp=1458140878;
SELECT * FROM(SELECT p.product_id, (SELECT AVG(rating) AS total FROM oc_review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM oc_product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '1' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM oc_product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '1' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special FROM oc_product_to_category p2c LEFT JOIN oc_product p ON (p2c.product_id = p.product_id) LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) LEFT JOIN oc_product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '2' AND p.status = '1' AND p.quantity > 0 AND p.date_available <= NOW() AND p2s.store_id = '0' AND p2c.category_id = '1755' GROUP BY p.product_id ORDER BY (CASE WHEN special IS NOT NULL THEN special WHEN discount IS NOT NULL THEN discount ELSE p.price END) ASC, LCASE(pd.name) ASC ) AS `tmp` WHERE `product_id` IN(
SELECT
`product_id`
FROM
`oc_product_attribute`
WHERE
', ''), ' ( REPLACE(REPLACE(REPLACE(`text`, ' ', ''), '
', ''), 'KE REPLACE(REPLACE(REPLACE('Склад Саки', ' ', ''), '
', ''), ' REPLACE(REPLACE(REPLACE(`text`, ' ', ''), '
', ''), 'KE REPLACE(REPLACE(REPLACE('Склад Симферополь', ' ', ''), '
', '') ) AND
`language_id` = 2 AND
`attribute_id` = 41
) LIMIT 0,36;