RE: Char and Varchar
Posted in 2000
Yes, the database stores the lenght of the varchar field, so an extra byte is necessary. For fixed length fields, char type is more convenient. > -----Mensaje original----- > De: Peter Morris [SMTP:no_sp@m.please] > Enviado el: Lunes 27 de Noviembre de 2000 09:56 AM > Para: informix-list@iiug.org > Asunto: 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? > > >