使用 XML 优于 MySQL 的好处,反之亦然?
我目前正在开发一个不是我做的项目,但它使用了很多 XML 文件而不是 MySQL 来代替它。
正因为如此,我想知道使用 XML 相对于 MySQL 是否真的有任何好处。
场景是,XML 文件仅加载一次,并在服务器上用于执行 N 件事。 仅当管理员向服务器发出重新加载命令时,XML 才会重新加载。 所有 XML 文件的平均最大大小为 100 mb。
如果您能给我简单介绍一下上面有关在 MySQL 上使用 XML 的情况,我将不胜感激。
当 XML 比简单的 innodb 或 myisam 表更好的选择时,我应该考虑什么?
I am currently working on a project that was not made by me but it makes use of a lot XML files instead of MySQL in place of it.
Because of that it makes me wonder if there is really any benefits of using XML over MySQL here.
The scene is, the XML files are loaded only ONCE and used on the server for N things it does.
The XML is only reload if the admin issue a command to the server to reload it.
All the XML files together have an average of maximum 100 mb size.
If you could as well give me a little brief of the above in regards the usage of XML over MySQL would appreciate.
What should I consider to know when a XML would be a better option over a simple innodb or myisam table ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您的数据是只读的并且仅在管理员的命令下才进入内存,那么我认为这对于这两种技术都没有多大优势。
如果您必须搜索数据,MySQL 将具有 SQL 查询的优势。即使在这种情况下,数据类型也很重要。如果您有很长的引用链/对象图,那么关系数据库可能会因为所有连接而变慢。
但 XML 有其自身的问题。您可以轻松地将其解析为 DOM 对象,但随后您只能使用 XPath 来搜索它。
If your data is read-only and brought into memory only at the command of the admin, then I don't think it's much of an advantage for either technology.
MySQL would have the advantage of SQL queries if you have to search the data. Even in that case it's the type of data that matters. If you have long reference chains/object graphs, then a relational database may be slow because of all the JOINs.
But XML has its own issues. You can easily parse it into a DOM object, but then you only have XPath to search it.
XML 被用作存储数据的方式之一。使用 xml 的好处之一是,它使数据易于阅读。如果有很多用户需要同时访问数据,可以使用mysql,并且mysql还支持数据的事务处理,而xml没有这样的功能。
XML is used as one of the ways of storing data. one of using xml is, it makes the data easy to be readable. you can use mysql if there are lot of users need the access to the data at the same time and mysql also supports transactional processing of data whereas xml does not have such features.
只需在两者之间添加选项 - 您还可以使用某种形式的 xml 数据库,例如
eXist (http://exist- db.org/index.html) 或 sedna (http://modis.ispras.ru/sedna /)
just adding the option in between - you could also use some form of xml database like
eXist (http://exist-db.org/index.html) or sedna (http://modis.ispras.ru/sedna/)
XML 存储在本地存储中,并且只能由本地服务器可读(不要争辩我,您可以使用 memcache,通过 rsync 等复制)
毫无疑问,您可以通过 http 服务器打开 XML,但它会很慢。
虽然mysql支持端口通信和复制,但如果扩展到多个服务器,它基本上没有边界。
即使在 5.1 版本中,mysql 支持 XML
XML stored at local storage, and readable only by local server (don't argue me you can use memcache, replicated via rsync or so)
No doubt you can open the XML via a http server, but it will be slow.
While, mysql support port communication, and replication, it basically don't have boundaries if you expanding to multiple servers.
And even at 5.1, mysql support XML