SQL performance: Is there any performance hit using NVarchar(MAX) instead of NVarChar(200)

后端 未结 3 1553
暖寄归人
暖寄归人 2020-12-14 14:28

I am wondering if there is any disadvantage on defining a column of type nvarchar(max) instead of giving it a (smaller) maximum size.

I read somewhere that if the co

3条回答
  •  渐次进展
    2020-12-14 15:09

    an index cannot be created on a column over 900 bytes. Columns that are of the large object (LOB) data types ntext, text, varchar(max), nvarchar(max), varbinary(max), xml, or image cannot be specified as key columns for an index

    you can however use included columns

    All data types are allowed except text, ntext, and image. The index must be created or rebuilt offline (ONLINE = OFF) if any one of the specified non-key columns are varchar(max), nvarchar(max), or varbinary(max) data types.

提交回复
热议问题