mysql_caching
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mysql_caching [2015/04/08 09:04] – luke7858 | mysql_caching [2024/05/23 07:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| When logged into mysql you can use the following command to view query cache size (note: 0 means that no caching has been enabled) | When logged into mysql you can use the following command to view query cache size (note: 0 means that no caching has been enabled) | ||
| <sxh bash> | <sxh bash> | ||
| - | SHOW VARIABLES LIKE ' | + | show VARIABLES LIKE ' |
| + | </ | ||
| + | \\ | ||
| + | You can also use the following command for more information: | ||
| + | <sxh bash> | ||
| + | mysql> show variables like ' | ||
| + | +------------------------------+---------+ | ||
| + | | Variable_name | ||
| + | +------------------------------+---------+ | ||
| + | | query_alloc_block_size | ||
| + | | query_cache_limit | ||
| + | | query_cache_min_res_unit | ||
| + | | query_cache_size | ||
| + | | query_cache_type | ||
| + | | query_cache_wlock_invalidate | OFF | | ||
| + | | query_prealloc_size | ||
| + | +------------------------------+---------+ | ||
| </ | </ | ||
| \\ | \\ | ||
| - | |||
| === Option 2 === | === Option 2 === | ||
| If you have configured your .my.cnf file then you are able to perform the following command from your shell without needing to enter into mysql: | If you have configured your .my.cnf file then you are able to perform the following command from your shell without needing to enter into mysql: | ||
| Line 16: | Line 31: | ||
| Output should look similar to: | Output should look similar to: | ||
| <sxh bash> | <sxh bash> | ||
| - | mysql> SHOW VARIABLES LIKE ' | + | |
| +------------------+-------+ | +------------------+-------+ | ||
| | Variable_name | | Variable_name | ||
| Line 33: | Line 48: | ||
| query_cache_limit – This is the maximum size query (in bytes) that will be cached. | query_cache_limit – This is the maximum size query (in bytes) that will be cached. | ||
| </ | </ | ||
| + | |||
| + | \\ | ||
| + | ---------------------------------------------------------- | ||
| + | \\ | ||
| + | === Configuring query caching variables === | ||
| + | The command below is an example of setting the global caching of mysql to 16MB. | ||
| + | <sxh bash> | ||
| + | set GLOBAL query_cache_size = 16777216; | ||
| + | </ | ||
| + | |||
| + | <sxh bash> | ||
| + | set global query_cache_limit = 1010101; | ||
| + | </ | ||
| + | \\ | ||
| + | === Setting the variables to be permanent: === | ||
| An example of editing the **/ | An example of editing the **/ | ||
| Line 40: | Line 70: | ||
| query_cache_limit=1048576 | query_cache_limit=1048576 | ||
| </ | </ | ||
| - | \\ | + | |
| - | ---------------------------------------------------------- | + | |
| - | \\ | + | |
| - | The command below is an example of setting the global caching of mysql to 16MB. | + | |
| <sxh bash> | <sxh bash> | ||
| - | SET GLOBAL query_cache_size = 16777216; | + | |
| </ | </ | ||
mysql_caching.1428483893.txt.gz · Last modified: 2024/05/23 07:26 (external edit)
