Microsoft SQL Server 2005/2008:XML 与 text/varchar 数据类型 [英] Microsoft SQL Server 2005/2008: XML vs text/varchar data type

查看:39
本文介绍了Microsoft SQL Server 2005/2008:XML 与 text/varchar 数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以 XML 类型而不是 text/varchar/ntext 存储 XML 是否更有意义(服务器端验证 XML/schema/dtd 除外)?我不打算在数据库端进行任何 XML 操作.

Does it make more sense (except of server side validation XML/schema/dtd) to store XML in XML type instead of text/varchar/ntext? I'm not planning to do any XML manipulation on database side.

我调查的目的是减少数据库大小.为此,我可以将 XML 数据类型用于无类型 XML 吗?有什么优点和缺点?

The purpose of my investigation is to decrease database size. Can I use XML data type for untyped XML for this purpose? What are the pros and cons?

我找到了一篇与该主题相关的文章,但我不确定作者的假设/结论是否正确.

I found an article related to the topic, but I am not sure if the authors assumptions/conclusions are correct.

推荐答案

我的快速调查显示 MS SQL 2005 (Express Edition)

My quick investigation shows that MS SQL 2005 (Express Edition)

Microsoft SQL Server 2005 - 9.00.3073.00(英特尔 X86)2008 年 8 月 5 日 12:31:12版权所有 (c) 1988-2005 Microsoft CorporationWindows NT 6.0 (Build 6000:) 上的 Express Edition

Microsoft SQL Server 2005 - 9.00.3073.00 (Intel X86) Aug 5 2008 12:31:12 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0 (Build 6000: )

以大约 70% 的开销存储 XML(可以加快处理/解析速度).

store XML with overhead about 70% (possible for faster processing/parsing).

转换前我的数据:rows=160320,reserved=178576 KB,data=178184 KB,index_size=272 KB,unused=120 KB

My data before conversion: rows=160320, reserved=178576 KB, data=178184 KB, index_size=272 KB, unused=120 KB

我转换后的数据:rows=160320,reserved=309702 KB,data=307216 KB,index_size=1672 KB,unused=184 KB

My data after the conversion: rows=160320, reserved=309702 KB, data=307216 KB, index_size=1672 KB, unused=184 KB

因此,如果您不打算在数据库端使用 XML 技术,那么将 XML 数据存储为 XML 数据类型是没有任何意义的.

这篇关于Microsoft SQL Server 2005/2008:XML 与 text/varchar 数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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