Re: char or varchar for small colums?
Posted in 1998
I'm only thinking to take varchar if 1.) the table have or will have many rows (e.g. over 100.000) and 2.) the charcterfield has more than 10 Bytes. Very important is the fact that the field shoud'nt be changed anymore. for example you insert "i don't like mondays" in a varchar(50,1) and after some day you change it to "i dont't like working on mondys" than this row will probably spread over two pages. and this is really bad. you have too know that varchar saves diskspace (sometimes a lot) but it cost a little cpu. the saving of diskspace means that much more rows fit in a page and therefore you speed up data-read. and disks are much more slowly than cpu!!! There is an overhead from 1 byte at varchar. varchar (20,1) with 5 bytes filled needs 6 byte! rainer Francisco Reyes > > I am looking for some hints on char vs varchars. > Is there any overhead for varchar? I have a many small colums (i.e. 1 > to 5 characters) and wonder if I am better of using char or varchar. > So far I have been using char for <=3 and varchar for colums >= 4 > characters. > > Remove "<No Spam>" to send me email.