According to the KnowledgeBase:
"Note that queries returned from the query cache do not increment the Com_select status variable, so to find the total number of valid queries run on the server, add Com_select to Qcache_hits."
( https://mariadb.com/kb/en/mariadb/documentation/optimization-and-tuning/buffers-caches-and-threads/query-cache/ )
This is true for MySQL, but not for MariaDB where Com_select actually does seem to get incremented even on query cache hits. Not sure whether this was an intended change (IMHO the MariaDB behaviour is the more correct one), but it is in contradiction to the documented state for sure.
MariaDB [test]> CREATE TABLE t1 (id INT PRIMARY KEY);
|
Query OK, 0 rows affected (0.06 sec)
|
|
MariaDB [test]> INSERT INTO t1 VALUES (1);
|
Query OK, 1 row affected (0.02 sec)
|
|
MariaDB [test]> SHOW GLOBAL STATUS WHERE Variable_name IN ('Com_select', 'Qcache_hits');
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Com_select | 0 |
|
| Qcache_hits | 0 |
|
+---------------+-------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [test]> SELECT * FROM t1;
|
+----+
|
| id |
|
+----+
|
| 1 |
|
+----+
|
1 row in set (0.00 sec)
|
|
MariaDB [test]> SHOW GLOBAL STATUS WHERE Variable_name IN ('Com_select', 'Qcache_hits');
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Com_select | 1 |
|
| Qcache_hits | 0 |
|
+---------------+-------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [test]> SELECT * FROM t1;
|
+----+
|
| id |
|
+----+
|
| 1 |
|
+----+
|
1 row in set (0.00 sec)
|
|
MariaDB [test]> SHOW GLOBAL STATUS WHERE Variable_name IN ('Com_select', 'Qcache_hits');
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Com_select | 2 |
|
| Qcache_hits | 1 |
|
+---------------+-------+
|
2 rows in set (0.00 sec)
|
|
MariaDB [test]> SELECT * FROM t1;
|
+----+
|
| id |
|
+----+
|
| 1 |
|
+----+
|
1 row in set (0.00 sec)
|
|
MariaDB [test]> SHOW GLOBAL STATUS WHERE Variable_name IN ('Com_select', 'Qcache_hits');
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Com_select | 3 |
|
| Qcache_hits | 2 |
|
+---------------+-------+
|
2 rows in set (0.00 sec)
|
- relates to
-
MDEV-4981
Account for queries handled by query-cache in USER_STATISTICS (and in HOST_STATISTICS)
-
-
Closed
{"report":{"fcp":1272.2999999523163,"ttfb":223,"pageVisibility":"visible","entityId":49136,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"daeab72f-a47d-4b3b-9bac-2b668a30634f","navigationType":0,"readyForUser":1358.1000000238419,"redirectCount":0,"resourceLoadedEnd":913.6999999284744,"resourceLoadedStart":231.60000002384186,"resourceTiming":[{"duration":38.799999952316284,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":231.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":231.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":270.39999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":38.799999952316284,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":231.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":231.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":270.6999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":545.3999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":232.10000002384186,"connectEnd":232.10000002384186,"connectStart":232.10000002384186,"domainLookupEnd":232.10000002384186,"domainLookupStart":232.10000002384186,"fetchStart":232.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":232.10000002384186,"responseEnd":777.5,"responseStart":777.5,"secureConnectionStart":232.10000002384186},{"duration":675.8000000715256,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":233.29999995231628,"connectEnd":233.29999995231628,"connectStart":233.29999995231628,"domainLookupEnd":233.29999995231628,"domainLookupStart":233.29999995231628,"fetchStart":233.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":233.29999995231628,"responseEnd":909.1000000238419,"responseStart":909.1000000238419,"secureConnectionStart":233.29999995231628},{"duration":428.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":233.60000002384186,"connectEnd":233.60000002384186,"connectStart":233.60000002384186,"domainLookupEnd":233.60000002384186,"domainLookupStart":233.60000002384186,"fetchStart":233.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":233.60000002384186,"responseEnd":661.8999999761581,"responseStart":661.8999999761581,"secureConnectionStart":233.60000002384186},{"duration":533.1000000238419,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":233.79999995231628,"connectEnd":233.79999995231628,"connectStart":233.79999995231628,"domainLookupEnd":233.79999995231628,"domainLookupStart":233.79999995231628,"fetchStart":233.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":233.79999995231628,"responseEnd":766.8999999761581,"responseStart":766.8999999761581,"secureConnectionStart":233.79999995231628},{"duration":534,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":234,"connectEnd":234,"connectStart":234,"domainLookupEnd":234,"domainLookupStart":234,"fetchStart":234,"redirectEnd":0,"redirectStart":0,"requestStart":234,"responseEnd":768,"responseStart":768,"secureConnectionStart":234},{"duration":38.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":234.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":273.1999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":533.8999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":234.39999997615814,"connectEnd":234.39999997615814,"connectStart":234.39999997615814,"domainLookupEnd":234.39999997615814,"domainLookupStart":234.39999997615814,"fetchStart":234.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":234.39999997615814,"responseEnd":768.2999999523163,"responseStart":768.2999999523163,"secureConnectionStart":234.39999997615814},{"duration":39.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":234.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":274.1999999284744,"responseStart":0,"secureConnectionStart":0},{"duration":544.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":234.69999992847443,"connectEnd":234.69999992847443,"connectStart":234.69999992847443,"domainLookupEnd":234.69999992847443,"domainLookupStart":234.69999992847443,"fetchStart":234.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":234.69999992847443,"responseEnd":779.3999999761581,"responseStart":779.3999999761581,"secureConnectionStart":234.69999992847443},{"duration":671.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":241.39999997615814,"connectEnd":241.39999997615814,"connectStart":241.39999997615814,"domainLookupEnd":241.39999997615814,"domainLookupStart":241.39999997615814,"fetchStart":241.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":241.39999997615814,"responseEnd":913.1999999284744,"responseStart":913.1999999284744,"secureConnectionStart":241.39999997615814},{"duration":672.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":241.5,"connectEnd":241.5,"connectStart":241.5,"domainLookupEnd":241.5,"domainLookupStart":241.5,"fetchStart":241.5,"redirectEnd":0,"redirectStart":0,"requestStart":241.5,"responseEnd":913.6999999284744,"responseStart":913.6999999284744,"secureConnectionStart":241.5},{"duration":246.20000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":947.3999999761581,"connectEnd":947.3999999761581,"connectStart":947.3999999761581,"domainLookupEnd":947.3999999761581,"domainLookupStart":947.3999999761581,"fetchStart":947.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":947.3999999761581,"responseEnd":1193.6000000238419,"responseStart":1193.6000000238419,"secureConnectionStart":947.3999999761581}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":46,"responseStart":223,"responseEnd":240,"domLoading":226,"domInteractive":1435,"domContentLoadedEventStart":1435,"domContentLoadedEventEnd":1501,"domComplete":1855,"loadEventStart":1855,"loadEventEnd":1856,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1410.3999999761581},{"name":"bigPipe.sidebar-id.end","time":1411.1999999284744},{"name":"bigPipe.activity-panel-pipe-id.start","time":1411.2999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":1412.7999999523163},{"name":"activityTabFullyLoaded","time":1518}],"measures":[],"correlationId":"fe05f10f57d69a","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Oleksandr,
https://screenshots.lucasrolff.com/2016_02_07_k4k0gl3pojf0h70.png
As you can see - according to the graph I'm doing 994.67 queries per second - what I actually do on the server is 557 queries per second.
Here's a screenshot from when we switched to MariaDB - our queries didn't increase, but since MariaDB increments Com_select when it shouldn't it results in graphs that are wrong:
https://screenshots.lucasrolff.com/2016_02_07_2vxrdrebh9zi198.png