您好,欢迎访问一九零五行业门户网

HSQLDB的研究与性能测试(与Mysql对比)

hsqldb 的研究与性能测试(与mysql对比) 1. hsqldb 简介 hsqldb 数据库是一款纯 java 编写的免费数据库,许可是 bsd-style 的协议。相对其他数据库来说,其体积小,才 563kb 。仅一个 hsqldb.jar 文件就包括了数据库引擎,数据库驱动,还有其他用户界面操作
hsqldb的研究与性能测试(与mysql对比)1.      hsqldb简介hsqldb数据库是一款纯java编写的免费数据库,许可是bsd-style的协议。相对其他数据库来说,其体积小,才563kb。仅一个hsqldb.jar文件就包括了数据库引擎,数据库驱动,还有其他用户界面操作等内容。在java开源世界里,hsql是极为受欢迎的(就java本身来说),jboss应用程序服务器默认也提供了这个数据库引擎。由于其体积小的原因,又是纯java设计,又支持sql99,sql2003大部分的标准,所以也是作为商业应用程序展示的一种选择。
2.      hsqldb的工作模式:1) in-process(standalone)模式
主要是在一个jvm中使用,不能通过网络来访问数据库,数据存储格式为文本文件。
2)     memory-only单机模式
主要是在一个jvm中使用,不能通过网络来访问数据库,只存储在内存中。
3)     memory-only网络模式(本机访问)
数据存储在内存中,支持本地访问和网络访问,可应用于多个jvm间进行数据交换。
4)     server模式(本机访问)
类似我们常用的mysql、oracle等数据库,支持本地访问和网络访问,数据存储格式为文本文件。
5)     webserver模式
和server运行模式基本一样,只是支持了http等协议,主要用于防火墙,其余的和server模式完全一致。
3.      测试的sql语句:6)     create
create table t0(no integer,a char(20),b char(20),c char(20),d char(20),e char(20),f char(20),g char(20),h char(20),i char(20),j char(20),k char(20),l char(20),m char(20),n char(20),o char(20),p char(20),q char(20),r char(20),s char(20),t char(20));
7)     insert
insert into t0 values (0,'00','01','02','03','04','05','06','07','08','09','010','011','012','013','014','015','016','017','018','019');
8)     select
select * from t0;
9)     select.all
select a,b,c,d,e from t0
10)select.join
select tmp1.no no1,tmp2.no no2 from t0 tmp1,t0 tmp2 where (tmp1.no%5=0) and (tmp2.no-tmp1.no)=4;
4.     测试数据记录表:字段个数
测试用例
测试次数(次)
in-process(standalone)模式耗时(ms)
memory-only单机模式耗时(ms)
memory-only网络模式(本机访问)耗时(ms)
memory-only网络模式(网络访问)耗时(ms)
server模式(本机访问)耗时(ms)
server模式(远程访问)耗时(ms)
mysql(本机访问)耗时(ms)
mysql(远程访问)耗时(ms)
21个
create
20次
0
0
0
32
15
16
344
312
insert
10000次
984
844
1688
7343
1875
7938
2281
8969
select
5000次
40531
40109
1156859
>20分钟,实在等不下去了
1181094
>20分钟,实在等不下去了
432563
782437
select
1000次
4234
4703
92031
667359
select
100次
468
469
9031
67328
11个
create
20次
0
0
insert
10000次
672
576
select
5000次
27641
28672
select
1000次
5个
create table t0(no integer primary key,a char(20),b char(20),c char(20),d char(20),e char(20));
20次
0
0
0
312
insert into t0 values (0,'00','01','02','03','04');
10000次
375
406
1203
1985
select * from t0;
5000次
21968
19860
select * from t0;
1000次
25828
select * from t0;
100次
512
2594
select a,b,c,d,e from t0
5000次
19313
select a,b,c,d,e from t0
100次
391
2266
select tmp1.no no1,tmp2.no no2 from t0 tmp1,t0 tmp2 where (tmp1.no%5=0) and (tmp2.no-tmp1.no)=4;
100次
不支持%
226047
select tmp1.no no1,tmp2.no no2 from t0 tmp1 join t0 tmp2 on (tmp2.no-tmp1.no)=4;
1次
32062
11219
select tmp1.no no1,tmp2.no no2 from t0 tmp1 join t0 tmp2 on mod(tmp1.no,5) = 0 and (tmp2.no-tmp1.no)=4 ;
1次
6360
2078
select tmp1.no no1,tmp2.no no2 from t0 tmp1 join t0 tmp2 on tmp1.no>50 and (tmp2.no-tmp1.no)=4 ;
1次
32063
36031
10000
select no from t0 where mod(no,5) = 0 ;
100次
1328
688
select no from t0 where no>50 ;
100次
250
1719
select no from t0 where no>50 and no
100次
94
203
delete from t19 where no>=0 and no(为no创建了索引)
10000次
344
328
1063
1141
1547
delete from t19 where no>=0 and no(没有为no创建了索引)
10000次
2282
2125
3156
3484
2359
update t19 set a=123 where no>=0 and no(为no创建了索引)
10000次
1610
750
1515
3078
2218
update t19 set a=123 where no>=0 and no(没有为no创建了索引)
10000次
4297
2734
3656
5594
2547
21个
create
20次
0
16
31
32
16
16
328
313
insert
500次
125
78
172
421
141
734
156
453
select
500次
234
250
8078
17438
10078
18125
1078
3234
16个
create
20次
15
0
16
31
31
16
312
344
insert
500次
110
78
156
391
125
122
157
469
select
500次
218
219
5890
13250
6329
13422
859
2515
11个
create
20次
16
0
16
15
0
16
312
328
insert
500次
78
79
156
344
109
406
156
453
select
500次
172
203
3469
7391
1985
7438
610
1906
6个
create
20次
0
0
15
15
0
16
312
313
insert
500次
78
63
141
329
109
672
156
437
select
500次
141
156
1516
3968
969
3937
469
1407
从上表可见:
1)    支持远程访问时,执行create、insert语句,hsqldb明显比mysql具有优势。
2)    支持远程访问时,执行select查询语句,mysql比hsqldb具有优势。
3)    “memory-only网络模式”和“server模式”在效率上差别不明显。
4)    “in-process(standalone)模式”和“memory-only单机模式” 在效率上差别不明显。
5)    只允许单机访问时,hsqldb明显比mysql具有明显的优势。(写速度2:1,读速度4:1)
6)    hsqldb对join查询的效率显著不如mysql
其它类似信息

推荐信息