Note that there are some explanatory texts on larger screens.

plurals
  1. POAuto-deleting mySQL query cache?
    primarykey
    data
    text
    <p>I'm the owner of a web-game with a high-traffic database with a lot of queries. I'm now optimizing the mySQL and tools like mysqltuner keep saying that I have insufficient query cache memory.</p> <pre><code>+-------------------------+-----------+ | Variable_name | Value | +-------------------------+-----------+ | Qcache_free_blocks | 218 | | Qcache_free_memory | 109155712 | | Qcache_hits | 60955602 | | Qcache_inserts | 38923475 | | Qcache_lowmem_prunes | 100051 | | Qcache_not_cached | 10858099 | | Qcache_queries_in_cache | 19384 | | Qcache_total_blocks | 39134 | +-------------------------+-----------+ </code></pre> <p>That's from about 1,5 day of running the server. Ideally the lowmem_prunes would be 0 of course, but there are very much queries which are user-based. Like, </p> <pre><code>SELECT username FROM users WHERE id='1'; SELECT username FROM users WHERE id='12'; SELECT username FROM users WHERE id='12453'; SELECT username FROM users WHERE id='122348'; </code></pre> <p>As I have about 3000 different users a day logging in you will have many queries like this in the memory.</p> <p>I know about the ON DEMAND rule, but I'm avoiding it because we have a lot of queries which I don't want to check all over.</p> <p>Increasing the memory wouldn't be a fix either since we're having so many queries.</p> <p>Then I came up with the idea to make a cronjob to automatically RESET the query cache when the lowmem_prunes is zero. (which will probably be once an hour)</p> <p><strong>What's the best option?</strong><br> 1. Automatically reset the query cache once an hour<br> 2. Buy more RAM and increase the cache with 1GB for example (which has it's downsides... I rather not do that)<br> 3. Specify per query which should be kept in cache in which not.<br> 4. Just keep it like this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload