【学习】XML VS SQLite

Advantages of sqlite over xml:

  • everything in one file,
  • performance loss is lower than XML as cache gets bigger,
  • you can keep feed metadata separate from cache itself (other table), but accessible in the same way,
  • SQL is probably easier to work with than XPath for most people.

Disadvantages of sqlite:

  • can be problematic with multiple processes accessing same database (probably not your case),
  • you should know at least basic SQL. Unless there will be hundreds of thousands of items in cache, I don't think you will need to optimize it much,
  • maybe in some way it can be more dangerous from security standpoint (SQL injection). On the other hand, you are not coding web app, so this should not happen.


Here is a summary

  1. For tree data, XML is much easier to query and modify using XPATH.

  2. For small datasets (less than 10M), XML blew away sqlite in performance.

  3. For large datasets (greater than 10M-100M), XML load time and memory usage became a big problem, to the point that some computers become unusable.

  4. We couldn't get any opensource xml database to fix the problems associated with large datasets.

  5. SQLITE doesn't have the memory problems of XML dom, but it is generally slower in processing the data (it is on the hard drive, not in memory). (note- sqlite tables can be stored in memory, perhaps this would make it as fast.... We didn't try this because we wanted to get the data out of memory.)

  6. Storing and querying tree data in a table is not enjoyable. However, managing transactions and indexing partially makes up for it.


XML is best used as an interchange format(注:个人觉得针对网络传输,XML或JSON更适合) when you need to move data from your application to somewhere else or share information between applications. A database should be the preferred method of storage for almost any size application.

参考链接:
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值