{"id":383163,"date":"2023-05-23T12:27:26","date_gmt":"2023-05-23T12:27:26","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=383163"},"modified":"2024-02-22T09:38:30","modified_gmt":"2024-02-22T09:38:30","slug":"how-to-debug-slow-mysql-queries-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/","title":{"rendered":"How to debug slow MYSQL queries in Magento 2"},"content":{"rendered":"\n<p>This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution.<\/p>\n\n\n\n<p><strong>First<\/strong>, Magento by default provides us with its inbuilt mysql query logger functionality.<\/p>\n\n\n\n<p>To enable the same we can run the following command<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php bin\/magento dev:query-log:enable<\/pre>\n\n\n\n<p>This command will write database activity logs to the &lt;magento_root&gt;\/var\/debug\/db.log file<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"643\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png\" alt=\"screenshot-nimbusweb.me-2023.05.23-15_10_55\" class=\"wp-image-383166\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-300x161.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-250x134.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-768x412.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1536x823.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55.png 1799w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>To disable the MySQL query logger use the following command<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php bin\/magento dev:query-log:disable<\/pre>\n\n\n\n<p>We can also log limited data, for that please check <strong>php bin\/magento dev:query-log:enable &#8211;help<\/strong> command to know further options.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"274\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_44_42-1200x274.png\" alt=\"screenshot-nimbusweb.me-2023.05.23-17_44_42\" class=\"wp-image-383168\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_44_42-1200x274.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_44_42-300x69.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_44_42-250x57.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_44_42-768x175.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_44_42.png 1283w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Second<\/strong>, We can use the MYSQL Command Line tool to debug slow queries in order to do so please follow the below<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log into your MYSQL by running the following command<br><code>mysql -u root -p<\/code><\/li>\n\n\n\n<li>Select the database<br><code>use magento_database;<\/code><\/li>\n\n\n\n<li>Now, you need to enable the slow query log<br><code>SET GLOBAL slow_query_log = 'ON';<\/code><\/li>\n\n\n\n<li>You can also set query running time threshold in seconds<br><code>SET GLOBAL long_query_time = X;<\/code><\/li>\n\n\n\n<li>Now, you can check if the above settings are properly done or not, run the following command<br><code>show variables like '%slow%\u2019;<\/code><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"543\" height=\"252\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_47_27.png\" alt=\"screenshot-nimbusweb.me-2023.05.23-17_47_27\" class=\"wp-image-383176\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_47_27.png 543w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_47_27-300x139.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-17_47_27-250x116.png 250w\" sizes=\"(max-width: 543px) 100vw, 543px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Here you can also check your log file path<\/p>\n\n\n\n<p><strong>Third<\/strong>, is Magento 2 DB <a href=\"https:\/\/webkul.com\/blog\/profiler-in-magento-2\/\">Profiler<\/a><\/p>\n\n\n\n<p>The Magento 2 database profiler displays all queries implemented on a page, including the time for each query and what parameters were applied.<\/p>\n\n\n\n<p>We will be outputting the following options for our example here<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Total time (displays the total amount of time to run all queries on the page)<\/li>\n\n\n\n<li>SQL (displays all SQL queries; the row header displays the count of queries)<\/li>\n\n\n\n<li>Query Params (displays the parameters for each SQL query)<\/li>\n<\/ul>\n\n\n\n<p>In order to enable this you need to modify \/app\/etc\/env.php with the following code under db-&gt;connection-&gt;default.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&#039;profiler&#039; =&gt; &#091;\n    &#039;class&#039; =&gt; &#039;\\Magento\\Framework\\DB\\Profiler&#039;,\n    &#039;enabled&#039; =&gt; true,\n],<\/pre>\n\n\n\n<p>final file content<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&#039;db&#039; =&gt; &#091;\n    &#039;table_prefix&#039; =&gt; &#039;&#039;,\n    &#039;connection&#039; =&gt; &#091;\n        &#039;default&#039; =&gt; &#091;\n            &#039;host&#039; =&gt; &#039;localhost&#039;,\n            &#039;dbname&#039; =&gt; &#039;magento&#039;,\n            &#039;username&#039; =&gt; &#039;root&#039;,\n            &#039;password&#039; =&gt; &#039;password&#039;,\n            &#039;model&#039; =&gt; &#039;mysql4&#039;,\n            &#039;engine&#039; =&gt; &#039;innodb&#039;,\n            &#039;initStatements&#039; =&gt; &#039;SET NAMES utf8;&#039;,\n            &#039;active&#039; =&gt; &#039;1&#039;,\n            &#039;driver_options&#039; =&gt; &#091;\n                1014 =&gt; false\n            ],\n            &#039;profiler&#039; =&gt; &#091;\n                &#039;class&#039; =&gt; &#039;\\Magento\\Framework\\DB\\Profiler&#039;,\n                &#039;enabled&#039; =&gt; true,\n            ]\n        ]\n    ]\n],<\/pre>\n\n\n\n<p>Now, you need to configure where to see the output and for that follow below<\/p>\n\n\n\n<p>open \/pub\/index.php and add following code after $bootstrap-&gt;run($app); line<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/** @var \\Magento\\Framework\\App\\ResourceConnection $res *\/\n$res = \\Magento\\Framework\\App\\ObjectManager::getInstance()-&gt;get(&#039;Magento\\Framework\\App\\ResourceConnection&#039;);\n\/** @var Magento\\Framework\\DB\\Profiler $profiler *\/\n$profiler = $res-&gt;getConnection(&#039;read&#039;)-&gt;getProfiler();\necho &quot;&lt;table cellpadding=&#039;0&#039; cellspacing=&#039;0&#039; border=&#039;1&#039;&gt;&quot;;\necho &quot;&lt;tr&gt;&quot;;\necho &quot;&lt;th&gt;Time &lt;br\/&gt;&#091;Total Time: &quot;.$profiler-&gt;getTotalElapsedSecs().&quot; secs]&lt;\/th&gt;&quot;;\necho &quot;&lt;th&gt;SQL &#091;Total: &quot;.$profiler-&gt;getTotalNumQueries().&quot; queries]&lt;\/th&gt;&quot;;\necho &quot;&lt;th&gt;Query Params&lt;\/th&gt;&quot;;\necho &quot;&lt;\/tr&gt;&quot;;\nforeach ($profiler-&gt;getQueryProfiles() as $query) {\n    \/** @var Zend_Db_Profiler_Query $query*\/\n    echo &#039;&lt;tr&gt;&#039;;\n    echo &#039;&lt;td&gt;&#039;, number_format(1000 * $query-&gt;getElapsedSecs(), 2), &#039;ms&#039;, &#039;&lt;\/td&gt;&#039;;\n    echo &#039;&lt;td&gt;&#039;, $query-&gt;getQuery(), &#039;&lt;\/td&gt;&#039;;\n    echo &#039;&lt;td&gt;&#039;, json_encode($query-&gt;getQueryParams()), &#039;&lt;\/td&gt;&#039;;\n    echo &#039;&lt;\/tr&gt;&#039;;\n}\necho &quot;&lt;\/table&gt;&quot;;<\/pre>\n\n\n\n<p>Result will be in bottom of the page<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"565\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40-1200x565.png\" alt=\"screenshot-192.168.15.154-2023.05.23-17_32_40\" class=\"wp-image-383180\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40-1200x565.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40-300x141.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40-250x118.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40-768x362.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40-1536x723.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_32_40.png 1845w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Lastly<\/strong>, there is an amazing tool named Quick Development Toolbar (<a href=\"https:\/\/github.com\/vpietri\/magento2-developer-quickdevbar\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">GitHub<\/a>)<\/p>\n\n\n\n<p>This repository will add a floating toolbar on top of your Magento 2 pages.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1200\" height=\"597\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42-1200x597.png\" alt=\"screenshot-192.168.15.154-2023.05.23-16_31_42\" class=\"wp-image-383182\" style=\"width:820px;height:407px\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42-1200x597.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42-300x149.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42-250x124.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42-768x382.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42-1536x764.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-16_31_42.png 1848w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>When you go to the Queries tab you will see that all queries for that page are listed here with query time and other details<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"636\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53-1200x636.png\" alt=\"screenshot-192.168.15.154-2023.05.23-17_09_53\" class=\"wp-image-383183\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53-1200x636.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53-300x159.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53-250x133.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53-768x407.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53-1536x815.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_09_53.png 1848w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"597\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17-1200x597.png\" alt=\"screenshot-192.168.15.154-2023.05.23-17_10_17\" class=\"wp-image-383184\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17-1200x597.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17-300x149.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17-250x124.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17-768x382.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17-1536x764.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-192.168.15.154-2023.05.23-17_10_17.png 1848w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Hope this helps you in debugging and writing better code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution. First, Magento by default provides us with its inbuilt mysql query logger functionality. To enable the same we can run the following command This command will <a href=\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":204,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121,302],"tags":[3289,2070,90],"class_list":["post-383163","post","type-post","status-publish","format-standard","hentry","category-magento-2","category-magento2","tag-debug","tag-magento2","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to debug slow MYSQL queries in Magento 2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to debug slow MYSQL queries in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-23T12:27:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-22T09:38:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png\" \/>\n<meta name=\"author\" content=\"Sagar Bathla\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sagar Bathla\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\"},\"author\":{\"name\":\"Sagar Bathla\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463\"},\"headline\":\"How to debug slow MYSQL queries in Magento 2\",\"datePublished\":\"2023-05-23T12:27:26+00:00\",\"dateModified\":\"2024-02-22T09:38:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\"},\"wordCount\":386,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png\",\"keywords\":[\"debug\",\"Magento2\",\"mysql\"],\"articleSection\":[\"Magento 2\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\",\"name\":\"How to debug slow MYSQL queries in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png\",\"datePublished\":\"2023-05-23T12:27:26+00:00\",\"dateModified\":\"2024-02-22T09:38:30+00:00\",\"description\":\"This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55.png\",\"width\":1799,\"height\":964,\"caption\":\"screenshot-nimbusweb.me-2023.05.23-15_10_55\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to debug slow MYSQL queries in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463\",\"name\":\"Sagar Bathla\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Sagar Bathla\"},\"description\":\"Sagar Bathla, a Magento Certified Developer, is an expert in Magento 2 development and eCommerce platforms. He specializes in creating cutting-edge Headless PWA solutions, ensuring scalability and exceptional user experiences. Sagar's focus on innovative technology results in transformative digital growth.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/sagar-bathla901\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to debug slow MYSQL queries in Magento 2 - Webkul Blog","description":"This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"How to debug slow MYSQL queries in Magento 2 - Webkul Blog","og_description":"This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution","og_url":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-05-23T12:27:26+00:00","article_modified_time":"2024-02-22T09:38:30+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png","type":"","width":"","height":""}],"author":"Sagar Bathla","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sagar Bathla","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/"},"author":{"name":"Sagar Bathla","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463"},"headline":"How to debug slow MYSQL queries in Magento 2","datePublished":"2023-05-23T12:27:26+00:00","dateModified":"2024-02-22T09:38:30+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/"},"wordCount":386,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png","keywords":["debug","Magento2","mysql"],"articleSection":["Magento 2","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/","name":"How to debug slow MYSQL queries in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55-1200x643.png","datePublished":"2023-05-23T12:27:26+00:00","dateModified":"2024-02-22T09:38:30+00:00","description":"This article talks about a couple of ways in which we can debug MYSQL queries(slow queries, waiting for a long process) for Magento 2 and find the adaptive solution","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/05\/screenshot-nimbusweb.me-2023.05.23-15_10_55.png","width":1799,"height":964,"caption":"screenshot-nimbusweb.me-2023.05.23-15_10_55"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-debug-slow-mysql-queries-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to debug slow MYSQL queries in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/6fcd235eb54dfa1a0fbfc662b8618463","name":"Sagar Bathla","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/06e15f8abbf8155cc1124049027a7849db68d785d26bd10e4932883b83def757?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Sagar Bathla"},"description":"Sagar Bathla, a Magento Certified Developer, is an expert in Magento 2 development and eCommerce platforms. He specializes in creating cutting-edge Headless PWA solutions, ensuring scalability and exceptional user experiences. Sagar's focus on innovative technology results in transformative digital growth.","url":"https:\/\/webkul.com\/blog\/author\/sagar-bathla901\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/383163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/204"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=383163"}],"version-history":[{"count":4,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/383163\/revisions"}],"predecessor-version":[{"id":423776,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/383163\/revisions\/423776"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=383163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=383163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=383163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}