All Forums Database
m.tahoon 43 posts Joined 09/11
12 Aug 2013
Variable length Columns vs Fixed length

Are there any performance implication using Variable / Fixed lenght Columns.
i've passed a URl where it recommend alwasy using Fixed lenght for performacne reason.
However,  i would have expected variable lenght possible minimze physical row size  (based on the column data) which minimizes IO and possibly improve performance.
 

dnoeth 4628 posts Joined 11/04
13 Aug 2013

There's four bytes overhead for the first variabe column and two bytes for each additional VarChar. So VarChars are used when the average length of the string is at least two bytes less than the maximum 
Fixed length should be used for short strings up to a few chars or strings which always have a fixed length.
VarChars will only impact performance when they're sized too large (e.g. VARCHAR(255) for everything without checking the actiual data) because they will be expanded to CHARs in spool for ORDER/GROUP/PARTITION BY.
Dieter

Dieter

You must sign in to leave a comment.