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

查看:97
本文介绍了关系数据库中XML数据存储的常见问题是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于在此问题开始的讨论,我决定将此作为一个社区Wiki问题。

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

因此,问题的根本是适当的XML数据存储在关系数据库?有没有更好的方法来实现相同的目标?什么数据库引擎为XML数据类型(如SQL Server)提供良好的支持,以及围绕所谓的XML索引的问题是什么?

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存储在数据库中是完全有效的。是否这是最有效的事情取决于很多因素,可能无法推广。

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.

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

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,想象一个保存代码样本的数据库。您有语言,描述和代码的列。在XML的情况下,显然你会将XML存储在代码列中。

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".

这篇关于关系数据库中XML数据存储的常见问题是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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