MySQL Forums
Forum List  »  Performance

Re: Queries slow down daily, optimizing helps -> why?
Posted by: Rick James
Date: February 19, 2009 10:53PM

key_buffer is for MyISAM indexes only.

Query_cache is for statements. And you have it "ON" with 500MB of space (a lot). There are several caveats:
* When a table is modified (INSERT/...) all entries in the QC for that table are purged.
* When the _identical_ SELECT comes in (not even so much as a space different), the engine will first look in the QC to see if it is there. If so, it will return the result set from the QC.
* Result sets that are too big won't go into the QC.

So, another explanation for the slowdown...
1. Do the SELECT -- it gets into QC.
2. The table is modified -- QC flushed (for that table)
3. Do the SELECT again -- not found in QC, so slow.
4. Run SELECT again -- now blazingly fast because it is QC.

SHOW STATUS LIKE "Query%";
will give some numbers that (with some dividing) can give you the hit/miss rate, etc.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Queries slow down daily, optimizing helps -> why?
2232
February 19, 2009 10:53PM
2086
March 18, 2009 03:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.