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

Implement status variable to track open temporary tables

    XMLWordPrintable

    Details

      Description

      The Open_tables status variable does not take temporary tables into account. For example:

      MariaDB [(none)]> SHOW GLOBAL STATUS LIKE 'Open_tables';
      +---------------+-------+
      | Variable_name | Value |
      +---------------+-------+
      | Open_tables   | 14    |
      +---------------+-------+
      1 row in set (0.001 sec)
       
      MariaDB [(none)]> CREATE TEMPORARY TABLE db1.tmp_tab (id int);
      Query OK, 0 rows affected (0.002 sec)
       
      MariaDB [(none)]> SHOW GLOBAL STATUS LIKE 'Open_tables';
      +---------------+-------+
      | Variable_name | Value |
      +---------------+-------+
      | Open_tables   | 14    |
      +---------------+-------+
      1 row in set (0.001 sec)
       
      MariaDB [(none)]> INSERT INTO db1.tmp_tab VALUES (1);
      Query OK, 1 row affected (0.000 sec)
       
      MariaDB [(none)]> SHOW GLOBAL STATUS LIKE 'Open_tables';
      +---------------+-------+
      | Variable_name | Value |
      +---------------+-------+
      | Open_tables   | 14    |
      +---------------+-------+
      1 row in set (0.001 sec)
      

      I think that we should have a status variable that tracks the number of open temporary tables--both globally and for a given session. Maybe it could be called Open_temporary_tables.

      Would it also make sense to create Opened_temporary_tables to keep track of all previously opened temporary tables, similar to Opened_tables? Or does Com_create_temporary_table effectively serve the same purpose?

        Attachments

          Activity

            People

            Assignee:
            ralf.gebhardt@mariadb.com Ralf Gebhardt
            Reporter:
            GeoffMontee Geoff Montee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: