【发布时间】:2011-03-14 00:15:39
【问题描述】:
首先,我是优化 mysql 的新手。事实是,我的 Web 应用程序中有一个使用 GROUP BY 的查询(每秒大约 400 个查询),这是我无法避免的,这就是创建临时表的原因。我的配置是:
max_heap_table_size = 16M
tmp_table_size = 32M
结果:临时表到磁盘的百分比 + - 12.5%
然后我根据this post更改了我的设置
max_heap_table_size = 128M
tmp_table_size = 128M
结果:临时表到磁盘的百分比 + - 18%
结果出乎意料,不明白为什么。
错tmp_table_size = max_heap_table_size?
不应该增加尺寸吗?
查询
SELECT images, id
FROM classifieds_ads
WHERE parent_category = '1' AND published='1' AND outdated='0'
GROUP BY aux_order
ORDER BY date_lastmodified DESC
LIMIT 0, 100;
解释
| 1 |SIMPLE|classifieds_ads | ref |parent_category, published, combined_parent_oudated_published, oudated | combined_parent_oudated_published | 7 | const,const,const | 67552 | Using where; Using temporary; Using filesort |
【问题讨论】:
-
不用道歉——你的英语很好。
-
同意 OMG 小马;我们希望不会阻止任何人提问,以防他们的英语不够出色。
-
您的书面英语比我不幸共事的一些以英语为母语的同事要好! :)
-
谢谢,我承认我从谷歌翻译那里得到了一点帮助。
-
用介词来结束句子是一件坏事......
标签: sql mysql performance optimization temp-tables