SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Assigning TEXT data types to fields

    Hi all,

    If I was to assign the data type TEXT to a field in my database, would this mean that MySQL will assign a space of 65,535 to each field entry in my database regardless of whether this field has any data in it?

    There will be instances where the field (that is of data type TEXT) will contain no, or very little data, so I don't want all this unused space in my database.

    Thanks

    Tryst

  2. #2
    SitePoint Evangelist Mr. Brownstone's Avatar
    Join Date
    May 2002
    Location
    Relative
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use VARCHAR(n) if you have fields which you know will contain very little data. For example, VARCHAR(255).

    Iím afraid I do not know if space is allocated on-the-fly or in one 64k-chunk with TEXT fields.
    Of course, that's just my opinion. I could be wrong.

  3. #3
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that I have a 'Notes' field where customers will have to enter notes, sometimes this can be of a high volume, so having a varchar() may not be appropriate.

    Thanks

    Tryst


Bookmarks

Posting Permissions

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