Invalidating query cache entries replication men dating younger women live longer
If you have experience tuning My SQL, you’re probably saying “It’ll be fast anyway, because your indices have already been loaded”.Of course, if another user searches for large green shirts (and the table has not been updated), that query will be served from the cache. Let’s say you just want to know how many large green shirts are in stock: SELECT COUNT(id) FROM tshirts WHERE color=”green” AND size=”large” Even though you just ran a query that accessed all of this data, since your specific query is not in the query cache, it will go to the database.My SQL will of course store the result in the query cache.If this query is in the cache, and the tshirts table has not changed, My SQL will return the cached result.If the query is not in the cache (or the tshirts table) has changed, My SQL will run the query and store the result in the cache.
The My SQL Query Cache is one of the most commonly misunderstood and mis-tuned components of the My SQL database.It was an early feature addition (from when My SQL clearly in the “toy database” market), and it has the potential to cause a significant speedup or slowdown for your workload.This means it is caching the results of a specific query, not operating at the table or database level.It is completely separate from the key buffer, Inno DB buffer pool, or other My SQL memory structures.
Now, let’s say the next user looks for green shirts in a specific size, and this exact query is not in the query cache: SELECT id FROM tshirts WHERE color=”green” AND size=”large” Even if no tables have been updated, this query will not make use of the previous query for green shirts.It is not the exact same query, so My SQL will have to execute this query, and store the result in the query cache.