SQLServer and VARCHAR(MAX) vs VARCHAR(8192)
Posted on 2011-04-28
I am designing a database schema and I have question about VARCHAR. I have a field called ContentBody and it holds the content for a particular block on a page and the page is built from one or many of these blocks.
I don't know if the content editor of the site is going to insert more than 8192 bytes of data or less than 8192 bytes. (I am assuming at this point that VARCHAR(X) and VARCHAR(MAX) are my two options).
If I have VARCHAR(8192), a user will have to break up the content into many blocks, if the block is 20000 bytes say, which is not ideal which leaves me with VARCHAR(MAX). Some of the content might only be 100 bytes though and some maybe 20000 bytes or more.
With such a wide difference in number of bytes in this ContentBody field, what will I be doing to the database performance and size etc?
I hope this question makes sense and thank you for your time with this.