需要为我的应用程序保存大量记录...我应该使用本地数据库吗?

发布于 2024-11-10 08:32:34 字数 477 浏览 0 评论 0原文

我即将开始开发“时间机器”对于窗户。我需要在表中存储很多记录。每次执行备份时,我都会写入大约 50,000 条记录,因为这就是我计算机中的文件数量(每条记录与存储文件无关。记录将包含每个文件所在的路径)无论如何我不'我不知道是否可以使用 XML 来存储我的记录,因为我的查询不会很复杂,而且与创建本地数据库相比,部署起来更容易,但我不知道它是否会更有效,因为即使查询会很简单 我要去处理大量数据。而且,我不知道本地数据库是否可以大于2GB,我估计如果经常使用一年,数据库将达到3GB左右。

我更喜欢使用 XML 并使用 Xpath 进行查询,从而更轻松地部署我的应用程序。但是,如果事实证明创建本地数据库更有效,并且 XML 会减慢我的应用程序的速度,因为我有太多记录,那么我将创建一个本地数据库。任何其他建议都会有帮助,也许我需要做其他事情。

I am about to start developing a "time machine" for windows. I need to store a lot of records in a table. Every time I perform a backup I will write about 50,000 records because that's how many files I have in my computer (each records has nothing to do with storing a file. the record will contain the path where each file is located) Anyways I don't know if I could use XML to store my records since my queries are not going to be complicated plus it is easier to deploy versus creating a local database where I don't know if it is going to be more efficient because even though the queries are going to be simple I am going to be dealing with a lot of data. Moreover, I don't know if a local database can be bigger than 2GB and I am estimating that the database is going to be about 3 GB if regularly used for a year.

I prefer to use XML and use Xpath to do queries making it easier to deploy my application. But if creating a local database turns out to be more efficient and XML is going to slow my application because I have so many records then I will create a local database instead. Any other recommendations will be helpful maybe I need to do something else.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

杀手六號 2024-11-17 08:32:34

看一下 SQLite

这是一个嵌入式但功能强大的数据库。您不需要安装 SQL Server 实例。
你可以把这个数据库看成是一个带有一定API的文件。 API 允许您针对此文件运行 SQL 查询。

Take a look at SQLite.

This is embedded yet powerful database. You don't need to install SQL server instance.
You can think of this database as a file with certain API. API allows you to run SQL queries against this file.

黑凤梨 2024-11-17 08:32:34

SQL Server 2008 R2 Express 允许数据库大小最大为 10GB - 因此这可能是值得的考虑到您估计的空间需求。

最好将数据存储在某种形式的数据库中,而不是存储在 XML 中,因为后者会迅速增长到查询变得非常慢并且占用内存的大小。

SQL Server 2008 R2 Express allows databases of up to 10GB in size - so this may well be worth considering given your estimated space requirement.

It's much better to store your data in some form of database rather that in XML - as the latter will quickly grow to such a size that querying will become very slow and memory intensive.

拿命拼未来 2024-11-17 08:32:34

当您尝试访问数据时,使用 XML 存储大量数据将需要大量内存。在存储空间使用方面也不是很有效。我建议使用 SQL 版本。您可以使用 Microsoft SQL 的 Express 版本之一,也可以使用开源 SQL 风格,例如 MySQL。

当您想要存储大量信息时,您需要考虑关系数据库。如果您真的不想走这条路,您可以考虑将每个备份存储在其自己的 XML 文件中。这将提供更多的可移植性,并且在访问存档数据时会减少内存占用。

Using XML for storage of large amounts of data will require a lot of memory usage when you attempt to access the data. It is also not very efficient when it comes to space usage for storage. I would recommend going with a version of SQL. You could use one of the Express editions of Microsoft SQL or you could use an open source SQL flavor such as MySQL.

When you are looking at storing a lot of information, you need to look to a relational database. If you REALLY don't want to go this route, you could look at storing each backup in its own XML file. This would allow more portability and it would reduce your memory footprint when accessing the archived data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文