本文共 6093 字,大约阅读时间需要 20 分钟。
今日用到了SQLite,发现这个数据库进行了很大的升级,从3.4.X升级到3.5.X了。版本号发生改变,API接口OS层发生重大改变。
SQLite version 3.5.0 introduces a new OS interface layer that is incompatible with all prior versions of SQLite. In addition, a few existing interfaces have been generalized to work across all database connections within a process rather than just all connections within a thread. The purpose of this article is to describe the changes to 3.5.0 in detail so that users of prior versions of SQLite can judge what, if any, effort will be required to upgrade to newer versions.
A quick enumeration of the changes in SQLite version 3.5.0 is provide here. Subsequent sections will describe these changes in more detail.
Of these changes, only 1a and 2a through 2c are incompatibilities in any formal sense. But users who have previously made custom modifications to the SQLite source (for example to add a custom OS layer for embedded hardware) might find that these changes have a larger impact. On the other hand, an important goal of these changes is to make it much easier to customize SQLite for use on different operating systems.
由于存储层的改变,SQLite.NET的各个版本也发生了变化:
是最后一个基于3.4.X版本的提供程序;
是当前最新的基于3.5.4代码的提供程序; SQLite.NET的新版本主要是随SQLite3.4->3.5的改进而进行了相应的修改。性能有很大变化,对比如下:1.0.46 test Beginning Test on System.Data.SQLite.SQLiteConnection SUCCESS - CreateTable SUCCESS - Full Text Search SUCCESS - DataType Test SUCCESS - Dispose pattern test SUCCESS - KeyInfo Fetch SUCCESS - Transaction Enlistment SUCCESS - Guid Test SUCCESS - InsertTable SUCCESS - VerifyInsert SUCCESS - CoersionTest SUCCESS - ParameterizedInsert SUCCESS - BinaryInsert (using named parameter) SUCCESS - VerifyBinaryData SUCCESS - LockTest SUCCESS - ParameterizedInsertMissingParamsInserting using CommandBuilder and DataAdapter -> (10,000 rows) ... -> Insert Ends in 210 ms ... Commits in 481 msInserting using CommandBuilder and DataAdapter ->(with identity fetch) (10,000 rows) ... -> Insert Ends in 300 ms ... Commits in 201 msFast insert using parameters and prepared statement -> (100,000 rows) Begins ... -> Ends in 801 ms ... Commits in 441 msUser Function iteration of 120003 records in 240 ms Raw iteration of 120003 records in 100 ms Intrinsic Function iteration of 120003 records in 70 msUser (text) command executed 397517 times in 1 second. UserFunction command executed 570342 times in 1 second. Intrinsic command executed 932032 times in 1 second. Intrin (txt) command executed 747247 times in 1 second. Raw Value command executed 1013199 times in 1 second.UserAggregate executed 17 times in 1 second. SUCCESS - UserCollation SUCCESS - DropTableTests Finished. | 1.0.48 test Beginning Test on System.Data.SQLite.SQLiteConnection SUCCESS - CreateTable SUCCESS - Full Text Search SUCCESS - DataType Test SUCCESS - Dispose pattern test SUCCESS - KeyInfo Fetch SUCCESS - Transaction Enlistment SUCCESS - Guid Test SUCCESS - InsertTable SUCCESS - VerifyInsert SUCCESS - CoersionTest SUCCESS - ParameterizedInsert SUCCESS - BinaryInsert (using named parameter) SUCCESS - VerifyBinaryData SUCCESS - LockTest SUCCESS - ParameterizedInsertMissingParamsInserting using CommandBuilder and DataAdapter -> (10,000 rows) ... -> Insert Ends in 411 ms ... Commits in 100 msInserting using CommandBuilder and DataAdapter ->(with identity fetch) (10,000 rows) ... -> Insert Ends in 440 ms ... Commits in 131 msFast insert using parameters and prepared statement -> (100,000 rows) Begins ... -> Ends in 1312 ms ... Commits in 340 msUser Function iteration of 120003 records in 191 ms Raw iteration of 120003 records in 130 ms Intrinsic Function iteration of 120003 records in 140 msUser (text) command executed 298951 times in 1 second. UserFunction command executed 418648 times in 1 second. Intrinsic command executed 599105 times in 1 second. Intrin (txt) command executed 458549 times in 1 second. Raw Value command executed 655652 times in 1 second.UserAggregate executed 15 times in 1 second. SUCCESS - UserCollation SUCCESS - DropTableTests Finished. |
由测试可知,3.4版的SQLite在很多方面,性能依然要比3.5版的SQLite强不少。但是SQLite 3.5版在OS适配层的改进(引入VFS对象),提高了数据的写入效率,明显的,其Commits的时间总是较少。
结论: 3.4版的SQLite在数据插入较多的应用情况下,效率仍然较好; 3.5版的SQLite在数据写入磁盘方面有很大改进,但其显然在内存数据组织方面还有待改进,插入操作所耗费的时间明显比3.4版要长; 感觉3.4版的SQLite是非常稳定的一个版本。3.5版,看来等等再使用了。
本文转自斯克迪亚博客园博客,原文链接:http://www.cnblogs.com/sgsoft/archive/2008/02/19/1074055.html,如需转载请自行联系原作者