时间:2021-07-01 10:21:17 帮助过:73人阅读
虽然Firebird总体上是比Access好,但是没有传说的那么好,至少在Net环境下。 1、测试环境 A、系统环境 操作系统:Windows XP Professional Server Pack 2 CPU:Intel(R) Pentium(R) 4 CPU 3.00GHZ 2.99GHZ 内存:1G B、代码环境 NET2.0、Access2003、Firebir
虽然Firebird总体上是比Access好,但是没有传说的那么好,至少在Net环境下。
1、测试环境
A、系统环境
操作系统:Windows XP Professional Server Pack 2
CPU:Intel(R) Pentium(R) 4 CPU 3.00GHZ 2.99GHZ
内存:1G
B、代码环境
NET2.0、Access2003、Firebird2.1、
Firebird的NET2.0访问API(FirebirdSql.Data.FirebirdClient.dll)
2、数据库
EmployeeInfo表:
CREATE TABLE EMPLOYEEINFO(
EID Integer NOT NULL,
ENAME Varchar(50),
ETELEPHONE Varchar(50),
EMOBILE Varchar(50),
EADDRESS Varchar(200),
EWORK Varchar(50),
ECOMPANY Varchar(50),
EAGE Integer,
ESCHOOL Varchar(50),
EBIRTHDAY Date,
EFAVOURATE Varchar(500),
ISMVP Integer,
ELEVEL Integer,
ENABLE_FLAG Integer,
CONSTRAINT EMPLOYEEINFO_NAME PRIMARY KEY (EID)
);
3、测试代码
见附带文件
4、性能比较
下面的数字是以毫秒为单位的,对于两个数据库连接的性能在4.1中有记录,因为其他的操作连接的性能基本相同,所以在其他的比较中省略了。
新增操作:需要从数据表中获取ID,所以都需要执行ExecuteScalar
Access:SELECT max(EId) + 1 FROM EmployeeInfo
Firebird:SELECT first 1 GEN_ID( EMPLOYEEINFO_KEY_GEN, 1) FROM RDB$GENERATORS
预编优化:这种方式是采用IDbCommand的Prepare方法来进行的。
4.1、单条数据的操作比较
1、新增操作
IDbConnection.Open() | IDbCommand.ExecuteScalar() | IDbCommand.ExecuteNonQuery() | |
Access | 174.238416 | 102.448561 | 41.695030 |
159.298931 | 101.921224 | 41.537487 | |
185.202748 | 102.383310 | 36.008230 | |
FireBird | 381.801163 | 59.864800 | 38.652679 |
360.196079 | 69.475482 | 39.371224 | |
343.838800 | 60.606686 |
39.241575 |
2、 修改操作
Access | FireBird | |
IDbCommand.ExecuteNonQuery() | 125.531627 | 88.544622 |
105.508891 | 88.177334 | |
145.817176 | 107.016208 |
1、新增操作
IDbCommand.ExecuteScalar() | IDbCommand.ExecuteNonQuery() | |
Access | 275.494317 | 234.020361 |
261.396954 | 237.707107 | |
252.611140 | 253.758009 | |
预编译优化 | 124.001096 | 100.539268 |
124.581257 | 98.269848 | |
125.422189 | 99.034516 | |
预编译+事务控制 | 156.688199 | 99.945657 |
116.741034 | 80.133735 | |
113.269134 | 82.601144 | |
FireBird | 838.318433 | 969.816292 |
887.597984 | 1064.949756 | |
818.385955 | 1022.706634 | |
预编译优化 | 308.331690 | 437.868342 |
283.292181 | 551.306577 | |
222.096816 | 455.877916 | |
预编译+事务控制 | 70.281354 | 109.981409 |
72.199458 | 96.185741 | |
69.851572 | 91.551454 |
2、 修改操作
Access | FireBird | |
IDbCommand.ExecuteNonQuery() | 411.009308 | 913.508742 |
396.797053 | 868.117194 | |
399.259210 | 912.881623 | |
预编译优化 | 177.652866 | 692.759320 |
163.982479 | 709.243510 | |
171.324164 | 644.216015 | |
预编译+事务控制 | 158.654429 | 106.195976 |
154.795059 | 101.715139 | |
157.486357 | 104.424021 |
1、新增操作
IDbCommand.ExecuteScalar() | IDbCommand.ExecuteNonQuery() | |
Access | 1651.840012 | 2133.541653 |
1663.862358 | 2144.262530 | |
1631.403159 | 2135.223692 | |
预编译优化 | 796.962979 | 808.875114 |
785.243696 | 793.758126 | |
809.209726 | 797.399235 | |
预编译+事务控制 | 728.416438 | 610.310033 |
873.088523 | 898.503055 | |
673.583191 | 603.249033 | |
FireBird | 7737.366552 | 9359.178169 |
7308.689064 | 10904.423101 | |
7724.148976 | 11846.604215 | |
预编译优化 | 3716.587264 | 5723.248900 |
3234.737922 | 5430.311542 | |
2686.714810 | 4821.239747 | |
预编译+事务控制 | 522.050014 | 642.658276 |
522.211388 | 665.879242 | |
532.323116 | 658.373523 |
2、 修改操作
Access | FireBird | |
IDbCommand.ExecuteNonQuery() | 3290.740559 | 7873.507740 |
3991.333695 | 7822.996734 | |
3293.068174 | 7116.759956 | |
预编译优化 | 1398.160890 | 6482.893171 |
1254.979979 | 6302.055985 | |
1245.802121 | 6272.648019 | |
预编译+事务控制 | 1097.316477 | 648.313099 |
1221.636742 | 648.390276 | |
1104.532568 | 648.983446 |
1、新增操作
IDbCommand.ExecuteScalar() | IDbCommand.ExecuteNonQuery() | |
Access | 15321.344697 | 20695.870283 |
15522.056899 | 20775.041631 | |
15319.349251 | 20727.514825 | |
预编译优化 | 10627.689828 | 9980.130051 |
11161.361432 | 10432.259290 | |
10580.619317 | 9925.817398 | |
预编译+事务控制 | 6191.647891 | 6037.020082 |
6855.991305 | 6306.552880 | |
6659.638395 | 6042.067384 | |
FireBird | 92770.835360 | 119561.011190 |
115369.304783 | 143528.391259 | |
135761.012112 | 165465.676440 | |
预编译优化 | 61204.197587 | 94345.156610 |
36930.112494 | 57278.146122 | |
40012.081468 | 66210.081814 | |
预编译+事务控制 | 5407.627206 | 6910.738469 |
5488.005238 | 7106.846560 | |
5524.538831 | 6740.408060 |
2、 修改操作
Access | FireBird | |
IDbCommand.ExecuteNonQuery() | 39694.855804 | 99310.751707 |
35354.716525 | 90011.911178 | |
36534.236655 | 91112.061482 | |
预编译+事务控制 | 10469.019093 | 7230.535415 |
10444.395741 | 7682.581104 | |
10329.116616 | 7390.059610 |
1、新增操作
IDbCommand.ExecuteScalar() |
IDbCommand.ExecuteNonQuery() | ||
Access |
198287.389450 |
223781.708768 | |
207229.904897 |
227152.302183 | ||
236267.203150 |
251924.067059 | ||
预编译优化 |
75745.455466 |
80136.166440 | |
80215.392531 |
84041.511179 | ||
83531.057454 |
85371.502942 | ||
预编译+事务控制 |
73753.320106 |
62696.035496 | |
70442.642879 |
69222.947557 | ||
79447.569370 |
70056.168140 | ||
FireBird |
>30分钟 |
||
预编译优化 | 297619.975597 |
551716.871984 |
|
预编译+事务控制 | 50412.421478 |
62230.369322 |
|
52912.052985 |
69931.034354 |
||
52509.019944 |
66763.649792 |
||
2、 修改操作
Access | FireBird | |
IDbCommand.ExecuteNonQuery() | 332451.315712 |
1260805.499906 |
347068.025903 | ||
预编译优化 | 164528.339360 | 643502.447928 |
预编译+事务控制 | 108129.478762 | 81140.664313 |
1、新增操作
IDbCommand.ExecuteScalar() |
IDbCommand.ExecuteNonQuery() |
||
预编译优化Access | 479207.809593 |
465971.617839 |
|
377229.922041 |
367370.094465 |
||
预编译+事务控制 | 336857.065763 |
316500.809166 |
|
预编译优化FireBird |
>60分钟 |
||
预编译+事务控制 |
273555.344525 |
361675.703063 | |
2、 修改操作
Access | FireBird | |
预编译+事务控制 | 512516.135296 | 473002.155994 |
Access | FireBird | |
SELECT * FROM table | 561.603041 | 705.621894 |
528.617866 | 804.226516 | |
SELECT * From table WHERE name like ‘%...%’ | 531.510943 | 720.582087 |
525.499398 | 761.811122 |
Access | FireBird | |
SELECT * FROM table | 588.116789 | 771.333159 |
615.835833 | 743.432148 | |
SELECT * From table WHERE name like ‘%...%’ | 557.460599 | 715.724471 |
564.812336 | 724.736215 |
Access | FireBird | |
SELECT * FROM table | 1134.614770 | 1337.971064 |
1015.374508 | 1261.249305 | |
SELECT * From table WHERE name like ‘%...%’ | 737.451880 | 925.413277 |
751.952307 | 910.842727 |
Access | FireBird | |
SELECT * FROM table | 6501.658483 | 6335.985464 |
5426.486788 | 6899.610531 | |
SELECT * From table WHERE name like ‘%...%’ | 3204.588434 | 3298.303960 |
3203.261492 | 3810.441583 |
Access | FireBird | |
SELECT * FROM table | 28380.649119 | 34032.733181 |
28227.096199 | 34557.834127 | |
SELECT * From table WHERE name like ‘%...%’ | 18065.770127 | 19266.049635 |
18412.904426 | 17163.350933 |
Access文件大小的增长是非常恐怖的,1000000条左右的数据基本上可以达到Access的极限(2G)
Firebird文件大小的增长和Access比较起来,比Access要小很多,基本上是差了几个级别
下面是分别进行大数量操作后的文件情况:
Firebird 94808KB
Access 1123424KB
在不压缩数据库的前提下,Access增加100W左右的数据达到2G,Firebrid增加1000W左右的数据达到2G。
5、测试总结
根据上面的性能比较,可以得出以上几点结论: