- Автор темы
- #1
Создал сайт. Магазин растет и вот уже вырос до 10 000 товаров.
И сейчас начала время от времени появляться ошибка 503.
В тесте хостинга показало что медленные запросы к БД Для просмотра ссылки Войдиили Зарегистрируйся
Вот на эти запросы жалуется
№1
Жалоба №2
Жалоба №3
Может кто то сталкивался с такими проблемами, помогите пожалуйста...
И сейчас начала время от времени появляться ошибка 503.
В тесте хостинга показало что медленные запросы к БД Для просмотра ссылки Войди
Вот на эти запросы жалуется
№1
Код:
SELECT
`a`.`attribute_id`,
REPLACE(REPLACE(TRIM(pa.text), '
', ''), '
', '') AS `txt`,
`ad`.`name`,
`ad`.`mf_tooltip` AS `tooltip`,
`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`
INNER JOIN
`oc_category_path` AS `cp`
ON
`cp`.`category_id` = `p2c`.`category_id`
WHERE
`p`.`date_available` <= NOW() AND `p`.`status` = '1' AND `cp`.`path_id` IN(301)
GROUP BY
`txt`, `pa`.`attribute_id`
HAVING
`txt` != ''
ORDER BY
`txt`
Жалоба №2
Код:
SELECT
REPLACE(REPLACE(`text`, '
', ''), '
', '') AS `text`, `attribute_id`, COUNT( DISTINCT `tmp`.`product_id` ) AS `total`
FROM(
SELECT
`pa`.`attribute_id`,`p`.`product_id`,`pa`.`text`
FROM
`oc_product` AS `p`
INNER JOIN
`oc_product_attribute` AS `pa`
ON
`pa`.`product_id` = `p`.`product_id` AND `pa`.`language_id` = '2'
INNER JOIN
`oc_product_to_store` AS `p2s`
ON
`p2s`.`product_id` = `p`.`product_id` AND `p2s`.`store_id` = 0
INNER JOIN
`oc_product_to_category` AS `p2c`
ON
`p2c`.`product_id` = `p`.`product_id`
INNER JOIN
`oc_category_path` AS `cp`
ON
`cp`.`category_id` = `p2c`.`category_id`
WHERE
`p`.`date_available` <= NOW() AND `p`.`status` = '1' AND `cp`.`path_id` IN(325)
) AS `tmp`
GROUP BY
`text`, `attribute_id`
Жалоба №3
Код:
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 ((p.price - ps.price) / (p.price / 100)) 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_percent, (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_category_path cp LEFT JOIN oc_product_to_category p2c ON (cp.category_id = p2c.category_id) 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.date_available <= NOW() AND p2s.store_id = '0' AND cp.path_id = '301' GROUP BY p.product_id ORDER BY p.price = 0, p.quantity = 0, p.price ASC, LCASE(pd.name) ASC LIMIT 768,32
Может кто то сталкивался с такими проблемами, помогите пожалуйста...