哪个更省时?文件存储或 SQLite
我正在开发一个 Firefox 扩展,用作用户分析和 Web 个性化引擎。需要存储网页的TF-IDF相关数据。我的问题是,哪个会产生更快的简单搜索结果?
一个。使用自定义数据结构并将整个数据结构存储在文件中,将其加载到内存并查询它?
或
b.存储和查询 SQLite 数据库中的数据?
可以安全地假设一个表中有大约 250,000 行的最坏情况。
I am developing a firefox extension which is to serve as a user profiling and web personalization engine. It needs to store TF-IDF related data of web pages. My question is, which would produce faster simple search results?
a. Using a custom data structure and storing the entire data structure in a file, loading it to memory and querying it?
OR
b. Storing and querying and the data off an SQLite database?
It is safe to assume a worst case scenario of around 250,000 rows in one of the tables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题基本上可以归结为
:我应该编写自己的数据存储系统的自定义实现吗?
或
b.我应该使用现成的、经过验证的数据存储系统吗?
我想说,如果您采用第一种方法,那么:
另一种看待这个问题的方式是:为什么不使用 SQLite?对于您的场景来说,它是否存在某种问题?我想不出任何一个。
我当然倾向于从 SQLite(或类似的东西)开始。如果事实证明它在某种程度上不起作用,只有在用尽任何其他现成的替代方案之后,我才会考虑编写自己的数据存储库。
Your question basically boils down to:
a. Should I write my own custom implementation of a data storage system?
or
b. Should I use an off-the-shelf, proven data storage system?
I would say if you go with the first approach, that:
Another way of looking at this is: why would you NOT use SQLite? Is there some kind of problem with it for your scenario? I can't think of any.
I would certainly be inclined to start with SQLite (or something similar). If it proves to not work in some way, only after exhausting any other off the shelf alternatives would I consider writing my own data storage library.
为什么不能使用像字典或二叉树这样的数据结构。基于搜索、检索、插入和插入次数的数据结构?删除。
Why can't using some data structure like dictionary or binary tree.Base the data structure on number of search,retreivals,insert & delete.