简体   繁体   English

在进入SQLite之前的任何考虑因素?

[英]Any considerations before jumping into SQLite?

I have a WCF application that at present is using XML based file storage to store data that gets used to generate reports. 我有一个WCF应用程序,目前使用基于XML的文件存储来存储用于生成报告的数据。 Besides this processing decisions are made based on information stored in these XML files. 除此之外,处理决策基于存储在这些XML文件中的信息。

I'm now hitting volumes of around 30 000 text files. 我现在正在翻阅大约3万个文本文件。 This is incredibly taxing, and the application at times comes to a grinding halt. 这令人难以置信的负担,并且应用程序有时会停止运转。

I've always wanted to swop out the XML DAL in favor of an RDBMS, but project managers simply won't allow it. 我一直想把XML DAL转向支持RDBMS,但项目经理根本不会允许它。 But they would be willing to look at a serverless solution for example SQLLite. 但他们愿意看一下无服务器的解决方案,例如SQLLite。 I am really tempted to just dive right in and start using it as a replacement DAL (Data Access Layer). 我真的很想直接进入并开始使用它作为替代DAL(数据访问层)。

I would need no more than around 20 tables in the whole solution, and I would expect to get no more than around 20 000 - 100 000 transactions a day, however this is extreme, the real volumes would be less than this in most cases. 在整个解决方案中,我只需要大约20个表,而且我预计每天不会超过大约20 000到10万个交易,但这是极端的,在大多数情况下,实际数量将少于此。

Update 更新

I am not expecting a great deal of simultaneous connections, when I say transactions, I essentially mean 1 or 2 clients that make calls and execute against the database in order. 我不期待大量的同时连接,当我说事务时,我本质上是指1或2个客户端按顺序进行调用并对数据库执行。 At times there might be a possibility of external clients making quick calls to the DB. 有时外部客户端可能会快速调用数据库。 But the bulk of DB connections will be done by my WCF service, which is a back end scheduled task, not serving 100's of people across an organization. 但是大部分数据库连接将由我的WCF服务完成,这是一项后端计划任务,不能为整个组织的100名员工提供服务。

Another good point is that I only need to retain data for 90 days, so the DB shouldn't grow too big. 另一个好处是我只需要保留90天的数据,因此数据库不应该变得太大。

My main concerns are: 我主要担心的是:

How reliable is SQLLite? SQLLite的可靠性如何? What if the DB File gets corrupted, will I loose all processing Data. 如果数据库文件被破坏怎么办,我将丢失所有处理数据。 How easy is the DB to back up? DB备份有多容易? Will it handle my volumes? 它会处理我的卷吗? And lastly how well does the .net provider work (located here: http://sourceforge.net/projects/sqlite-dotnet2/ ). 最后.net提供程序的工作情况如何(位于这里: http//sourceforge.net/projects/sqlite-dotnet2/ )。

If you have any experience with SQLLite, please post your experiences so I can make aan informed decision to switch or not. 如果您对SQLLite有任何经验,请发布您的经验,以便我做出明智的决定是否切换。

Thanks in advance... 提前致谢...

SQLite is as reliable as your OS and hardware. SQLite与您的操作系统和硬件一样可靠。

Its transactional rate is similar to SQL server, and often faster because it's all in process. 它的事务速率类似于SQL服务器,并且通常更快,因为它全部在进行中。

The .NET ADO provider works great. .NET ADO提供程序运行良好。

To back up the DB, stop the service and copy the file. 要备份数据库,请停止服务并复制文件。 If the journal file is present copy it too. 如果日志文件存在,也将其复制。

EDIT: SQLite uses UTF-8 by default so with the ADO-NET provider you should be able to avoid losing accents (just so long as you follow the typical XML in string rules). 编辑:SQLite默认使用UTF-8,因此对于ADO-NET提供程序,您应该能够避免丢失重音(只要您遵循字符串规则中的典型XML)。

You could consider Microsoft's Sql Compact Edition. 您可以考虑使用Microsoft的Sql Compact Edition。
It's like sqlite, in terms of being a single file embedded database, but has better integration with the .net framework :) 它就像sqlite,就单个文件嵌入式数据库而言,但与.net框架有更好的集成:)
SQLite seems reliable, and even with Microsoft's one, don't expect to receive much support in case of a corrupted database. SQLite似乎很可靠,即使是微软的SQLite,也不希望在数据库损坏的情况下获得太多支持。

Given your transaction volume I'd say the fact that the DB itself is a single monolithic file with only file system locking available could be a problem. 鉴于您的事务量,我会说数据库本身是一个单一的整体文件,只有文件系统锁定可用是一个问题。

There is no row based locking as far as I know. 据我所知,没有基于行的锁定。

I used SQLite with the .Net provider without problems in a monouser enviroment, except for one concern: accents, wich don't showed correcly. 我使用SQLite与.Net提供商在monouser环境中没有问题,除了一个问题:口音,没有显示正确。 The backup is quite simply: the SQLite database is an plain text file. 备份非常简单:SQLite数据库是纯文本文件。 Simply copy it. 只需复制它。

I use Sqlite for storing XML config data and have had no problems with it. 我使用Sqlite存储XML配置数据并且没有任何问题。 I use the System.Data.Sqlite provider: http://sqlite.phxsoftware.com/ . 我使用System.Data.Sqlite提供程序: http//sqlite.phxsoftware.com/ It's solid and has a good support forum. 它很扎实,并有一个很好的支持论坛。 It also includes a LINQ provider. 它还包括一个LINQ提供程序。 It also integrates with VS 2008 so you can use Server Explorer to query tables. 它还与VS 2008集成,因此您可以使用Server Explorer查询表。 The examples and documentation also show how to use parameterized commands and transactions for increased performance. 示例和文档还说明了如何使用参数化命令和事务来提高性能。

The release candidate for LinqPad now supports Sqlite: http://www.linqpad.net/Beta.aspx . LinqPad的候选版本现在支持Sqlite: http//www.linqpad.net/Beta.aspx

Sqlite stores everything in a single file, which can be backed up like any other binary file. Sqlite将所有内容存储在一个文件中,可以像任何其他二进制文件一样进行备份。

Sqlite only supports file-level locking, but shouldn't present a performance problem since it doesn't sound like you'll have a large number of simultaneous transactions. Sqlite只支持文件级锁定,但不应该出现性能问题,因为它听起来不像你会有大量的同步事务。

Unicode shouldn't be a problem. Unicode应该不是问题。 This link in the forum addresses an area where someone was trying to read unicode characters with an incompatible utility http://sqlite.phxsoftware.com/forums/t/954.aspx . 论坛中的这个链接解决了某人试图用不兼容的实用程序http://sqlite.phxsoftware.com/forums/t/954.aspx读取unicode字符的区域。

This site shows how to do case-insenitive UTF8 comparisons using System.Data.Sqlite via a custom collator, with Russian characters as an example: http://www.codeproject.com/KB/database/SQLiteUTF8CIComparison.aspx . 该站点显示了如何通过自定义整理器使用System.Data.Sqlite进行大小写的UTF8比较,以俄语字符为例: http//www.codeproject.com/KB/database/SQLiteUTF8CIComparison.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM