List:General Discussion« Previous MessageNext Message »
From:Sander Pilon Date:August 21 2000 4:09pm
Subject:RE: CHAR vs VARCHAR
View as plain text  
> That is exactly why I asked the question.
>
> Rob McMillin wrote:
> >
> > Claude Cormier wrote:
> >
> > > Unless you need a small text column or the data entered will
> always have
> > > a fixed number of characters, is there a good reason for not using
> > > VARCHAR all the time instead of CHAR?
> >
> > According to the docs, CHAR is faster because the rowsizes are
> all the same. I have to wonder about this, because accessing a
> larger table (and tables made up
> > of strictly CHAR types would be sizeably larger) is generally slower.

Larger does not always equal slower. (In fact, larger often equals faster -
very often you can exchange space for speed and vice-versa.)

If you have a fixed size record, you can calculate the position of a record
very fast and efficiently, whereas with a variable sized record you will
need some sort of index-tree to find the offset of the record you want.
That's probably why a varchar is slow and a char is fast. (But, I didnt
write MyISAM - so if you wanna know the details, read the sourcecode or beg
a MySQL developer for more information)

-S

Thread
CHAR vs VARCHARClaude Cormier21 Aug
  • Re: CHAR vs VARCHARRob McMillin21 Aug
  • Re: CHAR vs VARCHARClaude Cormier21 Aug
    • RE: CHAR vs VARCHARSander Pilon21 Aug
  • Re: CHAR vs VARCHARKris Dahl21 Aug
    • Re: CHAR vs VARCHARJan Dvorak21 Aug
      • Re: CHAR vs VARCHARKris Dahl22 Aug
  • Re: CHAR vs VARCHAREd Wang21 Aug
Re: CHAR vs VARCHARKris Dahl21 Aug
  • RE: CHAR vs VARCHARChristopher Thompson21 Aug
    • RE: CHAR vs VARCHARDana Powers21 Aug
    • Re: CHAR vs VARCHARSteve Ruby21 Aug
  • Fastest way to select setsChristopher Thompson21 Aug
    • Re: Fastest way to select setsSteve Ruby22 Aug
    • Re: Fastest way to select setsTonu Samuel22 Aug
      • Re: Fastest way to select setsTino Hendricks28 Aug
        • Re: Fastest way to select setsTonu Samuel2 Sep
Re: CHAR vs VARCHARPaul Schmidt22 Aug