Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5.39, 10.0.14
-
None
-
5.5.48-0
Description
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)
|
Attachments
Issue Links
- relates to
-
MDEV-4981 Account for queries handled by query-cache in USER_STATISTICS (and in HOST_STATISTICS)
- Closed