Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Mysql storing text - 500 chars max

  • 04-07-2007 7:33pm
    #1
    Registered Users, Registered Users 2 Posts: 1,086 ✭✭✭


    I am storing a string in my MySql database. I have a field with I want to hold max 500 characters.

    If I use the 'text' type will that column type be taking up an unnecessary amount of memory since the max string size of 'text' is 65535 chars. I'll only be storing 500 chars maximum.

    Am I better to use 2 varchar / tinytext fields which only hold 255 characters each?


Comments

  • Closed Accounts Posts: 382 ✭✭misterq


    you answered your own question.
    The size of the text field is a MAXIMUM of 65535 chars. That doesn't mean all columns of this type will be that size.
    The amount of space taken up by the column will be string length + 2 bytes.

    Eg: if you put in 500 chars, the data space taken up is 502 bytes.


  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    MySQL's handling of TEXT is pretty much the same as VARCHAR. In some other databases the TEXT type can have much more minimum overhead.


  • Registered Users, Registered Users 2 Posts: 9,560 ✭✭✭DublinWriter


    Doesn't MySQL have a CLOB\MEMO (blob-like char) type field?


Advertisement