Data Type size

  • Why do we want to keep field datatypes as small as possible in SQL Server 2005?

    Thanks

    Kala

  • Because even if you don't use complete space for particular data types it will allocate and reserve the maximum size, you will be wasting resources.

    EnjoY!
  • GTR (3/9/2010)


    Because even if you don't use complete space for particular data types it will allocate and reserve the maximum size, you will be wasting resources.

    I don't believe that's true for variable character length datatypes.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • kaladharreddy15 (3/9/2010)


    Why do we want to keep field datatypes as small as possible in SQL Server 2005?

    We do this in order to fit the maximum number of fields on a data/index page.

    Dense data can be processed more efficiently.

  • but if we are using varchar datatype sql s. will reserve space as much required for actual value.Any say??

  • Sanjay-940444 (8/5/2010)


    but if we are using varchar datatype sql s. will reserve space as much required for actual value.Any say??

    Yep... how many bytes does it take to store the number -2000000000 as a VARCHAR? As an INT?

    How many bytes does it take to store 10 Jan 2010 15:30 as a VARCHAR. As a DATETIME?

    And that's before we get into all of the other disadvantages.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply