In other words, the usage of ibtmp 1 has changed in 8.0 and 5.7. The data of version 5.7 temporary table is stored in ibtmp 1, and the data of version 8.0 temporary table is stored in session temporary table space. If the temporary table changes, the changed undo data will be stored in ibtmp 1.
Experimental verification: Save the previous query result as a temporary table, and the corresponding session number is 45. By looking at the corresponding dictionary table, we can see that the table space temp_8.ibt is used in session number 45. By saving the query as a temporary table, the session temporary table space can be used, as shown below:
Next, in kill session 45, it is found that the temp_8.ibt space has been released, and it has become the initial size and the state is inactive, which proves that the temporary tablespace can be released in mysql8.0 through kill session.
Summary: In mysql5.7, when the session is killed, the temporary table will be released, but the space will not be released back to the operating system just by marking it in the ibtmp file. If you want to free up space, you need to restart the database; In mysql8.0, temporary tablespaces can be released by terminating the session.