At my company, we have a legacy database with various tables and therefore many, many fields.
A lot of the fields seem to have large limits (ex: NVARCHAR(MAX)) that are never reached.
Does arbitrarily making the fields their maximum width or 2 to 3 times larger than what is normally inputted negatively affect performance?
How should one balance performance with field lengths? Is there a balance?
解决方案
There's two parts to this question:
Does using NVARCHAR over VARCHAR hurt performance? Yes, storing data in unicode fields doubles the storage requirements. Your data stored in those fields is 2x the size it needs to be (until SQL Server 2008 R2 came out, which includes unicode compression. Your table scans will take twice as long and only half