Mysql ASCII vs Unicode

Just quick:

Will SELECT ... WHERE name LIKE '...' query be faster if the name column is ASCII and not UTF-8?

Thank!

+2


source to share


2 answers


No, not at all. There is no reason why it should be anyway, they both would be comparing nearly the same amount, if not exactly the same amount, of the data.



There may be some minor overhead for converting text encodings, but it won't be anything near the overhead of actually running the query.

+6


source


I did some timing tests for MySQL 5 character set. Column character encoding affects speed: if the column is UTF8, then it is 60% longer to manipulate text than if it is ASCII or Latin1. This is true whether the results are returned in the same character set as the column, or are converted and it is independent of the query character set. Only the character set of the column matters!

BUT, before you go away and convert everything to ASCII, understand that this 60% bump only applies to the text processing part of the database, and in general, accessing and indexing strings takes up this tiny difference several times. For example, on a modern but cheap Linux server, I measured the difference as a cost of just 16ms per megabyte of text.



In all but the most critical situations, this tiny difference is worth it to achieve a consistent UTF-8 workflow.

+5


source







All Articles