简体   繁体   English

将nvarchar(MAX)列添加到我的审核表中

[英]Adding a nvarchar(MAX) Column to my audit table

I have an audit table, where I added a Column named “ExtraInfo”, this column might store null value or it might contain for example all the usernames that have been assigned to a group; 我有一个审核表,在其中添加了一个名为“ ExtraInfo”的列,该列可能存储空值,或者可能包含例如已分配给组的所有用户名; could be 100, 200 users. 可能是100个,200个用户。 So I gave this column a Type of nvarchar(MAX), as in the future our AD users might get huger and I do not want to face issues regarding the column size. 因此,我为该列指定了nvarchar(MAX)类型,因为将来我们的AD用户可能会越来越庞大,并且我不想面对有关列大小的问题。 But I have the following concern:- 但我有以下担忧:

  1. Will SQL server 2008 R2 occupy only the bytes that the nvarchar(max) currently have , or it will occupy its full capacity even if the colum only contain 10 bytes or even it is null? SQL Server 2008 R2是否仅占用nvarchar(max)当前具有的字节,或者即使colum仅包含10个字节甚至为null,它将占用其全部容量?

  2. Is there any disadvantages of using nvarch(max) inside an audit table I am not aware of ? 在我不知道的审计表中使用nvarch(max)有什么缺点吗?

Thnaks Thnaks

  1. It will occupy the capacity that is used, however behind the scenes it is converted to a text field which incurs extra overhead. 它会占用所使用的容量,但是在幕后将其转换为文本字段,这会产生额外的开销。 Please see This for reference. 请参阅作为参考。
  2. As I noted in my comment if you ever need to do any searching against this field it is not recommended to store this type of data this way as it will lose performance as the table grows. 正如我在评论中指出的那样,如果您需要针对此字段进行任何搜索,则不建议您以这种方式存储这种类型的数据,因为随着表的增长,它将丢失性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用C#从NVarchar(Max)列流式传输数据 - Streaming data from a NVarchar(Max) column using c# LINQ使用.Contains()搜索nvarchar(MAX)列非常慢 - LINQ Search nvarchar(MAX) column extremely slow using .Contains() 将文本从文件导入NVARCHAR(MAX)列; 字符 - Importing text from file into a NVARCHAR(MAX) column; getting � for characters Linq - 从 SQL 服务器中的 nvarchar 类型列中查找最大值 - Linq - Find max value from a nvarchar type column in SQL Server NServiceBus和nvarchar(max) - NServiceBus and nvarchar(max) 添加新的 CLR 用户定义函数时出现“找不到类型 nvarchar(MAX)” - Getting “Cannot find the type nvarchar(MAX)” when adding new CLR user defined function nvarchar(max)减慢存储过程 - nvarchar(max) slowing stored procedure 从 nvarchar 转换为 varbinary(max) - Conversion from nvarchar to varbinary(max) 当我的表上没有任何nvarchar时,如何解决“将nvarchar数据类型转换为数值错误”的问题? - How can i solve “error converting data type nvarchar to numeric” when i don't have any nvarchar on my table? 覆盖长文本字符串的流利 NHibernate nvarchar(MAX) 而不是 nvarchar(255) - Override for fluent NHibernate for long text strings nvarchar(MAX) not nvarchar(255)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM