问题
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