首页 | Linux 基础 | 资讯动态 | Linux 应用 | Linux 服务器 | Linux 开发 | Linux 安全 | 专题 | 联盟论坛
  当前位置:主页>Linux 服务器>数据库应用>文章内容
怎样测试MyISAM引擎和Heap引擎执行速度性能
来源:http://www.unix5.com 作者:qieming 发布时间:2008-04-29  

MyISAM引擎和Heap引擎执行速度的性能测试:

测试环境:

 

CPU:    Intel Pentium4 2.66GHz 
Memory: 1GB 
Disk:   73GB/SCSI 

OS:  FreeBSD 4.11 
PHP: PHP 5.2.1
MySQL: MySQL 4.1.23b

 

前期工作:

my.cnf:

 

max_heap_table_size = 128M

 

建表:

 

use test;

--
-- Store engine heap
--
CREATE TABLE `tbl_heap` (    
  `id` int(11) NOT NULL auto_increment,   
  `name` varchar(32) NOT NULL default '', 
  `email` varchar(32) NOT NULL default '',  
  `summary` varchar(255) default '', 
  KEY `id` (`id`)    
) ENGINE=HEAP DEFAULT CHARSET=gbk; 

--
-- Store engine myisam
--
CREATE TABLE `tbl_isam` (    
  `id` int(11) NOT NULL auto_increment,   
  `name` varchar(32) NOT NULL default '', 
  `email` varchar(32) NOT NULL default '',  
  `summary` varchar(255) default '', 
  KEY `id` (`id`)    
) ENGINE=MyISAM DEFAULT CHARSET=gbk;

插入数据:

 

说明:每次都是空表插入数据

 

[插入10000 Record]
Heap engine insert 10000 record used time: 3.5008587837219
MyISAM engine insert 10000 record used time: 4.5881390571594

[50000 Record]
Heap engine insert 50000 record used time: 19.895354986191
MyISAM engine insert 50000 record used time: 33.866044998169

[100000 Record]
Heap engine insert 100000 record used time: 36.200875997543
MyISAM engine insert 100000 record used time: 68.34194111824

[200000 Record]
Heap engine insert 200000 record used time: 68.00207901001
MyISAM engine insert 200000 record used time: 125.26263713837

 

 

 

查询数据:

 

表里分表有:200000条记录,两个表数据一致

 

[直接select,10000次,每次取100条记录]
Heap engine select 10000 times, 100 record used time: 12.122506141663
MyISAM engine select 10000 times, 100 record used time: 19.512896060944

[直接select,1000次,每次取10000条记录]
Heap engine select 1000 times, 10000 record used time: 111.54126811028
MyISAM engine select 1000 record used time: 116.79438710213

[增加where条件,1000次,每次取10000条记录]
Heap engine select 1000 times, 10000 record used time: 111.52102303505
MyISAM engine select 1000 times, 10000 record used time: 117.68481087685

[where条件,10000次,每次从1000条起,取1000条记录]
Heap engine select 10000 times, 1000 record used time: 124.28988695145
MyISAM engine select 10000 times, 1000 record used time: 139.82107305527

[where条件增加like,10000次,每次从1000条起,取1000条记录]
Heap engine select 10000 times, 1000 record used time: 145.43780493736
MyISAM engine select 10000 times, 1000 record used time: 163.56296992302

[where条件增加索引,10000次,每次从1000条起,取1000条记录]

-- 建立索引 (在SQLyob下执行)
ALTER TABLE tbl_heap ADD INDEX idx_name (name);
ALTER TABLE tbl_isam ADD INDEX idx_name (name);

Heap engine alter table add index used time: 2.078
MyISAM engine alter table add index used time: 13.516

Heap engine select 10000 times, 1000 record used time: 153.48922395706
MyISAM engine select 10000 times, 1000 record used time: 239.86818814278

PS: 不合适的索引还不如不要。。。-_-#

[SQLyog下进行count操作]
Heap engine select count used time: 4.53
MyISAM engine select count used time: 3.28

[SQLyob下进行select操作]
速度都很快,都在1秒一下,不论是1000条记录,还是200000条记录,个人猜测可能不准确

共3页: 上一页 1 [2] [3] 下一页
 
如果您对本文有任何疑问或者建议,请到论坛讨论区发表您的意见: >> 论坛入口
[收藏] [推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
  热点文章
·在Linux x86上安装Oracle数据库1
·Linux系统下的Oracle数据库编程
·Linux下免费数据库PostgreSQL开
·如何在你的Linux机器上安装运行O
·Oracle开发应用
·PostgreSQL的热备和恢复
·Heartbeat_2.0.3配置MySQL5.0.18
·编制一个Mysql数据库自动备份脚
·mysql 优化参数(十项)详解设置
·MySQL数据库系统的常规管理介绍
·新手入门--全面介绍MySQL的基础
·让PHP网站运转如飞 MySQL 的优化
  相关文章
·如何用"MySQL-Proxy"实现读写分
·分布式数据库全局名与数据库链讲
·如何向MySQL数据库的表中录入数
·简化PL/SQL调试的记录一致性错误
·Oracle PL/SQL编程风格与系统性
·VMWare上Oracle 10g R2的最简安
·在Linux x86上安装Oracle数据库1
·在slackware 10下安装Oracle 10
·在UnixWare7.1.1上安装Oracle8i
·Oracle开发应用
·Linux系统下Mini SQL数据库开发
·Linux系统下的Oracle数据库编程

本站信息源至:互联网络,均为学习,交流所用,如有版权问题,请联系我们.
站长QQ:397422079 E_mail:riechelr_hl@unix5.com
转载本站内容请注明原作者名.谢谢!