Currently I'm using VARCHAR/TEXT with utf8_general_ci for all character columns in mysql. Now I want to improve database layout/performance.
What I figured out so far is to better use
CHARinstead ofVARCHARfor fixed length columns as GUIDs or session ids- also use
CHARfor small columns having length of 1 or maybe 2?
As I do not want to go as wide to save my GUIDs as BINARY(16) because of handling issues, I'd rather save them as CHAR(32) to especially improve keys. (I would even save 2/3 when switching from utf8 to some 1-byte-charset)
- So what will the best character set be for such columns? ASCII? latin1? BINARY? Which collation?
- What characterset/collation to use for other columns where I do not need utf8 support but need proper sorting. A Binary would fail?
Is it good practice to mix up different character sets in same mysql (innodb) table? Or do I get better performance when all columns have same charset within same table? Or even database?