Using latin character sets for storing emails and domain names in MySQL -


the generic advice on stackoverflow use utf8 or utf8mb4 everywhere in mysql, fields ever contain latin characters.

to clarify, for column containing latin characters, using utf8mb4:

  1. ...result in larger index , higher memory usage?
  2. ...use more storage space when using column type varchar(100) or char(100)?
  3. ...allow more than 100 characters stored in column type varchar(100) or char(100)?

it's 2017. use utf8mb4 , varchar(255) every generic "string" field unless have compelling reason deviate that. pure engish speakers love use quirky non-latin characters in situations "¯\_(ツ)_/¯" , "ᕕ( ᐛ )ᕗ" or 😎.

email addresses can contain non-ascii characters in both domain component, , in local-part before @. whatever rules there these things seem getting thrown out window 1 one, bets off future holds. @ stays, that's thing i'd count on.

unless have system juggling billions of email addresses in memory storage cost of varchar largely irrelevant. remember, varchar(100) , varchar(255) take same amount of space 50-character string. thing 100-length field on someone's nerves when email address "too long" , gets trimmed arbitrarily.

additionally, varchar measures length in characters , not bytes, difference relevant when multi-byte characters involved. bob@example.com takes identical amounts of space in latin-1, utf-8 , utf8mb4.

don't use char variable length character fields. 1980s have died. let go.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -