这是从一篇繁体blog中的文章:http://blog.joycode.com/fish/archive/2004/08/13/30653.aspx
MySQL(MyODBC/ByteFx),SQLite(V3),Access(2003),MSSQL(2000Sp3) 之间的效能測試
今天写了一个简单的测试程序,目的为了解自己目前所使用数据库的性能,并希望能从中調整出更好的結果。
下面是多次测试的結果:
测试环境: Windows2003,.NET Framework 1.1,no AntiVirus,1GB memory
测试的数据库: sqlite V3,MysqL Type=InnoDB,sql Server 2000 Sp3,Access 20003
参数设置:
MysqL (預設*2)
max_allowed_packet=
key_buffer_size=
table_cache=128
sort_buffer_size=
其余选项均为預設值。
数据库的连接字符串:
Private MSsqlConnStr As String = "initial catalog=CodeLib;Connect Timeout=20;data source=(local);integrated security=SSPI;persist security info=False;"
Private MysqLODBCConnStr As String = "DRIVER={MysqL ODBC 3.51 Driver};DATABASE=CodeLib;OPTION=18475;SERVER=localhost;UID=;PASSWORD=;"
Private MysqLByteFXConnStr As String = "Database=CodeLib;Data Source=localhost;User Id=;Password="
Private OLEDBConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=1.mdb"
Private sqliteConnStr As String = "Data Source=;New=True;Version=3"
INSERT with Transaction 10000笔记录:
00.6089(sqlite) < 01.1677(MSsql) < 02.5346(ByteFx) < 08.9000(Access) < 13.9242(MyODBC)0~10000
00.5476(sqlite) < 01.2679(MSsql) < 02.4982(ByteFx) < 08.6672(Access) < 13.5140(MyODBC)10000~20000
00.5245(sqlite) < 01.1508(MSsql) < 02.5150(ByteFx) < 08.7101(Access) < 13.6411(MyODBC)20000~30000
INSERT with Transaction 50000笔记录:
03.4739(sqlite) < 09.4173(MSsql) < 13.6408(ByteFx) < 44.3165(Access) < 71.6529(MyODBC)50000
INSERT without Transaction 300笔记录:
00.0908(MSsql) < 00.3520(Access) < 10.3717(MyODBC) < 11.5118(ByteFx) < 25.8230(sqlite)30000~30300
00.0907(MSsql) < 00.3686(Access) < 08.7148(ByteFx) < 11.3625(MyODBC) < 25.1898(sqlite)30300~30600
00.1027(MSsql) < 00.3595(Access) < 08.4664(ByteFx) < 08.7934(MyODBC) < 25.3364(sqlite)30600~31200
SELECT 31200笔记录:
00.4161(sqlite) < 00.8362(MSsql) < 00.8688(Access) < 02.3565(MyODBC) < 02.4857(ByteFx)
00.3519(sqlite) < 00.5707(Access) < 00.7055(MSsql) < 02.5555(MyODBC) < 02.6173(ByteFx)
00.3472(sqlite) < 00.6037(MSsql) < 00.6707(Access) < 02.5439(ByteFx) < 02.6328(MyODBC)
SELECT 50000笔记录:
00.6129(sqlite) < 01.0132(MSsql) < 01.2942(Access) < 04.0064(ByteFx) < 04.4904(MyODBC)
00.6741(sqlite) < 00.9719(MSsql) < 01.2956(Access) < 03.7336(ByteFx) < 04.6592(MyODBC)
DELETE 31200笔记录:
00.0091(Access) < 00.0247(ByteFx) < 00.1960(sqlite) < 00.6901(MSsql) < 01.2297(MyODBC)
DELETE 50000笔记录:
00.0092(Access) < 00.0301(ByteFx) < 00.3305(sqlite) < 01.9281(MyODBC) < 03.0269(MSsql)
从上面结果看出:
sqlite3 在不执行行事务处理的情況下不是很理想,但SELECT速度相当快。
MSsql/Access无论是否执行事务处理的性能都相當不錯。
MysqL的ByteFx与MyODBC在Insert/Delete的速度上差异略为明显。
以上数据仅供参考,如果您对结果有更好的建议也请让我知道。
sqlite在不开事务的情况下就是一种悲剧,因为它的多访问支持是建立在对文件的独占和共享基础上的。
sqlite与其它数据库的性能比较可参看官方网:http://www.sqlite.org/speed.html
原文链接:https://www.f2er.com/sqlite/203261.html