Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
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?