“键缓冲区大小”和“总 MyISAM 索引”单位大小是什么意思?

“键缓冲区大小”和“总 MyISAM 索引”单位大小是什么意思?

我在我的数据库上运行了 MySQLTuner 来检查一切是否正常且最佳地运行,但我对这两个值的单位感到困惑。

以下是性能指标的输出

-------- Performance Metrics -------------------------------------------------
[--] Up for: 2d 5h 11m 20s (47M q [249.471 qps], 45M conn, TX: 65B, RX: 8B)
[--] Reads / Writes: 79% / 21%
[--] Total buffers: 1.1G global + 2.7M per thread (300 max threads)
[!!] Maximum possible memory usage: 1.9G (198% of installed RAM)
[OK] Slow queries: 0% (43/47M)
[OK] Highest usage of available connections: 5% (17/300)
[OK] Key buffer size / total MyISAM indexes: 600.0M/128.0K
[OK] Key buffer hit rate: 100.0% (17K cached / 0 reads)
[OK] Query cache efficiency: 98.1% (46M cached / 47M selects)
[!!] Query cache prunes per day: 22728
[OK] Sorts requiring temporary tables: 0% (9 temp sorts / 65K sorts)
[!!] Joins performed without indexes: 2839
[OK] Temporary tables created on disk: 0% (235 on disk / 42K total)
[OK] Thread cache hit rate: 99% (79 created / 45M connections)
[!!] Table cache hit rate: 1% (400 open / 27K opened)
[OK] Open file limit used: 0% (0/1K)
[OK] Table locks acquired immediately: 100% (1M immediate / 1M locks)
[!!] Connections aborted: 99%
[!!] InnoDB data size / buffer pool: 6.5G/128.0M

但我的问题是关于这一行

[OK] Key buffer size / total MyISAM indexes: 600.0M/128.0K

我不知道这些单位是什么意思,也不知道它们的大小有什么不同。“M”和“K”是什么意思

我知道我的键缓冲区大小应该大于 MyISAM 索引,但我不能确定是不是因为我不了解单位。我在网上搜索过,但找不到我想要的答案。如果有人能帮我澄清一下,我将不胜感激。

答案1

M 是兆字节,K 是千字节,

密钥缓冲区大小MySQL 设置是否与 MyISAM 引擎相关

如果您对所有表都使用 InnoDB 引擎,则只需要较小的(但非零的)key_buffer_size,而需要较大的 innodb_buffer_pool_size。

我强烈推荐此网页因为它为 MySQL 优化这个原本非常复杂的事情提供了简单的答案。所以,如果你不想花很多时间,只想把它配置成“相对较好”的东西。去那里。

相关内容