• 0

MySQL varchar collation question


Question

Hey. I have a question. I want to put cyrillic and latin characters in a varchar in mysql. What collation must i pick up for the best performance possible? Is it better to make 2 different databases for the site: one for cyrillic and another for latin?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hm, then I must make it UTF-8 but there are alot of utf-8 in mysql. Which should i pick up, utf8-bin or utf8-unicode? And I've read that the performance drops alot with unicode.

PS for cralias: I want to put cyrillic and latin characters in a varchar in mysql.

Link to comment
Share on other sites

  • 0

Ok. I kind of gathered that you indeed "want to put cyrillic and latin characters in a varchar in mysql" from your first post already.

First, decide on charset. Namely, cp-1251 or utf-8. The former is always single-byte and stores only Latin and Cyrillic characters, therefore is the fastest and most compact, at least considering database only - some systems, like Android, don't support it (I think). The latter is de facto encoding for internets, but will take two bytes for Cyrillic characters, allow any character to be stored, and make problems for programs unaware of Unicode (like PHP without mbstring).

Case sensitivity is the reason why I asked what data (for example, usernames, people names, place names, blog entries) will be stored. Case sensitive (without ci suffix, with cs suffix or bin) will be faster but not appropriate for most data, because we do like to type in lowercase but expect uppercase results as well.

Case sensitivity aside, for utf-8 utf8-general-ci is the fastest. On the other hand, utf8-unicode-ci is the most precise but also the slowest possible.

Link to comment
Share on other sites

This topic is now closed to further replies.