Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Медленные запросы от Ocfilter что делать ?


Recommended Posts

SET timestamp=1540805733;
# Query_time: 1.707224  Lock_time: 0.000562  Rows_sent: 25  Rows_examined: 808258

SELECT value_id, option_id, total FROM (SELECT p.manufacturer_id AS value_id, 'm' AS option_id, COUNT(p.manufacturer_id) AS total FROM oc_product p LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id) WHERE p.status = '1' AND p2c.category_id = '82' AND p.product_id IN(SELECT oov2p1.product_id FROM oc_ocfilter_option_value_to_product oov2p1 INNER JOIN oc_ocfilter_option_value_to_product oov2p2 ON (oov2p1.product_id = oov2p2.product_id) WHERE oov2p1.option_id = '30425' AND (oov2p1.value_id = '1742734348' OR oov2p1.value_id = '2076164755') AND oov2p2.option_id = '30454' AND (oov2p2.value_id = '1093219734')) GROUP BY p.manufacturer_id UNION ALL SELECT p.stock_status_id AS value_id, 's' AS option_id, COUNT(p.stock_status_id) AS total FROM oc_product p LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id) WHERE p.status = '1' AND p2c.category_id = '82' AND (p.manufacturer_id = '66') AND p.product_id IN(SELECT oov2p1.product_id FROM oc_ocfilter_option_value_to_product oov2p1 INNER JOIN oc_ocfilter_option_value_to_product oov2p2 ON (oov2p1.product_id = oov2p2.product_id) WHERE oov2p1.option_id = '30425' AND (oov2p1.value_id = '1742734348' OR oov2p1.value_id = '2076164755') AND oov2p2.option_id = '30454' AND (oov2p2.value_id = '1093219734')) GROUP BY p.stock_status_id UNION ALL SELECT oov2p.value_id, oov2p.option_id, COUNT(p.product_id) AS total FROM oc_ocfilter_option_value_to_product oov2p LEFT JOIN oc_product_to_category p2c ON (oov2p.product_id = p2c.product_id) LEFT JOIN oc_product p ON (oov2p.product_id = p.product_id) WHERE oov2p.value_id > '0' AND p.status = '1' AND p2c.category_id = '82' AND (p.manufacturer_id = '66') AND p.product_id IN(SELECT oov2p1.product_id FROM oc_ocfilter_option_value_to_product oov2p1 INNER JOIN oc_ocfilter_option_value_to_product oov2p2 ON (oov2p1.product_id = oov2p2.product_id) WHERE oov2p1.option_id = '30425' AND (oov2p1.value_id = '1742734348' OR oov2p1.value_id = '2076164755') AND oov2p2.option_id = '30454' AND (oov2p2.value_id = '1093219734')) GROUP BY oov2p.option_id, oov2p.value_id UNION ALL SELECT oov2p.value_id, oov2p.option_id, COUNT(p.product_id) AS total FROM oc_product p LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN oc_ocfilter_option_value_to_product oov2p ON (p.product_id = oov2p.product_id) WHERE oov2p.option_id = '30425' AND p.status = '1' AND p2c.category_id = '82' AND (p.manufacturer_id = '66') AND p.product_id IN(SELECT oov2p1.product_id FROM oc_ocfilter_option_value_to_product oov2p1 WHERE oov2p1.option_id = '30454' AND (oov2p1.value_id = '1093219734')) GROUP BY oov2p.option_id, oov2p.value_id UNION ALL SELECT oov2p.value_id, oov2p.option_id, COUNT(p.product_id) AS total FROM oc_product p LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN oc_ocfilter_option_value_to_product oov2p ON (p.product_id = oov2p.product_id) WHERE oov2p.option_id = '30454' AND p.status = '1' AND p2c.category_id = '82' AND (p.manufacturer_id = '66') AND p.product_id IN(SELECT oov2p1.product_id FROM oc_ocfilter_option_value_to_product oov2p1 WHERE oov2p1.option_id = '30425' AND (oov2p1.value_id = '1742734348' OR oov2p1.value_id = '2076164755')) GROUP BY oov2p.option_id, oov2p.value_id) results LIMIT 0, 25;

Надіслати
Поділитися на інших сайтах

Спойлер

SELECT value_id,
       option_id,
       total
FROM
  (SELECT p.manufacturer_id AS value_id,
          'm' AS option_id,
          COUNT(p.manufacturer_id) AS total
   FROM oc_product p
   LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id)
   WHERE p.status = '1'
     AND p2c.category_id = '82'
     AND p.product_id IN
       (SELECT oov2p1.product_id
        FROM oc_ocfilter_option_value_to_product oov2p1
        INNER JOIN oc_ocfilter_option_value_to_product oov2p2 ON (oov2p1.product_id = oov2p2.product_id)
        WHERE oov2p1.option_id = '30425'
          AND (oov2p1.value_id = '1742734348'
               OR oov2p1.value_id = '2076164755')
          AND oov2p2.option_id = '30454'
          AND (oov2p2.value_id = '1093219734'))
   GROUP BY p.manufacturer_id
   UNION ALL SELECT p.stock_status_id AS value_id,
                    's' AS option_id,
                    COUNT(p.stock_status_id) AS total
   FROM oc_product p
   LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id)
   WHERE p.status = '1'
     AND p2c.category_id = '82'
     AND (p.manufacturer_id = '66')
     AND p.product_id IN
       (SELECT oov2p1.product_id
        FROM oc_ocfilter_option_value_to_product oov2p1
        INNER JOIN oc_ocfilter_option_value_to_product oov2p2 ON (oov2p1.product_id = oov2p2.product_id)
        WHERE oov2p1.option_id = '30425'
          AND (oov2p1.value_id = '1742734348'
               OR oov2p1.value_id = '2076164755')
          AND oov2p2.option_id = '30454'
          AND (oov2p2.value_id = '1093219734'))
   GROUP BY p.stock_status_id
   UNION ALL SELECT oov2p.value_id,
                    oov2p.option_id,
                    COUNT(p.product_id) AS total
   FROM oc_ocfilter_option_value_to_product oov2p
   LEFT JOIN oc_product_to_category p2c ON (oov2p.product_id = p2c.product_id)
   LEFT JOIN oc_product p ON (oov2p.product_id = p.product_id)
   WHERE oov2p.value_id > '0'
     AND p.status = '1'
     AND p2c.category_id = '82'
     AND (p.manufacturer_id = '66')
     AND p.product_id IN
       (SELECT oov2p1.product_id
        FROM oc_ocfilter_option_value_to_product oov2p1
        INNER JOIN oc_ocfilter_option_value_to_product oov2p2 ON (oov2p1.product_id = oov2p2.product_id)
        WHERE oov2p1.option_id = '30425'
          AND (oov2p1.value_id = '1742734348'
               OR oov2p1.value_id = '2076164755')
          AND oov2p2.option_id = '30454'
          AND (oov2p2.value_id = '1093219734'))
   GROUP BY oov2p.option_id,
            oov2p.value_id
   UNION ALL SELECT oov2p.value_id,
                    oov2p.option_id,
                    COUNT(p.product_id) AS total
   FROM oc_product p
   LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id)
   LEFT JOIN oc_ocfilter_option_value_to_product oov2p ON (p.product_id = oov2p.product_id)
   WHERE oov2p.option_id = '30425'
     AND p.status = '1'
     AND p2c.category_id = '82'
     AND (p.manufacturer_id = '66')
     AND p.product_id IN
       (SELECT oov2p1.product_id
        FROM oc_ocfilter_option_value_to_product oov2p1
        WHERE oov2p1.option_id = '30454'
          AND (oov2p1.value_id = '1093219734'))
   GROUP BY oov2p.option_id,
            oov2p.value_id
   UNION ALL SELECT oov2p.value_id,
                    oov2p.option_id,
                    COUNT(p.product_id) AS total
   FROM oc_product p
   LEFT JOIN oc_product_to_category p2c ON (p.product_id = p2c.product_id)
   LEFT JOIN oc_ocfilter_option_value_to_product oov2p ON (p.product_id = oov2p.product_id)
   WHERE oov2p.option_id = '30454'
     AND p.status = '1'
     AND p2c.category_id = '82'
     AND (p.manufacturer_id = '66')
     AND p.product_id IN
       (SELECT oov2p1.product_id
        FROM oc_ocfilter_option_value_to_product oov2p1
        WHERE oov2p1.option_id = '30425'
          AND (oov2p1.value_id = '1742734348'
               OR oov2p1.value_id = '2076164755'))
   GROUP BY oov2p.option_id,
            oov2p.value_id) results
LIMIT 0,
      25;

 

https://sqlformat.org/

;)

 

У вас идет перебор по всей базе ( Rows_examined: 808258 )
Индексы не используются
Вы обращались к автору ocfilter ?

Надіслати
Поділитися на інших сайтах

  • Tom locked this topic
Гість
Ця тема закрита для публікації повідомлень.
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.