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

INDEX_STATISTICS shows only one index for query with index merge intersect

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.4, 11.5(EOL)
    • 11.4
    • Plugin - userstat
    • None

    Description

      Note: Probably earlier versions are also affected, but the query plan in the test case only uses index merge intersect for 11.0+, so what's the version it is filed for.

      SET @userstat.save= @@userstat;
       
      CREATE TABLE t (a INT, b INT, KEY(a), KEY(b)) ENGINE=MyISAM;
      INSERT INTO t VALUES (1,10),(2,20),(2,21),(3,30),(4,40),(5,50);
      SET GLOBAL userstat= 1;
      FLUSH INDEX_STATISTICS;
       
      EXPLAIN SELECT * FROM t WHERE a = 2 AND b = 20;
      SELECT * FROM t WHERE a = 2 AND b = 20;
      SHOW INDEX_STATISTICS;
       
      # Cleanup
      DROP TABLE t;
      SET GLOBAL userstat= @userstat.save;
      

      11.0 e3ac7b803357cd0c798933419df99ce3081c0d81

      EXPLAIN SELECT * FROM t WHERE a = 2 AND b = 20;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	SIMPLE	t	index_merge	a,b	b,a	5,5	NULL	1	Using intersect(b,a); Using where; Using index
      SELECT * FROM t WHERE a = 2 AND b = 20;
      a	b
      2	20
      SHOW INDEX_STATISTICS;
      Table_schema	Table_name	Index_name	Rows_read
      test	t	b	1
      DROP TABLE t;
      

      Attachments

        Activity

          People

            monty Michael Widenius
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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