Microsoft SQL Server 2005/2008: XML vs text/varchar data type(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 数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Microsoft SQL Server 2005/2008:XML 与 text/varchar 数据类型


- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01