Forum Moderators: open

Message Too Old, No Replies

See Cached/Not Cached Queries in MySQL Query Cache

         

physics

12:37 am on Aug 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm using the MySQL query cache and would like to see the queries that are being cached (not the results but the queries themselves). Also I'd like to see the queries not being cached so I can find out why they aren't being cached. Does anyone know how to do this?

FalseDawn

3:33 am on Aug 22, 2006 (gmt 0)

10+ Year Member



I've always considered the query cache as somewhat of a "black box" and not bothered too much about its internal workings. I'm pretty sure that mySQL soes not keep any sort of log of queries that are _not_ cached - simply because this log could grow pretty much without bound.

Obviously, only SELECTs are cached, and generally the results are cached if the query is actually cacheable (some aren't - like those using dynamic functions - Date() etc) and the size of the results fall within appropriate parameters as specified by the cache settings.

Sorry, that does not help much, but I personally don't know of a way of finding this information out.

coopster

9:15 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Their is a user contribution in the User Comments area of this page in the online manual ...
[dev.mysql.com...]

physics

11:40 pm on Aug 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes I can see why they wouldn't save queries not cached and I guess I don't really need that. What I'd like is a way to type in a query and find out if it's cached and if not why not. So something like DESCRIBE SELECT ... but that returned cache info.
Also is there a way to do a select statement but suppress the output, so I can just see how long it took?

That script looks useful but it's an .exe so won't execute on my server ;)