List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 11 2000 9:32pm
Subject:Re: VARCHAR or VAR?
View as plain text  
At 10:34 AM +0200 09-11-2000, Maximo Migliari wrote:
>I'm interested in finding out whether using char is better to using 
>varchar on a system in which storage space is not of much concern.
>
>I know that, to a large extent, the speed of a select-type query is 
>dependent on the size of the database.  However, in the mySQL 
>manual, using CHAR-type fields is considered better if you want to 
>speed up queries.  So which one is it, VARCHAR (making sure the 
>record is the smalest in terms of size it can be), or CHAR (always a 
>set size, but supposedly faster on queries) ???

The manual is correct for the general case.

If you want to know for your particular table, run your queries with
CHAR columns, then change the columns to VARCHAR and run your queries
again..

>
>For example, I have a products table which is something like this:
>
>ID: int(9)
>producers_id: medint(8)
>short_desc: char(40)
>price: decimal(9,2)
>image: char(100)
>...
>...
>
>anyway, my image field, for example, will contain the URL of the 
>image for this product, so it might be very short, i.e.
>
>www.vindiou.com/theimage.gif
>
>or very long:
>
>www.vindiou.com/the_producer/his_product/special_deal/blablabla/blablabla/ladida/image.gif
>
>so basically... what would be better?
>
>In fact, what I need to know is: will the speed decrease you get by 
>using varchar's be compensated by the fact that the record will be 
>as small as possible??
>
>Kind Regards,
>Thanks in Advance,
>Maximo Migliari.


-- 
Paul DuBois, paul@stripped
Thread
VARCHAR or VAR?Maximo Migliari11 Sep
  • Re: VARCHAR or VAR?Jan Dvorak11 Sep
  • Re: VARCHAR or VAR?Paul DuBois11 Sep