Jump to content

Varchar length for user email.


joe92

Recommended Posts

Quite a few results coming up on google searches so thought I would ask you guys for your opinion:

 

An email stored in the members table, I am currently using varchar(75). Is there a recommended length? And is varchar even the correct type?

Link to comment
Share on other sites

You have to use your gut instinct and your internet savvy-ness.

 

Of all emails you've seen how many of them were 300+ characters long? Maybe none.

 

If you have 99% of people being fine with your 75 chars restriction, does it justify to put the setting to 300+ character for that one guy with a very long email address?

 

I don't think so, should he use his second, or third email address (which are shorter) to sign up on your website.

 

Why would you waste resources for that 1%.

 

 

I think 80 chars is a good area, I haven't really seen too many emails longer than that, most people try to aim for something short and catchy.

Link to comment
Share on other sites

You have to use your gut instinct and your internet savvy-ness.

 

Of all emails you've seen how many of them were 300+ characters long? Maybe none.

 

If you have 99% of people being fine with your 75 chars restriction, does it justify to put the setting to 300+ character for that one guy with a very long email address?

 

I don't think so, should he use his second, or third email address (which are shorter) to sign up on your website.

 

Why would you waste resources for that 1%.

 

 

I think 80 chars is a good area, I haven't really seen too many emails longer than that, most people try to aim for something short and catchy.

 

What resources would you be wasting?

Link to comment
Share on other sites

 

What resources would you be wasting?

 

I don't know, you're free to correct me if I'm wrong, you're the expert. As far as I've understood database design you should be using as much as necessary and as little as possible to create an efficient database design, it make it perform faster.

Link to comment
Share on other sites

I don't know, you're free to correct me if I'm wrong, you're the expert. As far as I've understood database design you should be using as much as necessary and as little as possible to create an efficient database design, it make it perform faster.

 

Well that's the great thing about the varchar column type.  If you do like varchar(75) it will accept a string up to 75 characters long, but it will use only what the actual length of the string is.  So if the email address is only 10 characters in length, there's not gonna be an extra 65 characters sitting there empty, no "whitespace buffer" to speak of (with other column types, this does happen).

 

Anyways, it's more a matter of principle than resources.  People pick and use email addresses they can remember.  It is a reasonable assumption to make that a super long email address, while technically valid, probably doesn't belong to a human, but a bot.  I mean TBH, I think even 75 is too much. 

 

Link to comment
Share on other sites

Well that's the great thing about the varchar column type.  If you do like varchar(75) it will accept a string up to 75 characters long, but it will use only what the actual length of the string is.  So if the email address is only 10 characters in length, there's not gonna be an extra 65 characters sitting there empty, no "whitespace buffer" to speak of (with other column types, this does happen).

Ohh I didn't know this was a varchar specific thing, learned something new, thanks for letting me know.

 

 

Anyways, it's more a matter of principle than resources.  People pick and use email addresses they can remember.  It is a reasonable assumption to make that a super long email address, while technically valid, probably doesn't belong to a human, but a bot.  I mean TBH, I think even 75 is too much.

I definitely agree, it's a matter of principles. I don't see a reason to allow 300 characters, if somebody wants to sign up he simply should use a different email address, something more usable, just because I didn't design the website for emails that long.

 

I purposely say "usable" because I find emails that long useless, it's easy to put a spelling mistake into such long emails, they are hard to work with.

Link to comment
Share on other sites

Thanks for all the replies. I have decided upon using VARCHAR(321) as I have htmlentities running through all email inputs forms, and to send an email without being a paying customer they have to enter a CAPTCHA code so bots can eff off.

 

I see it like so. If I lose 1% of customers because of having a 'short' varchar length, and somewhere else in the site another 1% of customers dislike a function or something, and another 1% somewhere else it could add up to losing 10% of my customer base purely over such a little thing. Best to account for all things to start with, especially as it requires such little work to set a varchar length.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.