Results 1 to 4 of 4

Thread: char vs varchar

  1. #1
    Join Date
    May 2002

    Unanswered: char vs varchar

    hi ALL

    For example char(100) vs varchar(100)

    Apart from the obvious space considerations, can anyone point out other
    pros and cons.

    I have read that various Sybase functions perform better with char type columns rather than with varchar. Can anyone shed more light on this??

    Are the performance considerations really serious...??

    Thanks a lot!

  2. #2
    Join Date
    Oct 2003
    As far as I know, most DBMSes implement "VARCHAR" and "CHAR" the same way, as far as storage is concerned. There may be differences when delivering the results to you (i.e. with or without space padding), but nobody likes storing spaces when they might not have to.
    ChimneySweep(R): fast, automatic
    table repair at a click of the

  3. #3
    Join Date
    Nov 2002
    Depends. In OLTP env. it could be a performance issue if for each update your row is forwarded because of changing row size (due to varchar) - because your new varchar value is larger than old value, then it has to be moved to new page.
    Other than that varchar saves space and is recommended only when you know data value will vary from 5 char to 50 char, but if you're sure that data value will vary between 25 to 30 char, go for CHAR(30).


  4. #4
    Join Date
    Nov 2002
    A char(n) null is managed as a varchar(n).
    A string of 10 characters in a char(100) not null is a stored in 100 characters.
    A string of 10 characters in a varchar(100) is a stored in 11 characters (10 + one end of string).
    F. Celaia
    DBA Oracle/MS-SQL/MySQLSybase/DB2/

Posting Permissions

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