MariaDB数据库的缓存配置详解
在这里简单介绍一下MariaDB的缓存相关参数。
have_query_cache
MariaDB [(none)]> SHOW VARIABLES LIKE 'have_query_cache';
------------------ -------
| Variable_name | Value |
------------------ -------
| have_query_cache | YES |
------------------ -------
1 row in set (0.00 sec)
query_cache_limit
MariaDB [(none)]> SHOW VARIABLES LIKE 'query_cache_limit';
------------------- ---------
| Variable_name | Value |
------------------- ---------
| query_cache_limit | 1048576 |
------------------- ---------
1 row in set (0.00 sec)
query_cache_min_res_unit
SHOW VARIABLES LIKE 'query_cache_min_res_unit';
-------------------------- -------
| Variable_name | Value |
-------------------------- -------
| query_cache_min_res_unit | 4096 |
-------------------------- -------
1 row in set (0.00 sec)
query_cache_size
MariaDB [(none)]> SHOW VARIABLES LIKE 'query_cache_size';
------------------ -------
| Variable_name | Value |
------------------ -------
| query_cache_size | 0 |
------------------ -------
1 row in set (0.00 sec)
query_cache_type
MariaDB [(none)]> SHOW VARIABLES LIKE 'query_cache_type';
------------------ -------
| Variable_name | Value |
------------------ -------
| query_cache_type | ON |
------------------ -------
1 row in set (0.00 sec)
query_cache_wlock_invalidate
MariaDB [(none)]> SHOW VARIABLES LIKE 'query_cache_wlock_invalidate';
------------------------------ -------
| Variable_name | Value |
------------------------------ -------
| query_cache_wlock_invalidate | OFF |
------------------------------ -------
1 row in set (0.00 sec)
确认查询缓存情况
如何确认一个数据库的查询缓存情况,如命中率如何,配置的内存是否妥当?
MariaDB提供了一系列的SHOW STATUS命令来确认当前的查询缓存状态。
MariaDB [(none)]> SHOW STATUS LIKE 'Qcache%';
------------------------- -------
| Variable_name | Value |
------------------------- -------
| Qcache_free_blocks | 0 |
| Qcache_free_memory | 0 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 0 |
------------------------- -------
8 rows in set (0.00 sec)
清除查询缓存
MariaDB [(none)]> RESET QUERY CACHE;
Query OK, 0 rows affected (0.00 sec)
您可能感兴趣的文章:
MariaDB数据库的缓存配置详解
Ubuntu 14.04 安装部署 MariaDB 数据库步骤
MariaDB与MySQL数据库之间有什么区别
MySQL之MariaDB启用审计插件配置详解
Mariadb/MySQL 安装及配置在Linux系统中
MariaDB/MySQL主从复制之借助Percona的XtraBackup实现不锁表不停库热同步
Zabbix Mysql Fpmmm(MPM)监控的教程
Linux高可用(HA)之Corosync Pacemaker DRBD MySQL/MariaDB实现高可用MySQ/MariaDB集群
MySQL 安装
mysql加速查询速度利器之查询缓存