Invalidating query cache mysql


11-Oct-2020 01:34

Also, if query cache is not used at all, one can build (or request a build) with query cache disabled (see --without-query-cache).

Updated changelog entry: The server unnecessarily acquired a query cache mutex even with the query cache disabled, resulting in a small performance decrement.

This makes it difficult to make a good decision without showing the concrete performance consequences to each decision.

Currently nobody wants: 1) a blocking mutex 2) a client barrier on a write.

The current code actually locks/unlocks the query_cache lock twice when the query_cache_size is zero! This can all be bypassed if the check for query_cache_size is done without holding the QC lock as in Query_cache::store_query The CPU time wasted is very less, however, in benchmark situations, every cpu cycle counts.

How to repeat: Run a sysbench read-write benchmark with lots of threads.

3) Only be able to disable query cache at compile time/startup time.

When the query cache is disabled, the server shouldn't attempt to take the query cache mutex.You can access the patch from: 2735 Kristofer Pettersson 2008-09-08 Bug#38551 query cache can still consume [very little] cpu time even when it is off.