Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long should SQL email fields be? [duplicate]

I recognize that an email address can basically be indefinitely long so any size I impose on my varchar email address field is going to be arbitrary. However, I was wondering what the "standard" is? How long do you guys make it? (same question for Name field...)

update: Apparently the max length for an email address is 320 (<=64 name part, <= 255 domain). Do you use this?

like image 652
Mala Avatar asked Aug 19 '09 00:08

Mala


People also ask

How long should an email field be?

The length can certainly vary, but the average email is about 25 characters long – right within what can be defined as a “normal” boundary. The “normal” boundary will change from site to site, but for the forms we studied, it typically spanned from 18 to 33 characters.

How long should SQL queries take?

The query takes 20 to 500 ms (or sometimes more) depending on the system and the amount of data. The performance of the database or the database server has a significant influence on the speed.

What is the maximum length of an email address?

"There is a length limit on email addresses. That limit is a maximum of 64 characters (octets) in the "local part" (before the "@") and a maximum of 255 characters (octets) in the domain part (after the "@") for a total length of 320 characters.


1 Answers

The theoretical limit is really long but do you really need worry about these long Email addresses? If someone can't login with a 100-char Email, do you really care? We actually prefer they can't.

Some statistical data may shed some light on the issue. We analyzed a database with over 10 million Email addresses. These addresses are not confirmed so there are invalid ones. Here are some interesting facts,

  1. The longest valid one is 89.
  2. There are hundreds longer ones up to the limit of our column (255) but they are apparently fake by visual inspection.
  3. The peak of the length distribution is at 19.
  4. There isn't long tail. Everything falls off sharply after 38.

We cleaned up the DB by throwing away anything longer than 40. The good news is that no one has complained but the bad news is not many records got cleaned out.

like image 91
ZZ Coder Avatar answered Sep 22 '22 06:09

ZZ Coder