Question

my website was getting internal 500 error intermediately, my hosting provider(siteground) told me that the magento database was running slow queries ( 80 in the past 24 hours), which cause spikes on on the ram usage (I have 8G RAM). I have safely clear the log tables to optimize the database. What should I do to identify and optimize the 'slow query' from magento2? below is one query that they provided to me as an example.

Executed 36m 19s ago for 23.325775 sec on Database --> magento2_db

Date: 2021-01-04 23:06:46 Query_time: 23.325775 Rows_examined: 357: Rows_sent 28 Lock_time: 1.068401 Query_chars: 446
SELECT ROUND(`price_index`.`min_price`, 2) AS `value` FROM `temp_044fcb9aee8455bb52bd25c3c818e93c54bf60cd` AS `e` INNER JOIN `catalog_product_index_price` AS `price_index` ON `price_index`.`entity_id` = `e`.`entity_id` AND `price_index`.`website_id` = '1' AND `price_index`.`customer_group_id` = 0 WHERE (ROUND(`price_index`.`min_price`, 2) >= 49.995) AND (ROUND(`price_index`.`min_price`, 2) < 1899.995) ORDER BY `value` ASC LIMIT 28 OFFSET 17;

AND

=== Databases Info =====================================================================================
  Database          Label                 Tables Views InnoDB MyISAM Slow Queries Slowest Query DB Size
  ----------------- --------------------- ------ ----- ------ ------ ------------ ------------- --------
  magento2_db    live_site        446     0    432      0           78  

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top