DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Performance Issue

  1. #1
    Join Date
    Dec 2000
    Location
    Virginia, USA
    Posts
    455
    I like to know what is better in terms of performance to use VARCHAR2(n) or CHAR datatype for column when creating and accessing tables.

    Thanks in Advance

  2. #2
    Join Date
    Oct 2000
    Posts
    467
    varchar2 will ofcourse save you some space.
    for eg. datatype1 char2(4)
    datatype2 varchar2(4)

    insert into table values('AB', 'XY');

    the length of char will be 4 and length of varchar2 willbe 2 in this case.
    Vinit

  3. #3
    Join Date
    Apr 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    1,203
    Although... if you have

    CHAR(2)

    And

    VARCHAR2(2)

    and the you know the value of the field will ALWAYS BE TWO. Then you'd be better of storing in a CHAR. VARCHAR2 use an extra byte to store the number of bytes used. In the example above... Char(2) would only use 2 bytes and Varchar2(2) would use 3.

    Therefore valus that are always consistents, like Gender m/f, would be a good candidate for a CHAR(1) field.

    Cheers,
    OCP 8i, 9i DBA
    Brisbane Australia

Posting Permissions

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


Click Here to Expand Forum to Full Width