+ -
当前位置:首页 → 问答吧 → MEMORY hash 表的插入性能问题

MEMORY hash 表的插入性能问题

时间:2011-07-20

来源:互联网

想用memory引擎的表,来保存一个查询子集,如下:
create table t4(id int,index using hash(id))engine=memory;
insert into t4(id) select emp_no from salaries where salary=90930;
用执行了下面的insert操作,发现不管后面的子查询结果集为多大,整个insert 操作都要用4sec多。
哪位大侠知道这是什么原因。难道heap的插入性能就是这么差吗?

作者: wudongxu   发布时间: 2011-07-20

我的mysql版本是5.1.48

作者: wudongxu   发布时间: 2011-07-20

你自己子查询速度测过嘛?

mysql> insert into t4(id) select id from test;
Query OK, 262144 rows affected (0.31 sec)
Records: 262144 Duplicates: 0 Warnings: 0

作者: shine333   发布时间: 2011-07-20

测了用了1.7左右

作者: wudongxu   发布时间: 2011-07-20

select emp_no from salaries where salary=90930
是你这条语句慢吧

作者: rucypli   发布时间: 2011-07-20

后面的查询速度一般时间不超过2sec,单独拿出来测试。整个表有2800000条记录。

作者: wudongxu   发布时间: 2011-07-20

我使用show profile发现sending data占用了98%的时间。请问sending data是做什么的?

作者: wudongxu   发布时间: 2011-07-20