stored procedures - How long will a temporary MEMORY table persist if I don't drop it (MySQL) -


i'm using recursive stored procedure in mysql generate temporary table called id_list, must use results of procedure in follow select query, can't drop temporary table within procedure...

begin;  /* generates temporary table of id's */ call fetch_inheritance_groups('abc123',0);  /* uses results of sproc in */ select a.user_id usr_relationships r  inner join usr_accts on a.user_id = r.user_id  r.group_id = 'abc123' or r.group_id in (select * id_list)  group r.user_id;  commit; 

when calling procedure, first value top id of branch want, , second tier procedure uses during recursions. prior recursive loop checks if tier = 0 , if runs:

drop temporary table if exists id_list; create temporary table if not exists id_list (iid char(32) not null) engine=memory; 

so question is: if don't drop temporary memory table @ end of procedure, or within transaction, how long table persist in memory? automatically dropped once session ends, or remain in memory long connection open?

**n.b. obvious answer might drop temp table prior commit statement, lets assume moment can't that.*


a more detailed answer question can found here: https://dba.stackexchange.com/questions/57971/how-long-will-a-temporary-memory-table-persist-if-i-dont-drop-it-mysql i've voted close question.

per manual, temporary table dropped automatically when connection closed (emphasis mine):

temporary tables

you can use temporary keyword when creating table. temporary table visible current connection, , is dropped automatically when connection closed.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -