Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6935485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:06:34+00:00 2026-05-27T12:06:34+00:00

Regarding SQL Server, I understand : var means the memory is lazy allocated, meaning

  • 0

Regarding SQL Server, I understand :

  • var means the memory is lazy allocated, meaning it fits to the data exactly (on insertion).

  • MAX means there is no size restriction\limitation.

Then, is it always preferable to use MAX when using varchar, as we don’t allocate the whole size anyhow?

Should we use a constant size only if there is a constraint we want to enforce on this DB column?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:06:34+00:00Added an answer on May 27, 2026 at 12:06 pm

    There is a very good article on this subject by SO User @Remus Rusanu. Here is a snippit that I’ve stolen but I suggest you read the whole thing:

    The code path that handles the MAX types (varchar, nvarchar and
    varbinary) is different from the code path that handles their
    equivalent non-max length types. The non-max types can internally be
    represented as an ordinary pointer-and-length structure. But the max
    types cannot be stored internally as a contiguous memory area, since
    they can possibly grow up to 2Gb. So they have to be represented by a
    streaming interface, similar to COM’s IStream. This carries over to
    every operation that involves the max types, including simple
    assignment and comparison, since these operations are more complicated
    over a streaming interface. The biggest impact is visible in the code
    that allocates and assign max-type variables (my first test), but the
    impact is visible on every operation.

    In the article he shows several examples that demonstrate that using varchar(n) typically improves performance.

    You can find the entire article here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue regarding an recursive count which works well in SQL server,
i never use sql server ROW_NUMBER() function. so i read some article regarding ROW_NUMBER(),PARTITION
Pretty general question regarding triggers in SQL server 2005. In what situations are table
I found this article regarding Linq-to-SQL and SQL Server connection pooling: MSDN Blog From
Regarding Update and Insert triggers for MS SQL Server, is there a way to
Considering what MSDN states regarding SQL Server 2008 R2 storage of NUMERIC/DECIMAL precision. Precision
Me and my colleagues have a question regarding SQL Server 2008 query length and
I have a query about transaction logs regarding sql server 2005-08. When is a
I have a few questions regarding sql server in android. Essentially, I am tring
I was reading the Maximum Capacity Specifications for SQL Server and I came across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.