Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7216

COM_Select goes up together with Qcache_hits

    XMLWordPrintable

Details

    • 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

          Activity

            People

              sanja Oleksandr Byelkin
              hholzgra Hartmut Holzgraefe
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.