Christopher Thompson wrote:
>
> > >> The big difference is speed. CHARs are hella faster than
> > VARCHARS. By a
> > >> lot. CHARs take up a bit more disk space. It's disk space
> > vs. speed. We
> > >> choose speed for our applications.
> > >
> > > Am I incorrect in assuming that CHARs are faster only if there are no
> > > VARCHARs in the record? In fact, isn't that one of the silent
> > type changes?
> >
> > Yes, I am sorry. Its an all or nothing type thing. If you have any
> > VARCHARS the whole table will slow down... and it is a sizable amount
> > according to my experiments.
> >
>
> Given this, what is the reason to use VARCHARs instead of CHARs?
>
> Given that the trailing spaces are removed when the value is retreived, I
> can only see the case where you want to store strings with trailing spaces
> as an instance where you would want to use VARCHAR.
>
In the case of tables with very long variable length fields
such as TEXT and BLOB. Or in the case where you decide that the space
savings of having the variable length fields is better than the speed
gained.