Memory storage engine is easy to know by its name. It is a storage engine that stores data in memory. The Memory storage engine does not store any data on the disk, but only stores a .frm file with table structure-related information on the disk. So once MySQL crashes or the host crashes, the Memory table will only have one structure left. Memory tables support indexes, and support indexes in both Hash and B-Tree formats. Because it is stored in memory, Memory stores data in a fixed-length space, and does not support BLOB and TEXT type fields. The Memory storage engine implements page-level locking.
Since all data is stored in memory, its consumption of memory can be imagined. There is such a formula in the MySQL user manual to calculate the actual memory size consumed by the Memory table:
SUM_OVER_ALL_BTREE_KEYS(max_length_of_key + sizeof(char*) * 4)
+ SUM_OVER_ALL_HASH_KEYS(sizeof(char*) * 2)
+ ALIGN(length_of_row+1, sizeof(char*))
The above is the introduction of the Memory storage engine of Mysql storage engine. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!