I have and issuse with my magento 2 store the server has running this query and make the cpu to high,about 5-800% cpu ,
my server is epyc 7551 and 256gb ram , 250k sku,
Solved! Go to Solution.
I can see related products and you may also like sections on your product pages change on every request, this might be related to that, randomizing what is shown on product page in those blocks.
Does anyone Help?
Thank you,
We can't see the images you uploaded which is why nobody is able to help you.
Hello,
Can you see now?
1345179 | minomog_mage246 | 127.0.0.1:21050 | minomog_mage246 | Query | 1 | Sending data | SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `at_inventory_in_stock`.`is_in_stock` AS `inventory_in_stock`, `stock_status_index`.`stock_status` AS `is_salable` FROM `mgxf_catalog_product_entity` AS `e` INNER JOIN `mgxf_catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN `mgxf_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN `mgxf_cataloginventory_stock_item` AS `at_inventory_in_stock` ON (at_inventory_in_stock.`product_id`=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) INNER JOIN `mgxf_cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id WHERE (`e`.`entity_id` != '63125') AND (stock_status_index.stock_status = 1) ORDER BY rand() ASC LIMIT 4 | 0.000 | | 1345180 | minomog_mage246 | 127.0.0.1:21064 | minomog_mage246 | Query | 0 | Sending data | SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `at_inventory_in_stock`.`is_in_stock` AS `inventory_in_stock`, `stock_status_index`.`stock_status` AS `is_salable` FROM `mgxf_catalog_product_entity` AS `e` INNER JOIN `mgxf_catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN `mgxf_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN `mgxf_cataloginventory_stock_item` AS `at_inventory_in_stock` ON (at_inventory_in_stock.`product_id`=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) INNER JOIN `mgxf_cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id WHERE (`e`.`entity_id` != '233958') AND (stock_status_index.stock_status = 1) ORDER BY rand() ASC LIMIT 4 | 0.000 | | 1345181 | minomog_mage246 | 127.0.0.1:21070 | minomog_mage246 | Query | 0 | Sending data | SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `at_inventory_in_stock`.`is_in_stock` AS `inventory_in_stock`, `stock_status_index`.`stock_status` AS `is_salable` FROM `mgxf_catalog_product_entity` AS `e` INNER JOIN `mgxf_catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN `mgxf_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN `mgxf_cataloginventory_stock_item` AS `at_inventory_in_stock` ON (at_inventory_in_stock.`product_id`=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) INNER JOIN `mgxf_cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id WHERE (`e`.`entity_id` != '82507') AND (stock_status_index.stock_status = 1) ORDER BY rand() ASC LIMIT 4 | 0.000 | | 1345183 | minomog_mage246 | 127.0.0.1:21082 | minomog_mage246 | Query | 0 | Statistics | SELECT `e`.*, `at_inventory_in_stock`.`is_in_stock` AS `inventory_in_stock`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price`, `cat_index`.`position` AS `cat_index_position`, `stock_status_index`.`stock_status` AS `is_salable`, `links`.`link_id`, `links`.`product_id` AS `_linked_to_product_id`, `link_attribute_position_int`.`value` AS `position` FROM `mgxf_catalog_product_entity` AS `e` INNER JOIN `mgxf_cataloginventory_stock_item` AS `at_inventory_in_stock` ON (at_inventory_in_stock.`product_id`=e.entity_id) AND ((at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=1 AND at_inventory_in_stock.is_in_stock=1) OR (at_inventory_in_stock.use_config_manage_stock = 0 AND at_inventory_in_stock.manage_stock=0) OR (at_inventory_in_stock.use_config_manage_stock = 1 AND at_inventory_in_stock.is_in_stock=1)) INNER JOIN `mgxf_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.customer_group_id = 0 AND price_index.website_id = '1' INNER JOIN `mgxf_catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN `mgxf_cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id INNER JOIN `mgxf_catalog_product_link` AS `links` ON links.linked_product_id = e.entity_id AND links.link_type_id = 4 LEFT JOIN `mgxf_catalog_product_link_attribute_int` AS `link_attribute_position_int` ON link_attribute_position_int.link_id = links.link_id AND link_attribute_position_int.product_link_attribute_id = '2' INNER JOIN `mgxf_catalog_product_entity` AS `product_entity_table` ON links.product_id = product_entity_table.entity_id WHERE (stock_status_index.stock_status = 1) AND (links.product_id in (48608)) AND (`e`.`entity_id` != '48608') ORDER BY `position` ASC | 0.000 |
From the query itself, I can't tell what is the purpose behind this. The part "ORDER BY rand() ASC" is hinting at maybe this being some sort of product recommendation or something?
Anyway, figure out what part of code is executing this query and what is the intended behaviour of that feature. It can probably be optimized.
I can see related products and you may also like sections on your product pages change on every request, this might be related to that, randomizing what is shown on product page in those blocks.
I found solution by disbale module auto relate product,
Thank you
@toniagency82ed wrote:I can see related products and you may also like sections on your product pages change on every request, this might be related to that, randomizing what is shown on product page in those blocks.