How to disable caching queries' results for the current session in MySQL8?
The Documentation of system variables has lot of variables that regard to caching but most of them are deprecated and I could not find any to use for disabling a query caching.
I am interested in disabling caching for all statements following the disable command. Is there any way to do that?
The query cache was removed in MySQL 8.
You can try clearing buffers, as described here: how to clear/flush mysql innodb buffer pool?
However, there will be OS-level disk caching, and also hardware (HDD/SDD) caching. This makes a 2 order magnitude difference on what I'm personally testing at the moment. What you're proposing may not be possible.
I'd suggest using EXPLAIN queries and very carefully thinking about what indexes are used, how many rows are touched, whether it's creating temporary tables, and generally to think through the execution strategy MySQL will be having ot execute.
Once you believe you have fixed your performance issue, see how it performs on a cold boot.