0

We have got a big table with hundreds of thousands of rows, and say, 20, columns. One of the columns is of type nvarchar(30). If I change this to nvarchar(256), because a few of the rows need to store more data there, but not all, then:

  • does this immediately change the disk allocation of the database?
  • is the disk allocation dependent on whether or not the values in the cells exceeds 30?
  • are the cells allocated separately, ie will one simple row exceeding size 30 affect the disk allocation size of the others?

I tried to google this but only found comparisons of nvarchar(n) with nvarchar(MAX). Please note that my scenario does not include out-of-row storage, as far as I can tell.

4

1 回答 1

2

这应该只是元数据的变化——行只消耗它们实际需要的可变长度数据的存储空间。因此,nvarchar(256)实际上没有行包含超过 30 个字符的列将消耗与nvarchar(30)列一样多的磁盘空间。

于 2013-11-13T08:20:18.817 回答