Re: char vs. varchar
Posted in 2000
mars1972@my-deja.com wrote: > > In article <38EB425C.7BFB9E33@yahoo.com>, > Red Valsen <red_valsen@yahoo.com> wrote: > > My Java developers have been struggling mightily against character > type > > columns. They have been carping about the need to trim, in one way or > > another, trailing blanks from all manner of values they pull from > > tables. Why can't all those nasty fixed length columns be > > varchar(255)? Arguments of higher overhead and storage requirements > > didn't satisfy. > > > > Why shouldn't all those chars be varchars? And exactly what are the > > higher overhead and storage requirements? > > > > Higher storage requirements: > each varchar column takes up the length of the stored string + 2 > bytes. If you know you will usually be taking up all of the available > space (storing a string of length 20 in a VARCHAR(20) column) you will > be taking up the whole column plus 2 bytes per record. As far as I know (up to version 7.3x at least) the overhead is 1 byte for the length. Otherwise we should be able to define VARCHAR(32767). ;-) BISTBC. Cheers, -- Mark. +----------------------------------------------------------+-----------+ | Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /| | http://www.informix.com http://www.informixhandbook.com |///// / //| | http://www.iiug.org +-----------------------------------+//// / ///| | |What year 2000 bug? year 2000 bug? |/// / ////| | |year 2000 bug? year 2000 bug? year |// / /////| | |2000 bug? year 2000 bug? year 1900 |/ ////////| +----------------------+-----------------------------------+-----------+