char vs. varchar

2007-02-28 Thread Alexander Lind
Hi all Which of these two tables wiil yield the best performance in a table with about 6 million entries (for rapid selects on either field): table_using_char field1 char(50), field2 char(50), filed 3 char(50), separate unique indexes on all 3 fields table_using_varchar field1 varchar(50), f

Re: CHAR vs. VARCHAR

2002-10-09 Thread Jan Steinman
>From: christophe barbe <[EMAIL PROTECTED]> > >Is it then correct that VARCHAR(255) and TINYTEXT are strictly >equivalent? I believe they work almost the same, but there may be performance implications because they are stored differently. My understanding is that TINYTEXT is simply a sort of BL

Re: CHAR vs. VARCHAR (fork)

2002-10-08 Thread Michael T. Babcock
The only time you will gain a speed advantage is if you have no variable >>length fields in your record (varchar, text, etc.). You may notice that >>all your CHAR fields are changed to VARCHAR as soon as a variable length >>field type is added. CHAR is less efficient from a space storage point

Re: CHAR vs. VARCHAR

2002-10-08 Thread christophe barbe
Is it then correct that VARCHAR(255) and TINYTEXT are strictly equivalent? If no, where is the difference? Thanks, Christophe NOTE: I understand now the "sql,query" stuff. Strange idea. -- Christophe Barbé <[EMAIL PROTECTED]> GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8 F67A 8F45 2F1E D72C B

Re: CHAR vs. VARCHAR

2002-10-08 Thread Christophe Barbé
Thanks, your comments are very helpful, especially the info that if I have already a not-fixed field in a table the performance cost of adding a VARCHAR (instead of a CHAR) is 0. NOTE for the Mailing-list Admins: There is a 1 hour (at least) between the post and the availability of the mail in th

Re: CHAR vs. VARCHAR

2002-10-08 Thread Brent Baisley
VARCHAR basically sets a maximum length for the field and only stores the data that is entered into it, thus saving on space. The CHAR type has a fixed length, so if you set CHAR(100), 100 character worth of space will be used regardless of what the contents are. The only time you will gain a s

Re: CHAR vs. VARCHAR

2002-10-08 Thread Michael T. Babcock
Christophe Barbe wrote: >I am looking about experienced pros and cons on the use of VARCHAR. My >understanding is that, except if you know that each time the text will >have the same length, VARCHAR is better. This seems a bit too perfect to >be true. > You do not have to use all the chars ... if

Re: CHAR vs. VARCHAR

2002-10-08 Thread Michael T. Babcock
Christophe Barbe wrote: >Le mar 08/10/2002 à 11:35, Michael T. Babcock a écrit : > > >>Before I forget: SQL, QUERY ... going write a filter for these some day ... >> >> > >I don't get what you mean by "SQL, QUERY ...". >I know how to write a SQL QUERY. > > I was making sure I'd get past t

Re: CHAR vs. VARCHAR

2002-10-08 Thread Christophe Barbe
Le mar 08/10/2002 à 11:35, Michael T. Babcock a écrit : > Before I forget: SQL, QUERY ... going write a filter for these some day ... I don't get what you mean by "SQL, QUERY ...". I know how to write a SQL QUERY. I am looking about experienced pros and cons on the use of VARCHAR. My understandi

Re: CHAR vs. VARCHAR

2002-10-08 Thread Michael T. Babcock
Before I forget: SQL, QUERY ... going write a filter for these some day ... christophe barbe wrote: >What are the disadvantages of using VARCHAR instead of CHAR. >Is it going to be considerably slower? > > It really depends on your table, but if you find it slower, break down into multiple t

CHAR vs. VARCHAR

2002-10-08 Thread christophe barbe
After reading the mysql documentation, I am not sure to get correctly the pros and cons of the VARCHAR type. My understanding is that it is useful when a text field has a length that may vary a lot. For example I am thinking using it for a description field where users will put nothing or a sm

RE: Char vs Varchar field types

2002-04-10 Thread Mike Grabski
also, note that char is changed to varchar in some cases, such as when there is a text field in the table. -Original Message- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 10, 2002 10:40 AM To: 'Luke van Blerk'; [EMAIL PROTECTED] Subject: RE: Char vs Var

Re: Char vs Varchar field types

2002-04-10 Thread David Felio
It depends on who you talk to and what you want to do. varchar will use less disk space, but char is faster to access (except for InnoDB tables, where varchar has the advantage). The benefit is using char is that the rows have a fixed length so MySQL knows exactly where each row starts and can

Re: Char vs Varchar field types

2002-04-10 Thread Victoria Reznichenko
Luke, Wednesday, April 10, 2002, 4:18:48 PM, you wrote: LvB> When is it appropriate to use Char instead of Varchar and vice versa? CHAR column type has fixed length, VARCHAR is variable-length string. CHAR column type appropriate to use when you have data with the same length. Don't forget that

RE: Char vs Varchar field types

2002-04-10 Thread Jon Haworth
Hi Luke, > When is it appropriate to use Char instead of Varchar and vice versa? Use CHAR for when you know in advance how many characters are going to be in that field. A good example is for MD5 hashes: they are always 32 characters long, so you can use CHAR(32). Use VARCHAR for when you don't

Re: Char vs Varchar field types

2002-04-10 Thread John Klein
[EMAIL PROTECTED] wrote: > > When is it appropriate to use Char instead of Varchar and vice versa? Use char when you expect the length of the field to always be the same. Use varchar when you're not sure. Basically, when you're using varchar you're assigning a limit to the size of the string th

Char vs Varchar field types

2002-04-10 Thread Luke van Blerk
Hi everyone, When is it appropriate to use Char instead of Varchar and vice versa? Thanks Luke mysql - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the