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

ANALYZE TABLE prints EITS statistics collected while it has not done it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3, 10.4, 10.5, 10.6
    • Fix Version/s: 10.3, 10.4, 10.5, 10.6
    • Component/s: Optimizer
    • Labels:
      None

      Description

      ANALYZE TABLE code ignores any (or some?) errors it gets from updating stats tables.

      As a result, One may get Engine-independent statistics collected message, while statistics has not been updated.

      Example: a read-only setting prevents a non-root user from updating the stats, while the message is printed that stats were updated: (a question whether one should be allowed to update EITS stats when read_only=1 is a separate question):

      create user test@localhost;
      grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
       
      create table t1 (a int);
      insert into t1 values (1),(2),(3);
      set global read_only=1;
      # This will produce nothing
      select * from mysql.column_stats;
      select * from mysql.table_stats;
       
      connect (con1,localhost,test,,test);
      connection con1;
      # This will show "Engine-independent statistics collected"
      analyze table t1 persistent for all;
       
      # But we can see that EITS stats were NOT collected:
      select * from mysql.column_stats;
      select * from mysql.table_stats;
       
      disconnect con1;
      connection default;
      set global read_only=0;
      drop table t1;
      

      prints on current 10.6:

      create user test@localhost;
      grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
      create table t1 (a int);
      insert into t1 values (1),(2),(3);
      set global read_only=1;
      select * from mysql.column_stats;
      db_name table_name      column_name     min_value       max_value       nulls_ratio     avg_length      avg_frequency   hist_size       hist_type       histogram
      select * from mysql.table_stats;
      db_name table_name      cardinality
      connect  con1,localhost,test,,test;
      connection con1;
      analyze table t1 persistent for all;
      Table   Op      Msg_type        Msg_text
      test.t1 analyze status  Engine-independent statistics collected
      test.t1 analyze status  OK
      select * from mysql.column_stats;
      db_name table_name      column_name     min_value       max_value       nulls_ratio     avg_length      avg_frequency   hist_size       hist_type       histogram
      select * from mysql.table_stats;
      db_name table_name      cardinality
      disconnect con1;
      connection default;
      set global read_only=0;
      drop table t1;
      

        Attachments

          Activity

            People

            Assignee:
            psergei Sergei Petrunia
            Reporter:
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration