如何确定数据库中行的大小

发布于 2024-09-26 01:09:50 字数 307 浏览 0 评论 0原文

可能的重复:
SQL Server 2005 中 varbinary 字段的大小

在我的 SQL2005 数据库中,我有一个表,其中有一列 varbinary(MAX)。

我如何知道行的大​​小?或者作为替代方案,告诉每行中 varbinary 字段的大小?

Possible Duplicate:
Size of varbinary field in SQL server 2005

In my SQL2005 database, I have a table that has a column varbinary(MAX).

How do I tell the size of the rows? Or as an alternative, tell the size of the varbinary field in each row?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年里的时光 2024-10-03 01:09:50

有两个函数:

  • DATALENGTH 返回数据的大小(字节)
  • LEN 返回数据的大小(字符)。

对于 varbinary(max) 列,您应该使用 DATALENGTH

SELECT DATALENGTH(column) FROM Table;

这两个函数都返回数据的逻辑值,即所有压缩算法之后的值已应用并且该柱完全未压缩。无法确定磁盘上实际占用的字节数,因为它受到各种存储选项的影响,最重要的是受压缩选项的影响 (行压缩页面压缩unicode 压缩) 和 行外大值类型设置。

There are two functions:

  • DATALENGTH returns the size of the data (bytes)
  • LEN returns the size of data (characters).

For a varbinary(max) column, you should use DATALENGTH:

SELECT DATALENGTH(column) FROM Table;

Both functions return the logical value of the data, that is after all compression algorithms have been applied and the column is completely uncompressed. The actual number of bytes occupied on-disk cannot be determined, because is influenced by the various storage options, most importantly by the compression options (row compression, page compression, unicode compression) an by the large value types out of row setting for the table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文