I'm using 5.6 MySQL database to insert tens of millions records between multiple tables.
Before the insertion I send all my data into a temp memory table, for that reason I have increased both tmp_table_size
and max_heap_table_size
to 15GB.
It works well so far, but after I explicitly drop the temp table and after my connection is closed MySQL keeps using the memory allocated for the temp table and the only way I'm able to free that memory is to restart the service.
My application runs every few hours and I eventually run out of memory after 2-3 runs. Is there another way to fix this without restarting the service?