对于大型表连接和更新,我应该更改哪些 MySQL my.ini 参数?
我有以下内容:
- TableA - 20M 行
- TableB - 500K 行
许多查询,特别是以下查询,需要很长时间。
UPDATE
TableA AS A
INNER JOIN
TableB AS B
ON B.Value IS NOT NULL AND A.Key=B.Key
SET
A.Value = B.Value
WHERE
A.Value IS NULL;
我知道我的 MySQL (MyISAM) 没有针对大型表进行配置,并且我确信它可以使用更多的可用内存(总共 4GB)或 CPU (i7)。我应该查看 my.ini 中的哪些参数?
我从 key_buffer_size = 1536M 开始,因为 tableA 有一个 1gb 索引。
I have the following:
- TableA - 20M rows
- TableB - 500K rows
And many queries, in particular the following, take forever.
UPDATE
TableA AS A
INNER JOIN
TableB AS B
ON B.Value IS NOT NULL AND A.Key=B.Key
SET
A.Value = B.Value
WHERE
A.Value IS NULL;
I know my MySQL (MyISAM) is not configured for large tables and I'm sure it could use more of the available memory (4GB total) or CPUs (i7). What parameters in my.ini should I be looking at?
I've started with key_buffer_size = 1536M because tableA has a 1gb index.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 innodb
innodb_buffer_pool_size
设置为您希望 mysql 可用的内存的大约 80%innodb_log_file_size
*innodb_log_files_in_group
应足够大,以便将更改写入磁盘每秒不超过一次但使用配置向导仍然更容易 https://tools.percona.com/wizard
For innodb
innodb_buffer_pool_size
set to approx 80% of memory you want available to mysqlinnodb_log_file_size
*innodb_log_files_in_group
should be large enough that changes will be written to disk no more than once a secondBut easier still use the configuration wizard https://tools.percona.com/wizard