Mysql caches: Difference between revisions
From wikinotes
(Created page with "= The Query Cache = <blockquote> {{ NOTE | Mysql-8+ drops support for the query cache.<br> It is disabled by default starting in MySQL-5.6<br> https://dev.mysql.com/blog-archive/mysql-8-0-retiring-support-for-the-query-cache/ }} Benchmarking is difficult, since MySQL is often configured to use a query cache.<br> This is similar to a key-value store of cacheable-queries, and their result.<br> This interferes with benchmarking, since repeat queries may be much faster to l...") |
|||
Line 1: | Line 1: | ||
= | = Query Cache (<8.0) = | ||
<blockquote> | <blockquote> | ||
{{ NOTE | | {{ NOTE | | ||
It is disabled by default starting in MySQL-5.6<br> | It is disabled by default starting in MySQL-5.6<br> | ||
https://dev.mysql.com/blog-archive/mysql-8-0-retiring-support-for-the-query-cache/ | https://dev.mysql.com/blog-archive/mysql-8-0-retiring-support-for-the-query-cache/ |
Revision as of 01:57, 7 September 2022
Query Cache (<8.0)
NOTE:
It is disabled by default starting in MySQL-5.6
https://dev.mysql.com/blog-archive/mysql-8-0-retiring-support-for-the-query-cache/Benchmarking is difficult, since MySQL is often configured to use a query cache.
This is similar to a key-value store of cacheable-queries, and their result.
This interferes with benchmarking, since repeat queries may be much faster to lookup.To avoid the query cache:
# 1. Add a calculated-function to your selected rows - since they are not cacheable # TODO: validate SELECT ..., NOW() FROM ... # 2. Use 'SQL_NO_CACHE' in your query # (This often has not worked for me) SELECT SQL_NO_CACHE ... FROM ...It is implemented as an LRU key-value store for exact (byte-for-byte) query matches.
Each cache entry knows which tables it references for permissions, and cache-invalidation.
Whenever any row is changed in a table, all cache entries using that table are purged.
The OS Cache
TODO:
research