Re: CHAR() v. VARCHAR()
Posted in 1995
To VARCHAR or not to VARCHAR - That's the question. I personally only recommend VARCHAR where OnLine is involved - eclusively. If you ever want the flexibility of reverting to SE then VARCHAR is out of the question. As to the question of efficiency it really is a question of the comparative performance of an application written using VARCHAR wherever possible against an application written using CHAR for the sanme columns. Now I have not written such a comprehensive application test, but in some simple tests I ran in the early days of VARCHAR I found there was a very small difference in performance. Either way. i.e. some VARCHAR applications were faster and some CHAR. I put the results down to the measurement errors in such a test and I now don't worry about the efficiency aspects. If anybody has conflicting information I would welcome the test definition and results. > In article <42pio3$n6c@cssun.mathcs.emory.edu> > mstrothr@informix.com "Michael Strother" writes: > > > } Our DBA claims that VARCHAR() is much less efficient than CHAR(). > Yet, > } he claims that both are fixed length columns with null > terminated string > } data. > > <snip of dba's comments> > > > He is wrong, CHAR data types are stored in their full length in the > > database table, a VARCHAR is implemented as a fixed length pointer > > in the record, my experience has been that there is no appreciable > > difference in performance although it could reasonably be argued > that> a VARCHAR is slower due to extra disk activity... > > Though if the average length of the string in a CHAR is somewhat less > than the max length, using VARCHAR will use less disk space, though I > agree with the above that it will be a little slower on disc access. > > So what's more crucial - using less disc or less CPU? That is the > question! > > -- > ======================================================================== > ====Sally Woolrich | This mail contains my > personalsally@excelsis.demon.co.uk | views not those of > my employer!============================================================ > ================ Malcolm Weallans Online Database Consultancy Phone 0628-72154 Fax 0628-37463 CIX - onlinedbc