Thread: Field Types
View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 09:35 AM
Peter H. Coffin
 
Posts: n/a
Default Re: Field Types

On 15 Nov 2006 03:51:57 -0800, wesley@ispace.co.za wrote:
> Hi All
>
> I have fields in my Table.


Good for you. That's a fine place for them.

> The fields are of variable length.


Also good.

> I could set the field type to be "varchar" and set the width to be
> 200. Or i could just set the field type to text. I would like to know
> which option is better? I want to know which option takes up less
> memory and which way is easier. Will setting the field types to text
> take up alot more memory?


*Generally* (and there are exceptions and this varies a bit with which
version of MySQL you're running), you want small stuff in VARCHAR, and
large stuff in TEXT, more or less dividing at the length 255 mark. MySQL
version 5.0.3 and after, this gets a little fuzzier, so the concept
might be more reasonably "Stuff that changes gets VARCHAR, stuff that's
pretty static gets TEXT."

If you want a DEFAULT, you can't use TEXT.

--
Surely the 98% of DNA we share with monkeys must be enough to stop
people from sinking this low.
-- Frossie
Reply With Quote