문제

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?

도움이 되었습니까?

해결책

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';
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top