Unix Technical Forum

Field Types

This is a discussion on Field Types within the MySQL forums, part of the Database Server Software category; --> Hi All I have fields in my Table. The fields are of variable length. I could set the field ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 09:35 AM
wesley@ispace.co.za
 
Posts: n/a
Default Field Types

Hi All

I have fields in my Table. The fields are of variable length. 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?

Thanks
Wes

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:12 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com