Understanding of mysql storage engine

-- 1. View the storage engines supported by the system

show engines;



 

-- 2. View the storage engine used by the table 

show create table qy_users;  -- show the statement that created the table qy_users: table name

-- Display some information about the table qydb: db name, qy_users: table name

show table status from qydb where name='qy_users'; 

 

-- 3. Modify the table engine method

alter table table_name engine=innodb;

 

4. How to choose MySQL storage engine MyISAM and InnoDB

MySQL has a variety of storage engines, each with its own advantages and disadvantages, you can choose to use: MyISAM, InnoDB, MERGE, MEMORY (HEAP), BDB (BerkeleyDB), EXAMPLE, FEDERATED, ARCHIVE, CSV, BLACKHOLE.
Although the storage engines in MySQL are not only MyISAM and InnoDB, but two are commonly used.
The general difference between the two storage engines is:
1) InnoDB supports transactions, but MyISAM does not, which is very important. Transaction is an advanced processing method. For example, in some column additions, deletions, and changes, as long as an error occurs, it can be rolled back and restored, but MyISAM cannot.
2) MyISAM is suitable for query and insert-based applications, InnoDB is suitable for frequent modification and applications involving high security
3) InnoDB supports foreign keys, MyISAM does not support
4) Since MySQL 5.5.5, InnoDB is the default engine
5) InnoDB Index
of FULLTEXT type is not supported Just count. Note that MyISAM also needs to scan the entire table when the count(*) statement contains the where condition.
7) For self-growing fields, InnoDB must contain an index of only this field, but it can be combined with other fields in the MyISAM table. Index
8) When emptying the entire table, InnoDB deletes line by line, which is very slow. MyISAM will rebuild the table
9) InnoDB supports row locks.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326261881&siteId=291194637