Закажите услуги фрилансеров для вашего проекта прямо сейчас!

Размещение заказа на фриланс бирже бесплатно.

5 дней назад
Посевин
32 года, Россия
11 лет в сервисе
Был онлайн 19 часов назад
33 отзыва
100% фрилансеров рекомендуют 19% заказов с выбором исполнителя
5 дней назад

Приветствую
Интернет-магазин на Битриксе вдруг стал сильно нагружать сервер и тормозить.
Причем раньше такого небыло.  Бекап сайта на дату когда было все нормально не помог. 
Трафик на сайт обычный 100-200 человек в день.
Тех поддержка хостинга  проанализировала , говорит что  много запросов на БД SQL надо оптимизировать или битркис и базу.

Сообщение от поддержки:
mysql> explain SELECT DISTINCT BS.ID AS ID, BS.DEPTH_LEVEL AS DEPTH_LEVEL, BS.NAME AS NAME, B.SECTION_PAGE_URL AS SECTION_PAGE_URL, BS.SORT AS SORT, BS.PICTURE AS PICTURE, BS.DETAIL_PICTURE AS DETAIL_PICTURE, BS.CODE AS CODE, BS.XML_ID AS EXTERNAL_ID, B.IBLOCK_TYPE_ID AS IBLOCK_TYPE_ID, BS.IBLOCK_ID AS IBLOCK_ID, B.CODE AS IBLOCK_CODE, B.XML_ID AS IBLOCK_EXTERNAL_ID, BS.GLOBAL_ACTIVE AS GLOBAL_ACTIVE, BS.LEFT_MARGIN AS LEFT_MARGIN,COUNT(DISTINCT BE.ID) as ELEMENT_CNT, BUF.UF_PHOTO FROM b_iblock_section BS INNER JOIN b_iblock B ON BS.IBLOCK_ID = B.ID LEFT JOIN b_uts_iblock_28_section BUF ON BUF.VALUE_ID = BS.ID INNER JOIN b_iblock_section BSTEMP ON BSTEMP.IBLOCK_ID = BS.IBLOCK_ID LEFT JOIN b_iblock_section_element BSE ON BSE.IBLOCK_SECTION_ID=BSTEMP.ID LEFT JOIN b_iblock_element BE ON (BSE.IBLOCK_ELEMENT_ID=BE.ID AND ((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL ) AND BE.IBLOCK_ID = BS.IBLOCK_ID ) AND BE.ACTIVE='Y' AND (BE.ACTIVE_TO >= now() OR BE.ACTIVE_TO IS NULL) AND (BE.ACTIVE_FROM <= now() OR BE.ACTIVE_FROM IS NULL)) WHERE 1=1 AND BSTEMP.IBLOCK_ID = BS.IBLOCK_ID AND BSTEMP.LEFT_MARGIN >= BS.LEFT_MARGIN AND BSTEMP.RIGHT_MARGIN <= BS.RIGHT_MARGIN AND BSTEMP.GLOBAL_ACTIVE = 'Y' AND ((((BS.IBLOCK_ID = '28')))) AND ((((BS.GLOBAL_ACTIVE='Y')))) AND ((((BS.DEPTH_LEVEL <= '3')))) AND ((((B.ID = '28')))) AND ((((B.ACTIVE='Y')))) AND (( B.ID IN ( SELECT IBLOCK_ID FROM b_iblock_group IBG WHERE IBG.GROUP_ID IN (2) AND IBG.PERMISSION >= 'R' AND (IBG.PERMISSION='X' OR B.ACTIVE='Y') ) OR (B.RIGHTS_MODE = 'E' AND EXISTS ( SELECT SR.SECTION_ID FROM b_iblock_section_right SR INNER JOIN b_iblock_right IBR ON IBR.ID = SR.RIGHT_ID INNER JOIN b_user_access UA ON UA.ACCESS_CODE = IBR.GROUP_CODE AND UA.USER_ID = 0 WHERE SR.SECTION_ID = BS.ID AND IBR.OP_SREAD = 'Y' )) )) GROUP BY BS.ID, B.ID ORDER BY BS.LEFT_MARGIN asc;
+----+--------------------+--------+------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------+-----------------------------+---------+--------------------------------------+------+----------+----------------------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+--------+------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------+-----------------------------+---------+--------------------------------------+------+----------+----------------------------------------------------+
| 1 | PRIMARY | B | NULL | const | PRIMARY | PRIMARY | 4 | const | 1 | 100.00 | Using temporary; Using filesort |
| 1 | PRIMARY | BS | NULL | ref | ix_iblock_section_1,ix_iblock_section_depth_level,ix_iblock_section_left_margin,ix_iblock_section_right_margin,ix_iblock_section_code | ix_iblock_section_1 | 4 | const | 1417 | 3.33 | Using index condition; Using where |
Aleksey Posevin,

| 1 | PRIMARY | BUF | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.BS.ID | 1 | 100.00 | NULL |
| 1 | PRIMARY | BSTEMP | NULL | ALL | ix_iblock_section_1,ix_iblock_section_depth_level,ix_iblock_section_left_margin,ix_iblock_section_right_margin,ix_iblock_section_code | NULL | NULL | NULL | 1250 | 1.11 | Using where; Using join buffer (Block Nested Loop) |
| 1 | PRIMARY | BSE | NULL | ref | ux_iblock_section_element | ux_iblock_section_element | 4 | iceholodse_ice.BSTEMP.ID | 29 | 100.00 | Using index |
| 1 | PRIMARY | BE | NULL | eq_ref | PRIMARY,ix_iblock_element_1,ix_iblock_element_4,ix_iblock_element_3,ix_iblock_element_code | PRIMARY | 4 | iceholodse_ice.BSE.IBLOCK_ELEMENT_ID | 1 | 100.00 | Using where |
| 3 | DEPENDENT SUBQUERY | SR | NULL | ref | PRIMARY,ix_b_iblock_section_right_1 | ix_b_iblock_section_right_1 | 4 | iceholodse_ice.BS.ID | 1 | 100.00 | Using index |
| 3 | DEPENDENT SUBQUERY | IBR | NULL | eq_ref | PRIMARY,ix_b_iblock_right_group_code,ix_b_iblock_right_op_eread,ix_b_iblock_right_op_sread | PRIMARY | 4 | iceholodse_ice.SR.RIGHT_ID | 1 | 100.00 | Using where |
| 3 | DEPENDENT SUBQUERY | UA | NULL | ref | ix_ua_user_provider,ix_ua_user_access,ix_ua_access | ix_ua_user_provider | 5 | const | 1 | 10.00 | Using where |
| 2 | DEPENDENT SUBQUERY | IBG | NULL | unique_subquery | ux_iblock_group_1 | ux_iblock_group_1 | 8 | func,const | 1 | 33.33 | Using where |
+----+--------------------+--------+------------+-----------------+---------------------------------------------------------------------------------------------------------------------------------------+-----------------------------+---------+--------------------------------------+------+----------+----------------------------------------------------+

Они отправляются при открытии сайта и переходах между страницами и каждый обходит по 2-3 тысячи строк. Это вызывает нагрузку на MySQL, что в свою очередь создаёт нагрузку на процессор.

mysql> explain SELECT BE.ID as ID,BE.NAME as NAME,BE.IBLOCK_ID as IBLOCK_ID,B.DETAIL_PAGE_URL as DETAIL_PAGE_URL,BE.IBLOCK_SECTION_ID as IBLOCK_SECTION_ID,L.DIR as LANG_DIR,BE.CODE as CODE,BE.XML_ID as EXTERNAL_ID,B.IBLOCK_TYPE_ID as IBLOCK_TYPE_ID,B.CODE as IBLOCK_CODE,B.XML_ID as IBLOCK_EXTERNAL_ID,B.LID as LID , CAT_PR.QUANTITY as CATALOG_QUANTITY, IF (CAT_PR.QUANTITY_TRACE = 'D', 'N', CAT_PR.QUANTITY_TRACE) as CATALOG_QUANTITY_TRACE, CAT_PR.QUANTITY_TRACE as CATALOG_QUANTITY_TRACE_ORIG, CAT_PR.WEIGHT as CATALOG_WEIGHT, CAT_PR.VAT_ID as CATALOG_VAT_ID, CAT_PR.VAT_INCLUDED as CATALOG_VAT_INCLUDED, IF (CAT_PR.CAN_BUY_ZERO = 'D', 'N', CAT_PR.CAN_BUY_ZERO) as CATALOG_CAN_BUY_ZERO, CAT_PR.CAN_BUY_ZERO as CATALOG_CAN_BUY_ZERO_ORIG, CAT_PR.PURCHASING_PRICE as CATALOG_PURCHASING_PRICE, CAT_PR.PURCHASING_CURRENCY as CATALOG_PURCHASING_CURRENCY, CAT_PR.QUANTITY_RESERVED as CATALOG_QUANTITY_RESERVED, IF (CAT_PR.SUBSCRIBE = 'D', 'Y', CAT_PR.SUBSCRIBE) as CATALOG_SUBSCRIBE, CAT_PR.SUBSCRIBE as CATALOG_SUBSCRIBE_ORIG, CAT_PR.WIDTH as CATALOG_WIDTH, CAT_PR.LENGTH as CATALOG_LENGTH, CAT_PR.HEIGHT as CATALOG_HEIGHT, CAT_PR.MEASURE as CATALOG_MEASURE, CAT_PR.TYPE as CATALOG_TYPE, CAT_PR.AVAILABLE as CATALOG_AVAILABLE, CAT_PR.BUNDLE as CATALOG_BUNDLE, CAT_PR.PRICE_TYPE as CATALOG_PRICE_TYPE, CAT_PR.RECUR_SCHEME_LENGTH as CATALOG_RECUR_SCHEME_LENGTH, CAT_PR.RECUR_SCHEME_TYPE as CATALOG_RECUR_SCHEME_TYPE, CAT_PR.TRIAL_PRICE_ID as CATALOG_TRIAL_PRICE_ID, CAT_PR.WITHOUT_ORDER as CATALOG_WITHOUT_ORDER, CAT_PR.SELECT_BEST_PRICE as CATALOG_SELECT_BEST_PRICE, IF (CAT_PR.NEGATIVE_AMOUNT_TRACE = 'D', 'N', CAT_PR.NEGATIVE_AMOUNT_TRACE) as CATALOG_NEGATIVE_AMOUNT_TRACE, CAT_PR.NEGATIVE_AMOUNT_TRACE as CATALOG_NEGATIVE_AMOUNT_TRACE_ORIG, CAT_VAT.RATE as CATALOG_VAT FROM b_iblock B INNER JOIN b_lang L ON B.LID=L.LID INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID left join b_catalog_product as CAT_PR on (CAT_PR.ID = BE.ID) left join b_catalog_iblock as CAT_IB on ((CAT_PR.VAT_ID IS NULL or CAT_PR.VAT_ID = 0) and CAT_IB.IBLOCK_ID = BE.IBLOCK_ID) left join b_catalog_vat as CAT_VAT on (CAT_VAT.ID = IF((CAT_PR.VAT_ID IS NULL OR CAT_PR.VAT_ID = 0), CAT_IB.VAT_ID, CAT_PR.VAT_ID)) WHERE 1=1 AND ( ((((BE.ACTIVE='Y')))) AND ( ( ( (BE.ID IN ( SELECT FPV0.VALUE_NUM FROM b_iblock B INNER JOIN b_lang L ON B.LID=L.LID INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID LEFT JOIN b_iblock_property FP0 ON FP0.IBLOCK_ID = B.ID AND FP0.CODE='CML2_LINK' LEFT JOIN b_iblock_element_property FPV0 ON FPV0.IBLOCK_PROPERTY_ID = FP0.ID AND FPV0.IBLOCK_ELEMENT_ID = BE.ID left join b_catalog_product as CAT_PR on (CAT_PR.ID = BE.ID) left join b_catalog_iblock as CAT_IB on ((CAT_PR.VAT_ID IS NULL or CAT_PR.VAT_ID = 0) and CAT_IB.IBLOCK_ID = BE.IBLOCK_ID) left join b_catalog_vat as CAT_VAT on (CAT_VAT.ID = IF((CAT_PR.VAT_ID IS NULL OR CAT_PR.VAT_ID = 0), CAT_IB.VAT_ID, CAT_PR.VAT_ID)) WHERE 1=1 AND ( (((BE.ACTIVE_TO >= now() OR BE.ACTIVE_TO IS NULL) AND (BE.ACTIVE_FROM <= now() OR BE.ACTIVE_FROM IS NULL))) AND ((((BE.ACTIVE='Y')))) AND ((((CAT_PR.AVAILABLE='Y')))) ) AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL))) AND (((FPV0.VALUE_NUM IS NOT NULL))) )) ) OR ( ( (BE.ID NOT IN ( SELECT FPV0.VALUE_NUM FROM b_iblock B INNER JOIN b_lang L ON B.LID=L.LID INNER JOIN b_iblock_element BE ON BE.IBLOCK_ID = B.ID LEFT JOIN b_iblock_property FP0 ON FP0.IBLOCK_ID = B.ID AND FP0.CODE='CML2_LINK' LEFT JOIN b_iblock_element_property FPV0 ON FPV0.IBLOCK_PROPERTY_ID = FP0.ID AND FPV0.IBLOCK_ELEMENT_ID = BE.ID WHERE 1=1 AND ( (((BE.ID IS NOT NULL))) ) AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL))) AND (((FPV0.VALUE_NUM IS NOT NULL))) )) ) AND ( ((((CAT_PR.AVAILABLE='Y')))) ) ) ) ) ) AND (((BE.WF_STATUS_ID=1 AND BE.WF_PARENT_ELEMENT_ID IS NULL))) LIMIT 0, 28;
Aleksey Posevin,

+----+--------------------+---------+------------+-------------+--------------------------------------------------------------------------------------------+----------------------------+---------+---------------------------------------+------+----------+----------------------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+---------+------------+-------------+--------------------------------------------------------------------------------------------+----------------------------+---------+---------------------------------------+------+----------+----------------------------------------------------+
| 1 | PRIMARY | L | NULL | ALL | PRIMARY | NULL | NULL | NULL | 1 | 100.00 | NULL |
| 1 | PRIMARY | B | NULL | ALL | PRIMARY | NULL | NULL | NULL | 22 | 10.00 | Using where; Using join buffer (Block Nested Loop) |
| 1 | PRIMARY | BE | NULL | ref | ix_iblock_element_1,ix_iblock_element_4,ix_iblock_element_3,ix_iblock_element_code | ix_iblock_element_1 | 4 | iceholodse_ice.B.ID | 2099 | 0.50 | Using where |
| 1 | PRIMARY | CAT_PR | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.BE.ID | 1 | 100.00 | Using where |
| 1 | PRIMARY | CAT_IB | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.B.ID | 1 | 100.00 | Using where |
| 1 | PRIMARY | CAT_VAT | NULL | ALL | PRIMARY | NULL | NULL | NULL | 3 | 100.00 | Using where; Using join buffer (Block Nested Loop) |
| 3 | DEPENDENT SUBQUERY | L | NULL | index | PRIMARY | PRIMARY | 6 | NULL | 1 | 100.00 | Using index |
| 3 | DEPENDENT SUBQUERY | FP0 | NULL | ref | PRIMARY,ix_iblock_property_1,ix_iblock_property_2 | ix_iblock_property_2 | 153 | const | 2 | 100.00 | Using where |
| 3 | DEPENDENT SUBQUERY | B | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.FP0.IBLOCK_ID | 1 | 10.00 | Using where |
| 3 | DEPENDENT SUBQUERY | FPV0 | NULL | ref_or_null | ix_iblock_element_property_1,ix_iblock_element_property_2,ix_iblock_element_prop_num | ix_iblock_element_prop_num | 14 | func,iceholodse_ice.FP0.ID | 42 | 100.00 | Using index condition; Using where |

| 3 | DEPENDENT SUBQUERY | BE | NULL | eq_ref | PRIMARY,ix_iblock_element_1,ix_iblock_element_4,ix_iblock_element_3,ix_iblock_element_code | PRIMARY | 4 | iceholodse_ice.FPV0.IBLOCK_ELEMENT_ID | 1 | 5.00 | Using where |
| 2 | DEPENDENT SUBQUERY | L | NULL | index | PRIMARY | PRIMARY | 6 | NULL | 1 | 100.00 | Using index |
| 2 | DEPENDENT SUBQUERY | FP0 | NULL | ref | PRIMARY,ix_iblock_property_1,ix_iblock_property_2 | ix_iblock_property_2 | 153 | const | 2 | 100.00 | Using where |
| 2 | DEPENDENT SUBQUERY | B | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.FP0.IBLOCK_ID | 1 | 10.00 | Using where |
| 2 | DEPENDENT SUBQUERY | FPV0 | NULL | ref | ix_iblock_element_property_1,ix_iblock_element_property_2,ix_iblock_element_prop_num | ix_iblock_element_prop_num | 14 | func,iceholodse_ice.FP0.ID | 21 | 100.00 | Using index condition; Using where |
| 2 | DEPENDENT SUBQUERY | CAT_PR | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.FPV0.IBLOCK_ELEMENT_ID | 1 | 10.00 | Using where |
| 2 | DEPENDENT SUBQUERY | BE | NULL | eq_ref | PRIMARY,ix_iblock_element_1,ix_iblock_element_4,ix_iblock_element_3,ix_iblock_element_code | PRIMARY | 4 | iceholodse_ice.FPV0.IBLOCK_ELEMENT_ID | 1 | 5.00 | Using where |
| 2 | DEPENDENT SUBQUERY | CAT_IB | NULL | eq_ref | PRIMARY | PRIMARY | 4 | iceholodse_ice.FP0.IBLOCK_ID | 1 | 100.00 | Using where |
| 2 | DEPENDENT SUBQUERY | CAT_VAT | NULL | eq_ref | PRIMARY | PRIMARY | 4 | func | 1 | 100.00 | Using where; Using index |
+----+--------------------+---------+------------+-------------+--------------------------------------------------------------------------------------------+----------------------------+---------+---------------------------------------+------+----------+----------------------------------------------------+

  1. Прием заявок
  2. Выбор исполнителя
  3. Выполнение заказа
  4. Обмен отзывами
Заявки фрилансеров
2 заявки

Посмотреть заявки можно будет после закрытия заказа.

Другие заказы в категории «Веб-программирование»

Здесь заказчик и фрилансеры могут обсуждать заказ до начала его выполнения.
Фрилансеры могут участвовать в обсуждении только после подачи заявки.
Здесь заказчик будет контролировать выполнение заказа и общаться с исполнителем.
Доступ к этому разделу имеют только заказчик и выбранный исполнитель.
Все материалы этого раздела закрыты от поисковых систем.