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

Userstat skips system tables inconsistently

    XMLWordPrintable

Details

    Description

      As a sub-product of MDEV-33152 (Add QUERIES to INDEX_STATISTICS), INDEX_STATISTICS was made to ignore all tables other than those of "USER" category.
      In addition to statistical tables and information_schema/performance_schema, it now ignores tables of "SYSTEM" category.

      However, from the user perspective, the difference between "USER" and "SYSTEM" tables in MariaDB isn't obvious. Most tables in mysql schema are not of "SYSTEM" category, only a small subset of them are. For example, mysql.proc and mysql.help_topics are "SYSTEM" tables, so they are now skipped by INDEX_STATISTICS, while mysql.global_priv and mysql.db are not – even though all of them are Aria tables with indexes, which can be read from or altered by a user, etc.

      Moreover, unlike INDEX_STATISTICS, TABLE_STATISTICS still takes into account all such tables, which makes the resulting statistics even more confusing.

      I suggest to allow CATEGORY_SYSTEM tables remain in INDEX_STATISTICS, they shouldn't normally create huge additional load on statistics collection, but if the user's workflow is such that they are used heavily, the user would probably want to have statistics for them.

      set global userstat=1;
      select count(*) from mysql.proc where db = 'mysql';
      select count(*) from mysql.global_priv where user = 'mysql';
      select * from information_schema.table_statistics;
      select * from information_schema.index_statistics;
      set global userstat=0;
      

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

      select * from information_schema.table_statistics;
      TABLE_SCHEMA	TABLE_NAME	ROWS_READ	ROWS_CHANGED	ROWS_CHANGED_X_INDEXES
      mysql	global_priv	5	0	0
      mysql	proc	2	0	0
      select * from information_schema.index_statistics;
      TABLE_SCHEMA	TABLE_NAME	INDEX_NAME	ROWS_READ	QUERIES
      mysql	global_priv	PRIMARY	5	1
      

      compare to 11.5 main:

      select * from information_schema.table_statistics;
      TABLE_SCHEMA	TABLE_NAME	ROWS_READ	ROWS_CHANGED	ROWS_CHANGED_X_INDEXES
      mysql	global_priv	5	0	0
      mysql	proc	2	0	0
      select * from information_schema.index_statistics;
      TABLE_SCHEMA	TABLE_NAME	INDEX_NAME	ROWS_READ
      mysql	global_priv	PRIMARY	5
      mysql	proc	PRIMARY	2
      

      Attachments

        Issue Links

          Activity

            People

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