1. 程式人生 > >mysql utf8_general_ci 與 utf8_unicode_ci的區別

mysql utf8_general_ci 與 utf8_unicode_ci的區別

For any Unicode character set, operations performed using the xxx_general_ci collation are faster than those for the xxx_unicode_ci collation. For example, comparisons for the utf8_general_ci collation are faster, but slightly less correct, than comparisons for utf8_unicode_ci. The reason for this is that 

utf8_unicode_ci supports mappings such as expansions; that is, when one character compares as equal to combinations of other characters. For example, in German and some other languages ß is equal to ssutf8_unicode_ci also supports contractions and ignorable characters.utf8_general_ci is a legacy collation that does not support expansions, contractions, or ignorable characters. It can make only one-to-one comparisons between characters.



譯文

對於任何unicode字元,xxx_general_ci比xxx_unicode_ci速度快。因為xxx_unicode_ci支援類似擴充套件的對映。擴充套件的意思是一個字元等於多個字元的組合。比如在德語中,ß等於ss。xxx_unicode_ci也支援收縮和可忽視字元。xxx_general_ci是傳統的校對規則,它不支援擴充套件、收縮、可忽視字元。它只會一個字元一個字元的比較

總結

綜上所述,xx_unicode_ci實現了unicode標準,支援擴充套件、可忽視字元等,由於準確性高,所以速度“相對慢”,不過根據現有cpu的效能,已經感覺不出“相對慢”。

xx_general_ci相對古老,是utf8的預設校對規則,由於不是那麼準確,所以速度快。由於是utf8的預設校對規則,所以,我們推薦使用這種校對規則,在開發中,會省去很多麻煩。

參考

擊開啟連結