On Sat, Feb 4, 2017 at 4:21 AM, Sergey Petrunia <sergey@mariadb.com> wrote:
Hi Varun,
On Fri, Feb 03, 2017 at 08:20:51PM +0530, Varun wrote:
revision-id: 787610a1f5cec04311fd16f6c1de87171e5cfdd4 (mariadb-10.2.3-159-g787610a) parent(s): bc12d993d7bc94a9533028a258afc7e4ceb21e92 author: Varun Gupta committer: Varun Gupta timestamp: 2017-02-03 20:17:16 +0530 message:
MDEV-10766: Queries which start with WITH clause do not get inserted into query cache
Added conditions so that the WITH queries are also added to the query cache
--- mysql-test/r/query_cache.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/query_cache.test | 14 ++++++++++++++ sql/sql_cache.cc | 5 ++++- 3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache. result index d34c96c..fa169d4 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2136,6 +2136,36 @@ Qcache_hits 1 use test; drop database `foo.bar`; End of 10.0 tests +FLUSH USER_STATISTICS; +FLUSH CLIENT_STATISTICS;
I'm wondering what is the reason for the above? Qcache_XXX status variables are flushed with FLUSH STATUS.
Updated
+flush status; +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 0 +create table t1 (i int); +with cte as (select * from t1) select * from cte; +i +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 0 +with cte as (select * from t1) select * from cte; +i +show status like "Qcache_queries_in_cache"; +Variable_name Value +Qcache_queries_in_cache 1 +show status like "Qcache_inserts"; +Variable_name Value +Qcache_inserts 1 +show status like "Qcache_hits"; +Variable_name Value +Qcache_hits 1 +drop table t1; restore defaults SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_size= default;
BR Sergei -- Sergei Petrunia, Software Developer MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog