MySQL temporary vs memory table in stored procedures

前端 未结 5 1839
难免孤独
难免孤独 2021-02-14 21:05

What\'s is better to use in a stored procedure: a temporary table or a memory table?

The table is used to stored summary data for reports.

Are there any trade o

5条回答
  •  死守一世寂寞
    2021-02-14 21:58

    In MySQL, temporary tables are seriously crippled:

    http://dev.mysql.com/doc/refman/5.6/en/temporary-table-problems.html

    You cannot refer to a TEMPORARY table more than once in the same query.
    For example, the following does not work:
    
    mysql> SELECT * FROM temp_table, temp_table AS t2;
    ERROR 1137: Can't reopen table: 'temp_table'
    

提交回复
热议问题