SQLite数据库与其它一些数据库的性能比较
这是从一篇繁体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=16M
key_buffer_size=16M
table_cache=128
sort_buffer_size=4M
其余选项均为預設值。
数据库的连接字符串:
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)
从上面结果看出: