Percona 5.1 not caching queries when table has '$' in name?

I inherited a system at work that extensively uses a large number of tables with a dollar sign ($) in their names. The system has been on MySQL 5.0 for a long time, and it depends on the query cache to speed up certain operations that query those tables a lot.

We just got a new server so I was interested in getting 5.1 for some of the new features, so I downloaded and compiled Percona Server 5.1.47-rel11.2. Performance though was horrible, and I narrowed it down to a query involving a table with a ‘$’ in it. Doing some testing, it seems any queries involving an InnoDB table with a dollar sign in it are not cached. If I change the table name to remove the ‘$’ or change the engine to MyISAM, the query is cached.

Is there any way to get around this issue? I’m not sure if it’s a bug with Percona or upstream MySQL.

I have not seen this myself. I’d start by testing with a standard MySQL build and see if the same thing happens, to narrow down the cause.

An app that relies heavily on the query cache is basically doomed if it grows much. The query cache itself is the source of extremely bad performance problems.