SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Longest Email

  1. #1
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Longest Email

    What would be the longest sensible email [address] I'd be likely to have to store in my database? I wanna know what to set my varchar length to, that is both efficient and doesn't mess up anyone legitimate.

    I ask here becuase I figured other databasers might know from their own experience.
    Last edited by Percipient; Feb 21, 2003 at 13:49.
    Ed Rands

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Re: Longest Email

    Originally posted by Percipient
    What would be the longest sensible email I'd be likely to have to store in my database? I wanna know what to set my varchar length to, that is both efficient and doesn't mess up anyone legitimate.

    I ask here becuase I figured other databasers might know from their own experience.
    Are you storing plain text or HTML e-mail? If it's HTML you have to take all of the tags, etc. into account.

    EDIT: After your edit, I'd say go with varchar, somewhere between 50 and 100 in length.
    Last edited by vgarcia; Feb 21, 2003 at 13:51.

  3. #3
    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)
    i think he means e-mail addresses.

    i did a search on Google for this once and found a page that had some e-mail addy that was well over 200 chars. i thought i bookmarked it but i can't find it now... i just use VARCHAR(64) for e-mail addresses and i think that's enough. dunno if i should use more...?
    - 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

  4. #4
    SitePoint Member
    Join Date
    Feb 2002
    Location
    Kuwait
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you really mean E-mail addresses, then the standard that I've seen is varchar(128).

  5. #5
    SitePoint Wizard westmich's Avatar
    Join Date
    Mar 2000
    Location
    Muskegon, MI
    Posts
    2,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you mean email messages, I would use an actual text data type.
    Westmich
    Smart Web Solutions for Smart Clients
    http://www.mindscapecreative.com

  6. #6
    SitePoint Addict mr tinkles's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    varchar being char??? maybe int???

    if it is length of email address, then need to ask one question. what is the largest size that is reasonable, understanding consequence of being too small for valid email address?

    if, not option, to ever have email address clipped, EVER, then you need to make as large as possible 255, 2000??? Or make reasonably large, but not allow clipping upon insert...

    varchars have an interesting characteristic, only big as needed when created, as in:

    varchar(5) and varchar(255), each same size, when you INSERT "blah" into each col. varchars only as big as data, limited by size.

    for persistent varying sized data, this is very efficient.

    the problems arise when you want to change data in varchar col. change to same size data, generally no problem.

    change to different size data, whether smaller,bigger, fragmentation of some type will occur...

  7. #7
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, yes, I meant email addresses. I appologize for not being specific.

    varchar(5) and varchar(255), each same size, when you INSERT "blah" into each col. varchars only as big as data, limited by size.
    Oh, I thought it made for a less efficient index, even with varchar column types, to have them allowed longer than need be.

    the standard that I've seen is varchar(128).
    Sounds good to me. I'd image that extremely few people are going to have an email address longer than that, unless they are masochistic and like to type a lot.
    Last edited by Percipient; Feb 21, 2003 at 13:39.
    Ed Rands

  8. #8
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •