xml列如何存储在SQL Server 2008中?

时间:2021-05-13 10:18:00

I try to understand how SQL Server 2008 store xml columns in an attempt to estimate table size in our product.

我尝试了解SQL Server 2008如何存储xml列以尝试估计产品中的表大小。

I'm using DATALENGTH(xml_column) to run some test and results are disturbing :

我正在使用DATALENGTH(xml_column)来运行一些测试,结果令人不安:

Xml document length | Datalength | Bytes per character
175                 | 366        | 2.09
15                  | 38         | 2.53
314                 | 414        | 1.31

Obviously, the xml column type is not a nvarchar(max) in disguise, as I've read somewhere.

显然,xml列类型不是伪装的nvarchar(max),正如我在某处读到的那样。

It's probably compacted and stored as binary, but a can't find how anywhere.

它可能被压缩并存储为二进制文件,但无法找到任何地方。

Can someone explain me how is an xml column stored in SQL Server 2008 ?

有人可以解释一下如何在SQL Server 2008中存储xml列吗?

2 个解决方案

#1


7  

An XML column is stored in a "compact binary format".

XML列以“紧凑二进制格式”存储。

I doubt that Microsoft will give you any more detail than that.

我怀疑微软会不会给你更多细节。

#2


5  

As pointed out by rene, SQL Server 2008 uses the MS-BINXML - a compact binary format - to store the content of xml columns.

正如rene所指出的,SQL Server 2008使用MS-BINXML(一种紧凑的二进制格式)来存储xml列的内容。

#1


7  

An XML column is stored in a "compact binary format".

XML列以“紧凑二进制格式”存储。

I doubt that Microsoft will give you any more detail than that.

我怀疑微软会不会给你更多细节。

#2


5  

As pointed out by rene, SQL Server 2008 uses the MS-BINXML - a compact binary format - to store the content of xml columns.

正如rene所指出的,SQL Server 2008使用MS-BINXML(一种紧凑的二进制格式)来存储xml列的内容。