Char vs. Varchar
Posted in 1994
} } Hello Informixers! } } I don't know if the discussion about the usage of varchar vs. char fields } took already place here in this group. So my question: } } In our application which is in production since april, I defined } a lot of columns as char(60). Now I see with the production data that } the average length of this data is only 6-10 characters. } To save space I am now thinking to change them to varchar(60). } } On some of these columns we have Indexes to speed up queries. } } My question: } } Are accesses through indexes on varchar columns slower than on char } columns? } } A general question: When is it recommended to use varchar instead of char? } Is there a magic number of (average string length) / (max string length) ? } } Is there any good reason still to use char except when I know that all } records have the same length with this field? } } Any experience to this topic would be welcome. } } } Achim } } We changed quite a number of chars to varchars and then changed them back when we started having connect problems with synonyms across engines. In other words a join across engines which involved a table with a varchar column would yield a -934 or something. j. _____________________________________________________________________________ Jack Parker | Hewlett Packard, BSMC Boise, Idaho, USA| This space for let. jparker@hpbs3645.boi.hp.com | (208) 396-5388 (W) (208) 384-1623 (H) | _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________