views:

253

answers:

2

Just a quick one:

Will SELECT ... WHERE name LIKE '...' query be faster if name column is ASCII rather then UTF-8?

Thanks!

+4  A: 

No, not really. There's no reason it should be at any rate, they will both be comparing almost the same amount, if not exactly the same amount, of data.

There might be some very minor overhead for converting text encodings, but it will be nothing next to the overhead of actually running the query.

Matthew Scharley
Thanks, that's what I though.
David
A: 

I have done some character set timing tests of MySQL 5. The column character encoding does have an effect on speed: If the column is UTF8 then it is about 60% longer to manage the text than if it is ASCII or Latin1. This is true whether or not the results are being returned in the same character set as the column, or being converted, and it is independent of the query character set. Only the column character set makes any difference!

BUT, before you go off and convert everything to ASCII, realize that this 60% hit is only on the text processing portion of the database, and in general row access and indexing operations take several times this tiny difference. For example, on a modern, but cheap Linux server, I measured the difference as costing only 16ms per megabyte of text.

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

MtnViewMark