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

INDEX_STATISTICS.QUERIES is incremented additionally for subqueries

    XMLWordPrintable

Details

    Description

      For a complicated query, INDEX_STATISTICS.QUERIES introduced in MDEV-33152 can be incremented more than once. The query in the test case is somewhat degenerate, it just demonstrates the general idea.

      SET @userstat.save= @@userstat;
      set global userstat= 1;
       
      create or replace table t (a int, key(a)) engine=MyISAM;
      insert into t values (1),(2),(3),(4);
       
      flush index_statistics;
      select a from t where a in ( select a from t );
      show index_statistics;
       
      # Cleanup
      drop table t;
      set global userstat= @userstat.save;
      

      bb-11.5-MDEV-33152-index-statistics 802e89b176efd8ef995cdd456a04ac6452f0e284

      MariaDB [test]> flush index_statistics;
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> select a from t where a in ( select a from t );
      +------+
      | a    |
      +------+
      |    1 |
      |    2 |
      |    3 |
      |    4 |
      +------+
      4 rows in set (0.001 sec)
       
      MariaDB [test]> show index_statistics;
      +--------------+------------+------------+-----------+---------+
      | Table_schema | Table_name | Index_name | Rows_read | Queries |
      +--------------+------------+------------+-----------+---------+
      | test         | t          | a          |         8 |       2 |
      +--------------+------------+------------+-----------+---------+
      1 row in set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.