在关系数据库中存储XML数据的常见问题是什么?(What are the common issues surrounding storage of XML data in a relational d

编程入门 行业动态 更新时间:2024-10-12 03:27:58
在关系数据库中存储XML数据的常见问题是什么?(What are the common issues surrounding storage of XML data in a relational databases?)

关于从这个问题开始的讨论,我决定将其作为一个社区维基问题。

因此,问题的根源是将XML数据存储在关系数据库中是否合适? 通常有更好的方法来实现相同的目标吗? 哪些数据库引擎为XML数据类型(如SQL Server)提供了良好的支持,以及围绕所谓的“XML索引”的问题是什么?

In relation to a discussion started at this question, I've decided to put this up as a community wiki question.

The root of the question is, therefore, is it appropriate to store XML data in a relational database? Are there generally better ways to implement the same goal? What database engines provide good support for XML data types (such as SQL Server), and what are the issues surrounding so-called "XML indexes"?

最满意答案

数据库用于存储数据。 XML就是数据。 因此,在适当的情况下,将XML存储在数据库中是完全有效的。 这是否是最有效的事情取决于许多可能无法概括的因素。

例如,如果您有一个表示对象的结构化XML文档(例如:书店中的一本书),那么解析数据并将其存储在为该数据设计的数据库中的适当行和列中可能是有意义的。

OTOH,想象一个包含代码示例的数据库。 您有语言,说明和代码的列。 对于XML,显然您将XML存储在代码列中。

所以,像软件中的许多东西一样,“它取决于”。

Databases are for storing data. XML is data. Therefore, under the right circumstances it's perfectly valid to store XML in a database. Whether that's the most efficient thing to do depends on a lot of factors that probably can't be generalized.

For example, if you have a structured XML document that represents an object (eg: a book in a bookstore), it likely makes sense to parse the data and store in in appropriate rows and columns in a database designed for that data.

OTOH, imagine a database holding code samples. You have columns for language, description, and the code. In the case of XML, obviously you'll store the XML in the code column.

So, like so many things in software, "it depends".

更多推荐

本文发布于:2023-07-30 15:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1338745.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:常见问题   数据库中   关系   数据   XML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!