技术上更好的方法是:以XML格式存储数据还是将数据存储在DB中的表中? [英] What way is technically better: to store the data in XML format or to store data in tables in a DB?

查看:52
本文介绍了技术上更好的方法是:以XML格式存储数据还是将数据存储在DB中的表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

想象一下,服务器处理大量用户的数据。它必须保存,存储,使用和发送内容作为请求。技术上更好的方法是:以XML格式存储数据(每个用户一个文件或所有用户一个文件)或将数据存储在DB中的表中(每个用户一个表或每个用户一个表)?

优点和缺点?

谢谢)

Hello to all.
Imagine a server processing plenty of users' data. It has to save them, store, use and send something as a request. What way is technically better: to store the data in XML format (a single file per user or one file for all the users) or to store data in tables in a DB (a table per each user or a table per user)?
Pros and cons?
Thanks)

推荐答案

从技术上讲,你的问题没有答案。



要告诉你一些有价值的东西,你必须知道你的用户数据,用法和其他许多细节。



答案可能都不是2种可能性。
Technically, there is no answer to your question.

To tell you something valuable, one have to know what is your users data, the usage and plenty other details.

And the answer can be neither of the 2 possibilities.


这不是这是更好的,这是更糟糕的比较:它们是为不同的目的而设计的,而更好或更糟将取决于它们的方式使用,而不是存储介质的任何内在好处。这就像问哪个更好,香蕉还是橘子? - 这取决于。如果你正在烹饪鸭子,那么鸭子和橙子是经典的组合。如果你正在制作三明治,那么香蕉可以很好地填充儿童。



例如,如果你期望多用户访问,那么你想要一台服务器 - 基于DB。使用XML文件会导致很大的问题!

如果你想要一个在你打开应用程序时使用过一次的配置文件,那么SQL数据库的开销就很愚蠢 - 尽管SQLite数据库可能是一个好主意。

如果你想经常更新它,插入和删除行,比任何基于文本的(如XML)都会表现得相对糟糕。



等等 - 每个都是很好的解决方案,但这取决于问题是哪个合适!
It's not a "this is better, this is worse" comparison: they are designed for different purposes, and and "better" or "worse" will depend on how they are being used, rather than any intrinsic benefits from the storage medium. It's like asking "which is better, bananas or oranges?" - it depends. If you are cooking a duck, then duck and orange is a classic combination. If you are making a sandwich, then banana can be a good filling for children.

For example, if you are expecting multi user access, then you want a server-based DB. using an XML file will cause huge problems!
If you want a configuration file which is used once when you app opens, then the overhead of an SQL database is just silly - though an SQLite DB could be a good idea.
If you want to update it often, inserting and deleting rows, than any text-based (such as XML) is going to perform relatively badly.

And so on - each are good solutions, but it depends what the question is as to which is appropriate!


这篇关于技术上更好的方法是:以XML格式存储数据还是将数据存储在DB中的表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆