Is MySQL Temporary table a shared resource?

后端 未结 2 1423
Happy的楠姐
Happy的楠姐 2020-12-28 13:59

I have a MySQL stored procedure that uses a temporary table. Assume that my table name is \'temp\' and I use it to store some middle data. It will create at the beginning of

相关标签:
2条回答
  • 2020-12-28 14:33

    No, a temp table is limited to the scope of your database connection. You can use the temp table in subsequent calls to the procedure during the same database connection, but other connections cannot access it. They can create a table by the same name, but each temp table will be independent. Temp tables go away when you close your connection.

    0 讨论(0)
  • 2020-12-28 14:41

    Temporary table is visible only for current session.

    So if you have several simultaneuous sessions - each one will have its own independent temporary table with the same name.

    Documentation: http://dev.mysql.com/doc/refman/5.1/en/create-table.html, ctrl+f for "You can use the TEMPORARY"

    0 讨论(0)
提交回复
热议问题