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

Changes to use_stat_tables only takes effect on new connections

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.11.11
    • N/A
    • Documentation
    • None
    • RHEL9, x86_64

    Description

      test> show global variables like 'use_stat_tables';
      +-----------------+------------------------+
      | Variable_name   | Value                  |
      +-----------------+------------------------+
      | use_stat_tables | PREFERABLY_FOR_QUERIES |
      +-----------------+------------------------+
      1 row in set (0.001 sec)
       
      test> set global use_stat_tables=PREFERABLY;
      Query OK, 0 rows affected (0.000 sec)
       
      test> analyze table temp;
      +-----------+---------+----------+----------+
      | Table     | Op      | Msg_type | Msg_text |
      +-----------+---------+----------+----------+
      | test.temp | analyze | status   | OK       |
      +-----------+---------+----------+----------+
      1 row in set (0.001 sec)
       
      test> ^DBye
       
      $ sudo mysql test
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A
       
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 185804
      Server version: 10.6.20-MariaDB-log MariaDB Server
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      test> analyze table temp;
      +-----------+---------+----------+-----------------------------------------+
      | Table     | Op      | Msg_type | Msg_text                                |
      +-----------+---------+----------+-----------------------------------------+
      | test.temp | analyze | status   | Engine-independent statistics collected |
      | test.temp | analyze | status   | OK                                      |
      +-----------+---------+----------+-----------------------------------------+
      2 rows in set (0.002 sec)
       
      test> set global use_stat_tables=PREFERABLY_FOR_QUERIES;                   
      Query OK, 0 rows affected (0.000 sec)
       
      test> analyze table temp;
      +-----------+---------+----------+-----------------------------------------+
      | Table     | Op      | Msg_type | Msg_text                                |
      +-----------+---------+----------+-----------------------------------------+
      | test.temp | analyze | status   | Engine-independent statistics collected |
      | test.temp | analyze | status   | OK                                      |
      +-----------+---------+----------+-----------------------------------------+
      2 rows in set (0.002 sec)
       
      test> ^DBye 
       
      $ sudo mysql test
      Reading table information for completion of table and column names         
      You can turn off this feature to get a quicker startup with -A
       
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 185809
      Server version: 10.6.20-MariaDB-log MariaDB Server
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      test> analyze table temp;
      +-----------+---------+----------+----------+
      | Table     | Op      | Msg_type | Msg_text |
      +-----------+---------+----------+----------+
      | test.temp | analyze | status   | OK       |
      +-----------+---------+----------+----------+
      1 row in set (0.001 sec)
      

      Attachments

        Activity

          use_stat_tables variable has both the session and global scope.
          As usual in such cases, changing the global value does not affect existing connections.
          You can read about the effect of SET depending on the variable scope for example here https://dev.mysql.com/doc/refman/8.4/en/set-variable.html.

          I will keep this ticket open for documentation purposes, as the KB article on the subject definitely needs revising.

          elenst Elena Stepanova added a comment - use_stat_tables variable has both the session and global scope. As usual in such cases, changing the global value does not affect existing connections. You can read about the effect of SET depending on the variable scope for example here https://dev.mysql.com/doc/refman/8.4/en/set-variable.html . I will keep this ticket open for documentation purposes, as the KB article on the subject definitely needs revising.

          People

            greenman Ian Gilfillan
            clayne Christopher Layne
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.