03-26-07 06:35 AM
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:O98pDGuaHHA.4808@TK2MSFTNGP04.phx.gbl...
> Anthony Jones wrote:
>
> No, I believe he was talking about the impact of having many varchar
columns
> as opposed to a few. He is likely assuming that at least some of the
> varchar(max) columns could be char, since the blog post he was replying to
> made no reference to leaving existing char columns alone. Or using
> varchar(max) to store other data types.
I see. I didn't read it that way. It seems to me the blogger is talking
about varchar(n) vs varchar(max).
>
>
> I think Adam Machanic's article covers this: "Remember that the query
> optimizer uses column size as one of the many metrics for determining
> optimal query plans. Given this table, the optimizer would have very few
> options in that regard. "
That's a good point. Statistics are not by default built for varchar(max)
fields but I believe they can be specified.
>
>
> Again, from Adam's article:
> The MAX data types, by default, use a hybrid of the TEXT/IMAGE overflow
> behavior and the behavior of the normal (sized) VARCHAR/VARBINARY types.
If
> a column's data, plus the data in all of the other columns in the table,
has
> a total size of less than 8060 bytes, the data is stored in-row. If the
data
> exceeds 8060 bytes, the data in the MAX column will be stored off-row.
Cool. A pragmatic solution. I like.
>
>
> With varchar(max) one cannot be sure how much data is going to be stored
in
> it. Thus database growth cannot be predicted, making any forecasts of
> database size meaningless.
Using varchar(max) doesn't mean you haven't got a reasonable idea of the
size of data going into the field. It means you don't want to limit the size
that might end up in there. I'm being devils adovacate here, for small
fields, titles, descriptions, names etc I wouldn't use varchar(max) either
(I agreed it is lazy) but for anything over say 512 I would have been
tempted but:-
> Also, every time a record's size exceeds a page
> (8000 b), the record gets split. Every time the split occurs, performance
> suffers, both for maintaining and for reading the data. Since we are not
> controlling how much data gets stored, we cannot predict how many splits
> will occur.
Ouch. Yes that's a killer reason.
> "Unwanted results" I believe is referring to the lack of control
> of data size removing one key validation method for preventing unwanted
> data.
Good point.
>
> Many of these arguments are the same ones used to counter the old "why not
> make every column a varchar(8000) column" proposal in the SQL2000 days.
>
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
[ Post a follow-up to this message ]
|