Memory of MySQL storage engine

• Memory storage engine to store all data in memory in order to speed up the visit of some important data
to ask speeds
• use of this storage engine has become smaller, because InnoDB has provided data buffer area to
to cache frequently accessed data In memory
• When MySQL restarts, the data in the Memory table will be lost, but the table structure is still
• Memory is only applicable to read-only tables or the majority of read operations, because write operations on the table
will also cause the table Lock, greatly restricting concurrency
• After the Memory table is created, a file with the same table name will be generated in the disk file, with a suffix of .frm
, which only stores the table structure but not the table data.

[root@mysql-master ~]# mysql -u root -p
mysql> CREATE TABLE test(id int,name varchar(10)) ENGINE=MEMORY;
Query OK, 0 rows affected (0.11 sec)

mysql> insert into test values(1,'a');
Query OK, 1 row affected (0.01 sec)

mysql> insert into test values(2,'b');
Query OK, 1 row affected (0.01 sec)

mysql> select * from temp;
Empty set (0.01 sec)

mysql> select * from test;
+------+------+
| id   | name |
+------+------+
|    1 | a    |
|    2 | b    |
+------+------+
2 rows in set (0.01 sec)

mysql> exit;
Bye
[root@mysql-master ~]# /etc/init.d/mysql.server restart 
Shutting down MySQL.... SUCCESS! 
Starting MySQL.. SUCCESS! 
[root@mysql-master ~]# mysql -u root -p
mysql> use course;
Database changed

mysql> select * from test;
Empty set (0.00 sec)

mysql> desc test;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id    | int(11)     | YES  |     | NULL    |       |
| name  | varchar(10) | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)

 

Guess you like

Origin www.cnblogs.com/dinghailong128/p/12754838.html