We've recently begun testing an upgrade from mySQL5.6 to percona server 5.7 and the use of tokuDB tables. The database is serving our PHP 5.5 application which use PDO library for parameterized querying.
Upon loading up percona with identical data into a tokudb table and comparing performance to the existing production we immediately noticed a huge drop in performance (10x slower). For the queries below assume the table has 12 million rows
I've been able to narrow this issue down in the 5.7 database to the fact that when executing a query such as:
SELECT * FROM TABLE WHERE id='12345'; -- exec time 10.5sec
vs.
SELECT * FROM TABLE WHERE id=12345; -- exec time 1.3sec
where id is of column type integer. It was my impression and my research seems to confirm that mySQL should do implicit conversion of '12345' to 12345 when the column compared is a numeric type, however this doesn't seem to be happening in mySQL5.7/Percona. It was happening in mySQL5.6x
The problem here is that with this behavior, you'd need to explicitly set the type using PDOStatement::bindParam (ref http://php.net/manual/en/pdostatement.bindparam.php) for each variable! Doing this would cause a near global rewrite of all prepared statements which currently pass arrays of parameters to PDOStatement:execute() which doesn't support explicit type setting!
So - my question is this - has something changed in mySQL so implicit conversion isn't done in 5.7 or is it Percona or is it tokuDB table? Is there a configuration parameter I can set to turn this back on?