是“坏”的吗?将XML存储在数据库中? [英] Is it "bad" to store XML in a database?

查看:64
本文介绍了是“坏”的吗?将XML存储在数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从多个来源听说过,将XML存储在数据库中是不好的,但是我从未见过/听到过这样做的实际解释。是真的吗如果是真的,您能解释为什么吗?而且,您能告诉我在数据库中存储XML的好案例是什么吗?

I have heard from several sources that storing XML in a database is "bad", but I have never seen/heard an actual explanation of why that is. Is it true? If it is true, can you explain why? Moreover, can you tell me what a "good" case for storing XML in a database is?

推荐答案

这一点都还不错。 Microsoft SQL Server具有XML数据类型。存储XML的一种用例是我们发现的一种情况。对于特定表中的每一行,我们需要存储可变数量的与该行相关的属性。这些属性的数量可以随时间以及每一行而变化。我们发现以XML格式存储这些属性及其值更加有效。将来,每次我们调整属性数量时,都不需要进行架构更改。

It's not bad at all. Microsoft SQL Server has an XML data type. One use case for storing XML is a situation we found ourselves in. For each row in a particular table, we needed to store a variable number of attributes related to that row. And the number of these attributes can change over time, and with each row. We found it more efficient to store these attributes, and their values in an XML format. In the future, each time we adjust the number of attributes, we don't need to make schema changes.

这篇关于是“坏”的吗?将XML存储在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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