Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of setting cache in mysql

Shulou Source: shulou.com Published: 2022-06-01 02:07:33 09月30日 Update

This article is about how to set up cache in mysql. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.

The cache setting method in mysql: 1. Enable the self cache function [show variables like "%cache%"];2. Set the self cache to 32M [set global query_cache_size = 1024 * 1024 * 32;].

Methods of caching settings in mysql:

1. You need to enable MySQL's own cache function

# show variables like "%cache%"

query_cache_type: MySQL's own cache startup state is enabled by default, but there is no space size

query_cache_size: Size of MySQL's own cache, in bytes

If you need to set MySQL's own cache to 32 MB

# set global query_cache_size = 1024 * 1024 * 32;

Run some comparative tests.

query_cache_size=0;

3. Inquiry

4. Open MySQL cache (32 MB space)

5. When modifying the case of words in a query statement, the query result remains unchanged, but MySQL's own cache considers this to be a different query and will cache it here (MySQL's own cache is strictly based on the case of sql statements).

Thank you for reading! About mysql set cache method shared here, I hope the above content can have some help for everyone, so that we can learn more knowledge. If you think the article is good, you can share it so that more people can see it!

Tags: Cache method size query setting content function more space statement good practical unit word byte article time status look knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info NVidia vpn Shulou Information Linux