Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195

    Unanswered: Performance Difference Between CHAR and VARCHAR

    Can someone explain to me why there is a performance difference between CHAR and VARCHAR? I have two columns, exactly the same EXCEPT one is CHAR(13) and the other is VARCHAR(13). The data in these columns is always 13 digits long BUT when I do a benchmark on a query of the data, the CHAR column is significantly slower than the VARCHAR. Can someone help me shed some light on this? Thanks, Jeremy
    Nothing better than a good ride.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Performance Difference Between CHAR and VARCHAR

    Originally posted by JCScoobyRS
    Can someone explain to me why there is a performance difference between CHAR and VARCHAR? I have two columns, exactly the same EXCEPT one is CHAR(13) and the other is VARCHAR(13). The data in these columns is always 13 digits long BUT when I do a benchmark on a query of the data, the CHAR column is significantly slower than the VARCHAR. Can someone help me shed some light on this? Thanks, Jeremy
    Just a guess: when you use CHAR, every comparison involves an RPAD on both sides. The fact that you columns are always full means that the RPADs are redundant, but they are still being done which must take more than no time.

  3. #3
    Join Date
    Feb 2003
    Location
    In your thoughts
    Posts
    195
    Very helpful. Thanks alot, Jeremy
    Nothing better than a good ride.

  4. #4
    Join Date
    May 2003
    Location
    pakistan
    Posts
    9
    Originally posted by JCScoobyRS
    Very helpful. Thanks alot, Jeremy
    .
    hi there
    i think i can explain you your problem. in Char datatype oracle stores the number of characters that are mentioned in the parenthesis in your case 13. even if you inserted 'ab' in this column, oracle will take all the 13 digits place, while in varchar when u insert say 'ab' in to the column, orcle will only take 2 (ab)characters and will free the space for the next 11 characters . thats why when querying char type takes time and varchar results more faster .

Posting Permissions

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