RE: Char and Varchar
Posted in 2000
You are right, there is an overhead for varchar - check the reference manual for size. Furthermore, you cannot get a light scan against a varchar on IDS. Also, if you're doing updates, and the row no longer fits where it used to fit, it has to be re-written to someplace new. So you can slow things down with varchars. cheers j. > -----Original Message----- > From: Peter Morris [mailto:no_sp@m.please] > Sent: Monday, November 27, 2000 9:56 AM > To: informix-list@iiug.org > Subject: Char and Varchar > > > My company proposes changing all char(x) columns to varchar(x) > on the grounds that > > "Char stores data in a fixed length format and if data varies in > length from row to row then space is wasted. By using varchar we > can use the storage space more efficiently " > > What about fixed length fields? If we have a char(10) column, > and we know that every item in that column will be exactly 10 > characters long, then is there any advantage in making it a varchar? > > I think it might even be less efficient. I presume that for a varchar > the database must store the length of the data, in addition > to the data, > so there would be extra resources used. > > Am I right? For a fixed length field, is char or varchar better? > Or doesn't it make any difference? > > > >