{"id":8458,"date":"2020-10-15T11:33:06","date_gmt":"2020-10-15T11:33:06","guid":{"rendered":"https:\/\/cloudkul.com\/blog\/?p=8458"},"modified":"2020-12-30T11:22:08","modified_gmt":"2020-12-30T11:22:08","slug":"magento2-mysql-query-cache","status":"publish","type":"post","link":"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/","title":{"rendered":"Magento2 MySQL Query Cache &#8211; Enjoy the performance!"},"content":{"rendered":"\n<p>Magento&#8217;s performance enhancement is a priority for the vast majority of Magento developers. To ultimately acquire, expand, maintain, and retain customers for potential growth and development in businesses. In addition, they make some strides to speed up the Magento store to serve the purpose. <strong>Magento2 MySQL Query Cache<\/strong> &#8211; This is an additional way to accelerate the store.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"654\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/bag-2.png\" alt=\"\" class=\"wp-image-8459\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Magento2 MySQL Query Cache<\/strong><\/h2>\n\n\n\n<p>The MySQL Query Cache is a memory that is stored within the MySQL daemon to store a request result. The result is available immediately whenever a similar request is executed by someone. Instead of calling a new request, we can get the same result from the cache.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Working Mechanism<\/h3>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"750\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/working.png\" alt=\"\" class=\"wp-image-8462\"\/><\/figure><\/div>\n\n\n\n<p>When a user requests a query, then the MySQL query cache searches the result in the cache memory and if it exists, returns the result from the cache. If there is no result available, then the query is logged. After the query execution, the result is stored in the cache for future use for similar requests.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Implementation<\/strong><\/h3>\n\n\n\n<p>Let&#8217;s turn to the execution section, where we learn to Configure or enable the MySQL Query Cache.<\/p>\n\n\n\n<ol><li><strong>Firstly, log in to the MySQL command prompt and run the below command :<\/strong><\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> SHOW VARIABLES LIKE \u2018have_query_cache\u2019;<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"432\" height=\"111\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/screenshot_from_2020_10_14_12_07_47.png\" alt=\"\" class=\"wp-image-8463\"\/><\/figure><\/div>\n\n\n\n<p>As we seen, the value is always YES for the MySQL standard binary irrespective of the cache state of the query.&nbsp;<\/p>\n\n\n\n<p>2. <strong>After the above step, find out whether the query cache is operational or not by following the listed command<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> SHOW VARIABLES LIKE \u2018query_cache_size\u2019;<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"110\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/screenshot_from_2020_10_14_12_08_37.png\" alt=\"\" class=\"wp-image-8464\"\/><\/figure><\/div>\n\n\n\n<p>The image above shows that we have sufficient memory for query cache size means it is enabled. And the below image indicates the disabled state because it depicts the &#8216;0&#8217; as a query cache size.<\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"102\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/screenshot_from_2020_10_14_12_08_57.png\" alt=\"\" class=\"wp-image-8465\"\/><\/figure><\/div>\n\n\n\n<p>3. <strong>If you have root access then make the changes to this value by mention these lines in \/etc\/mysql\/my.cnf file and restart the mysql server to enable it.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"223\" height=\"92\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/screenshot_from_2020_10_14_12_25_14.png\" alt=\"\" class=\"wp-image-8466\"\/><\/figure><\/div>\n\n\n\n<p>4.<strong> It is prudent to remember a few other parameters too when setting up Magento2&nbsp;MySQL server.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> show variables like \u2018query_cache_%\u2019;<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"403\" height=\"170\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/screenshot_from_2020_10_14_12_19_59.png\" alt=\"\" class=\"wp-image-8467\"\/><\/figure><\/div>\n\n\n\n<p>If you want to optimize your Magento2 store by <strong>Leverage Browser Caching <a rel=\"noreferrer noopener\" href=\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\" target=\"_blank\">just click<\/a><\/strong>.<\/p>\n\n\n\n<p><strong>Do you need optimization for your Magento2 store? <a rel=\"noreferrer noopener\" href=\"https:\/\/store.webkul.com\/AWS-Speed-Security-Optimization-Magento-2.html\" target=\"_blank\">Check us out<\/a>.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Thanks for reading!<\/strong><\/h2>\n\n\n\n<p>We hope it works for you and during this blog you have found something valuable.<\/p>\n\n\n\n<p><em><strong>In case of any help or query, please<\/strong>&nbsp;<a href=\"https:\/\/cloudkul.com\/contact\/\"><strong>contact<\/strong><\/a>&nbsp;<strong>us or raise a<\/strong>&nbsp;<strong><a href=\"https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/\">ticket<\/a>.<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento&#8217;s performance enhancement is a priority for the vast majority of Magento developers. To ultimately <a class=\"text-primary\" title=\"read more\" href=\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[20],"tags":[159,178,33,114,24,281,432,433,431,100,556],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento2 MySQL Query Cache - Enjoy the performance! - Cloudkul<\/title>\n<meta name=\"description\" content=\"MySQL Query Cache - an additional way to accelerate the store. It is a memory that is stored within the MySQL daemon to store a request result.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento2 MySQL Query Cache - Enjoy the performance! - Cloudkul\" \/>\n<meta property=\"og:description\" content=\"MySQL Query Cache - an additional way to accelerate the store. It is a memory that is stored within the MySQL daemon to store a request result.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudkul\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-15T11:33:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-30T11:22:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/bag-2.png\" \/>\n<meta name=\"author\" content=\"Bhawana Dehran\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\",\"url\":\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\",\"name\":\"Magento2 MySQL Query Cache - Enjoy the performance! - Cloudkul\",\"isPartOf\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\"},\"datePublished\":\"2020-10-15T11:33:06+00:00\",\"dateModified\":\"2020-12-30T11:22:08+00:00\",\"author\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62\"},\"description\":\"MySQL Query Cache - an additional way to accelerate the store. It is a memory that is stored within the MySQL daemon to store a request result.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magento2 MySQL Query Cache &#8211; Enjoy the performance!\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\",\"url\":\"https:\/\/cloudkul.com\/blog\/\",\"name\":\"Cloudkul\",\"description\":\"Host your eCommerce Store on AWS with Optimized Performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudkul.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62\",\"name\":\"Bhawana Dehran\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"caption\":\"Bhawana Dehran\"},\"description\":\"Business Development Executive\",\"url\":\"https:\/\/cloudkul.com\/blog\/author\/bhawanadehran-bd033\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Magento2 MySQL Query Cache - Enjoy the performance! - Cloudkul","description":"MySQL Query Cache - an additional way to accelerate the store. It is a memory that is stored within the MySQL daemon to store a request result.","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:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/","og_locale":"en_US","og_type":"article","og_title":"Magento2 MySQL Query Cache - Enjoy the performance! - Cloudkul","og_description":"MySQL Query Cache - an additional way to accelerate the store. It is a memory that is stored within the MySQL daemon to store a request result.","og_url":"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/","og_site_name":"Cloudkul","article_published_time":"2020-10-15T11:33:06+00:00","article_modified_time":"2020-12-30T11:22:08+00:00","og_image":[{"url":"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/bag-2.png"}],"author":"Bhawana Dehran","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/","url":"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/","name":"Magento2 MySQL Query Cache - Enjoy the performance! - Cloudkul","isPartOf":{"@id":"https:\/\/cloudkul.com\/blog\/#website"},"datePublished":"2020-10-15T11:33:06+00:00","dateModified":"2020-12-30T11:22:08+00:00","author":{"@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62"},"description":"MySQL Query Cache - an additional way to accelerate the store. It is a memory that is stored within the MySQL daemon to store a request result.","breadcrumb":{"@id":"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Magento2 MySQL Query Cache &#8211; Enjoy the performance!"}]},{"@type":"WebSite","@id":"https:\/\/cloudkul.com\/blog\/#website","url":"https:\/\/cloudkul.com\/blog\/","name":"Cloudkul","description":"Host your eCommerce Store on AWS with Optimized Performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudkul.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62","name":"Bhawana Dehran","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","caption":"Bhawana Dehran"},"description":"Business Development Executive","url":"https:\/\/cloudkul.com\/blog\/author\/bhawanadehran-bd033\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/8458"}],"collection":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/comments?post=8458"}],"version-history":[{"count":8,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/8458\/revisions"}],"predecessor-version":[{"id":9138,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/8458\/revisions\/9138"}],"wp:attachment":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media?parent=8458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/categories?post=8458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/tags?post=8458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}