Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder student's Avatar
    Join Date
    Jan 2007
    Posts
    129
    Thanks
    13
    Thanked 0 Times in 0 Posts

    what to use? VARCHAR or TEXT?

    hello,
    I have a doubt.
    I have orizinally declared the fields in my table like this:

    ...
    title varchar(200) default NULL,
    description text,
    keywords text
    details text
    ....

    But I have limited 'description' and 'keywords' to 300 characters each and 'details' to 1000 characters in my php script.

    Now, shall I change it like this:

    ...
    title varchar(200),
    description varchar(300),
    keywords varchar(300),
    details varchar(1000),
    ....

    I have a fulltext index on these fields and I wish to optimize my table for good performance.

    please inform me how should I declare my fields.
    thank you.

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    varchar can only be 255 characters long.

    Code:
    CHAR( )	A fixed section from 0 to 255 characters long.
    VARCHAR( )	A variable section from 0 to 255 characters long.
    TINYTEXT	A string with a maximum length of 255 characters.
    TEXT	A string with a maximum length of 65535 characters.
    BLOB	A string with a maximum length of 65535 characters.
    MEDIUMTEXT	A string with a maximum length of 16777215 characters.
    MEDIUMBLOB	A string with a maximum length of 16777215 characters.
    LONGTEXT	A string with a maximum length of 4294967295 characters.
    LONGBLOB	A string with a maximum length of 4294967295 characters.[

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    http://www.codingforums.com/showpost...33&postcount=6
    this helps me choose on what field type to set, hope it does the same for you

  • #4
    Regular Coder student's Avatar
    Join Date
    Jan 2007
    Posts
    129
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Thank you maghiel and rafiki,
    I indeed neglected the very basic concepts.
    Thanks for the information.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •