macha
macha

Reputation: 7487

Mysql: qcache_not_cached

I am trying to understand if there is a way to get a hold of the queries that are not being cached by the mysql query_cache. I did try to see if there were any explicit references to "SQL_NOCACHE" on any of my queries, but none of them returned that string. And I still see a consistent increase in the queries that are not being cached. The percentage of those is around 5-10%, but I am trying to see if I can cache them up on memcache, if query cache doesn't cache them.

So is there a real way to log the queries that are not being cached?

Upvotes: 0

Views: 4282

Answers (1)

Andreas Wederbrand
Andreas Wederbrand

Reputation: 39951

AFAIK there is no way of doing this inside a procedure or "automated" from jdbc or similar. Neither have I ever seen it in any logs. But if you query your database using command line you could write a script that gets the Qcache_hits before and after your query. If it increases the query used the cache, if it the same it didn't.

show status like 'Qcache_hits';
select * from table;
show status like 'Qcache_hits';

Upvotes: 1

Related Questions