Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
-
None
Description
When stored procedure is cached, the bytes are counted towards global memory, which can be
retrieved with
select variable_value from information_schema.global_status where variable_name='MEMORY_USED'; |
This is wrong, as the caches are per-session (THD::sp_proc_cache etc). Thus populating cache should result in increase of "information_schema.session_status where variable_name='MEMORY_USED'" instead, which is not happening
Commands below create and execute a dummy stored procedure, and measure increase of global and session memory for that operation.
session memory increases by 96 bytes , global memory by some 10K . Session memory increase only happens first time around, i.e if you create another procedure, and execute it, session memory will increase by 0 bytes, but global memory by some 12K. (Those numbers are taken from current debug 10.3 on my box.
mysql> select variable_value into @global_mem_used from information_schema.global_status where variable_name='MEMORY_USED';
|
Query OK, 1 row affected (0.00 sec)
|
|
mysql> select variable_value into @local_mem_used from information_schema.session_status where variable_name='MEMORY_USED';
|
Query OK, 1 row affected (0.00 sec)
|
|
mysql> create procedure sp1() BEGIN END;
|
Query OK, 0 rows affected (0.01 sec)
|
|
mysql> call sp1();
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql> select variable_value-@global_mem_used as global_mem_diff from information_schema.global_status where variable_name='MEMORY_USED';
|
+-----------------+
|
| global_mem_diff |
|
+-----------------+
|
| 10888 |
|
+-----------------+
|
1 row in set (0.00 sec)
|
|
mysql> select variable_value-@local_mem_used as local_mem_diff from information_schema.session_status where variable_name='MEMORY_USED';
|
+----------------+
|
| local_mem_diff |
|
+----------------+
|
| 96 |
|
+----------------+
|
1 row in set (0.00 sec)
|
|
Attachments
Issue Links
- relates to
-
MDEV-26754 main.sp test fails for embedded server
- Open