Query caching is one of the prominent features in MySQL and a
vital part of query optimization. It is important to know
how it works as it has the potential to cause significant
performance improvements – or a slowdown – of your workload.
The MySQL query cache is a global one shared among the
sessions. It caches the select query along with the result set,
which enables the identical selects to execute faster as the data
fetches from the in memory. It is important to have everything
identical, no new comments, spaces, or most significantly
differences in the WHERE clause. Basically when you trigger a
select query, if it is available in the cache; it fetches from
there or it considers the query as a new one and will go to the
parser.
Even though it has some nice advantages, the MySQL query cache
has its own downsides too. Well, let’s think about this: If you
are frequently updating the table, you are then invalidating …
[Read more]