詳細検索

Since MySQL 5.5 index does not work in sjis environment and is slow

Avatar
by furuyamah
1 min read
Tags

Since MySQL 5.5 index does not work in sjis environment and is slow
Translated from 日本語 • View original

When I upgraded MySQL to version 5.6, I was in trouble because some queries were slow. As a result of a lot of ggg, the information that hit is as follows.

character_set_connection = sjis and DATETIME columns are not indexed http://bugs.mysql.com/bug.php?id=74449 It seems that only in the case of character_set_connection = sjis, incorrect type conversion is performed on DATETIME and DATE type columns. It's a good idea not to stop sjis, but unfortunately it's not a system that can throw away sjis, so it's dealt with with CAST as follows.

For date type

AND dl.date >= '2014-08-10'
↓
AND dl.date >= cast('2014-08-10' as date)

For datetime type

AND dl.date >= '2014-08-10'
↓
AND dl.date >= cast('2014-08-10' as datetime)

For your reference.

Related Articles