Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Location
    Chennai, TN
    Posts
    68

    Unanswered: varchar(255) vs varchar(50) performance

    Hi,
    I would like to know whether there would be a performance improvement in the table if we change the column of varchar(255) to varchar(50).

    I have a scenario where the column occupies only 50 characters but i have declared the datatype with varchar(255). one of my friend told me to alter the datatype to varchar(50) for performance. It also gave a better performance.

    I could not figure out the exact reason behind that. Please help me in undersatnding why this difference happens in varchar.

    I believe in varchar the unwanted bytes are truncated if unused so i think varchar(255) and varchar(50) has got nothing to do with performance

    Thanks,
    Parangiri

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    It is my understanding that would have no impact on performance. Situation would be different if the columns were defined as CHAR.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Hey Pingu

    The performance is in how much data you retrieve...

    10 rows, now diff, 10 million rows....I would say a diff

    MOO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    Quote Originally Posted by parangiri View Post
    I have a scenario where the column occupies only 50 characters but i have declared the datatype with varchar(255).
    What's your reason for doing that? If the data is to be the same in each case then I don't think there will be any performance impact. However, you could find that the data eventually gets larger than you wanted simply because you've allowed it to be larger. So ultimately there might be some impact on the volume of data and therefore the time taken to process.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •