I know this topic has probably been hashed to death, but I can't find any guidance to hang my hat on.
Over the Thanksgiving weekend, I will be doing a dbUnload/dbLoad of our ERP database, which is about 30GB in size. One of the tables (and at 60 million records, by far the largest), has two columns that I need to make bigger. The columns are currently defined as CHAR(30). I believe that CHAR(60) will be big enough for the foreseeable future. The question, of course, is should they be changed to VARCHAR(60)? These fields are populated in about 80% of the records, and are both indexed (not unique).
asked 08 Nov '12, 07:54
As far as the database is concerned, CHAR and VARCHAR are the same datatype: variable-length character strings; e.g., CHAR ( 30 ) and VARCHAR ( 30 ) can both contain 'xyz' with no padding, just the three characters.
As far as SOME CLIENT-SIDE INTERFACES are concerned, CHAR may be interpreted as a fixed-length character string. If such a client-side interface pads a value with blanks to fill the maximum length when doing an INSERT or UPDATE, SQL Anywhere will store those blanks. This behavior is pretty rare and getting rarer, and it probably does not affect you... and it is all performed outside SQL Anywhere.
IMO there's no downside to declaring the column CHAR ( 100 ) or CHAR ( 200 )... certainly not from SQL Anywhere's point of view.
answered 08 Nov '12, 08:31