SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Chris Roane's Avatar
    Join Date
    Jul 1999
    Location
    Helena, MT
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MYSQL Column Types

    Does it really matter what column type a column is, if you aren't worried about people putting in false data? I am not really talking about the totally different ones, but like varchar() and text.....they both can hold the exact same type of data, except in different amounts.

    Also, does it have any affect on the speed?

  2. #2
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    VARCHAR takes up the length of the data + 1 byte. TINYTEXT is the TEXT family equivalent. TEXT itself takes length + 2 bytes.

    the diff between VARCHAR and TINYTEXT is that you can specify a length that you want for VARCHAR. shouldn't be any speed diff.

    prior to MySQL 3.23 you couldn't index the TEXT types. now you can but you MUST specify a prefix unlike VARCHAR. i.e. KEY(your_text_family_col(32)). when you index VARCHAR(x) the index will be the full length of x unless you specify shorter.

    EDIT: you should always use the smallest type you need. so don't use TEXT where VARCHAR will do. i don't really know why there's a TINYTEXT. AFAIK it should be the same as VARCHAR(255).
    Last edited by DR_LaRRY_PEpPeR; Aug 10, 2001 at 22:59.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Difference between TINYTEXT and VARCHAR - don't know if there still is any practical difference between them, or if its just a legacy thing, but besides the issue of indexing on earlier versions, there could also be differences in terms of being able to do full text searches on the data. Probably little differences like that. I don't really know.


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
  •