nvarchar column size impact on performance [duplicate]

你说的曾经没有我的故事 提交于 2019-12-11 01:18:24

问题


Possible Duplicate:
overstating field size in database design

I have a "description" column in one of my tables which as of now I dont know the maximum size of. But I am assuming it should not be greater than 1000 characters.

Question: If I make it nvarchar(4000) [just to be safe] will it have any adverse impact on performance ?

Thanks.


回答1:


No. NVARCHAR(1000) has all the exact characteristics as NVARCHAR(4000). As a variable length column it takes only the space it needs, it can be pushed out-of-row if it does not fit in page and so on and so forth.

On a related note, if you'd use NVARCHAR(MAX) then you could experience some degradation, usually not noticeable though, see Performance comparison of varchar(max) vs. varchar(N). Also a MAX type would prevent online rebuild and index operations.



来源:https://stackoverflow.com/questions/7151988/nvarchar-column-size-impact-on-performance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!