MySQL实例内存占用分类
Posted sforiz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL实例内存占用分类相关的知识,希望对你有一定的参考价值。
mysql实例内存占用分类
服务器级别(全局),主要内存占用部分
query_cache_size = 64M
innodb_additional_mem_pool_size = 32M
innodb_buffer_pool_size = 1G
innodb_log_buffer_size = 16M
key_buffer_size = 256M
线程级别
#net_buffer_length = 16K
thread_stack = 256K
#query_prealloc_size = 8K
binlog_cache_size = 2M
binlog_stmt_cache_size = 64K
会话级别(每个线程分配一次)
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
bulk_insert_buffer_size = 64M
#preload_buffer_size = 32K
会话级别(每个线程分配多次)
read_buffer_size = 2M
join_buffer_size = 8M
tmp_table_size = 1024M
MySQL最大可使用内存(M):
select (@@key_buffer_size +@@innodb_buffer_pool_size + @@tmp_table_size + @@max_connections*(@@read_buffer_size + @@read_rnd_buffer_size + @@sort_buffer_size + @@join_buffer_size + @@binlog_cache_size + @@thread_stack) )/1024/1024 as “Total_AllMem result”;
MySQL单个连接最大可使用内存(M):
select (@@read_buffer_size + @@read_rnd_buffer_size + @@sort_buffer_size + @@join_buffer_size + @@binlog_cache_size + @@thread_stack)/1024/1024 as “Connection result”;
MySQL最大可使用内存(不包含连接占用内存)(M):
select (@@key_buffer_size +@@innodb_buffer_pool_size+ @@tmp_table_size )/1024/1024 as “Total_Mem result”;
select (@@net_buffer_length + @@thread_stack + @@query_prealloc_size + @@binlog_cache_size + @@binlog_stmt_cache_size + @@read_rnd_buffer_size + @@sort_buffer_size + @@bulk_insert_buffer_size + @@preload_buffer_size + @@read_buffer_size + @@join_buffer_size)/1024/1024 as “Connection result”;
以上是关于MySQL实例内存占用分类的主要内容,如果未能解决你的问题,请参考以下文章