patternsqlMinor
Speed impact of using varchar in SQL Server 2008
Viewed 0 times
impact2008sqlvarcharusingserverspeed
Problem
In the old days, using
a) say 2.000.000 rows
b) if any of the
varchar over char was a big no no, since the varchar was stored on a different page than the rest of the row. Is this still the case today with SQL Server 2008? Will I see any memory/performance gain from changing 1-3 varchar(5) columns to char(5) columns on a table witha) say 2.000.000 rows
b) if any of the
varchar columns are part of indexes / the primary keysSolution
You are confusing text/varchar(max) (LOB types) with varchar(n)/char(n)
Otherwise, if you use char(1000) not varchar(1000) and the average data length is, say, 42 this is bad design and a lot of wasted space.
- LOB types will still be stored in-row/out-of-row based on size, UPDATE, sp_tableoption etc
- varchar(n)/char(n) have always been "in-row"
Otherwise, if you use char(1000) not varchar(1000) and the average data length is, say, 42 this is bad design and a lot of wasted space.
Context
StackExchange Database Administrators Q#2021, answer score: 8
Revisions (0)
No revisions yet.