MySQL:什么是密钥缓冲区
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3663515/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL: What is the key buffer
提问by Barranka
I'm trying to tweak my MySQL server to fit my needs... and I have a basic question: What is the key buffer?
我正在尝试调整我的 MySQL 服务器以满足我的需要......我有一个基本问题:什么是密钥缓冲区?
Through try and error I've found that a bigger key buffer makes my inserts faster... but I don't quite understand what it is. So... before I make something I might regret, I'd like to know what it is, and how it works.
通过尝试和错误,我发现更大的密钥缓冲区使我的插入速度更快……但我不太明白它是什么。所以......在我做一些我可能会后悔的事情之前,我想知道它是什么,以及它是如何运作的。
The script I'm running (MyISAM tables) is making about 2000 inserts per second.
我正在运行的脚本(MyISAM 表)每秒进行大约 2000 次插入。
(My server setup is Intel i7, 8GB RAM, CentOS 5.5, MySQL Server 5.0.)
(我的服务器设置是 Intel i7、8GB RAM、CentOS 5.5、MySQL Server 5.0。)
回答by OMG Ponies
What is the Key Buffer?
什么是密钥缓冲区?
The key buffer is MyISAM specific, a structure for index blocks that contains a number of block buffers where the most-used index blocks are placed. It's mean for minimizing disk I/O, because memory is still faster than hard drives [currently]. The MyISAM key buffer is described in more detail in the documentation.
密钥缓冲区是 MyISAM 特定的,索引块的结构包含许多块缓冲区,其中放置了最常用的索引块。这意味着最小化磁盘 I/O,因为内存仍然比硬盘驱动器 [当前] 快。所述的MyISAM键缓存器中更详细的文档中描述。
Guidelines for Tuning the Key Buffer
调整密钥缓冲区的指南
Size depends on amount of indexes, data size and workload.
大小取决于索引数量、数据大小和工作负载。
- Set up to 30-40% of available memory if you use MyISAM tables exclusively. 2-4 MB minimum; dedicating GBs can be a waste.
- 如果您专门使用 MyISAM 表,则最多设置 30-40% 的可用内存。至少 2-4 MB;专用 GB 可能是一种浪费。
For more info, see this article on MySQL tuning.
有关更多信息,请参阅这篇关于 MySQL 调优的文章。