Mysql method to set the table type: Directly execute the [alter table data table name type = MsISAM] statement to set the table type. MyISAM data tables can be compressed and support full-text search.
Modify the sql statement of the mysql table type:
(Recommended tutorial: mysql video tutorial)
alter table 表名 type = MyISAM; alter table 表名 type = InnoDB;
MyISAM: This is the default type, which is based on the traditional ISAM type. ISAM is the abbreviation of Indexed Sequential Access Method (indexed sequential access method), which is the standard method for storing records and files. Compared to other storage engines, MyISAM has most of the tools to check and repair tables.
MyISAM tables can be compressed, and they support full-text search. They are not transaction safe and do not support foreign keys. If things are rolled back, it will cause an incomplete rollback and is not atomic. If you perform a large number of SELECTs, MyISAM is a better choice.
InnoDB: This type is transaction safe. It has the same characteristics as BDB types, they also support foreign keys. InnoDB tables are fast and have richer features than BDB, so it is recommended to use it if you need a transaction-safe storage engine. If your data performs a lot of INSERT or UPDATE, you should use an InnoDB table for performance reasons.
For InnoDB type labels that support things, the main reason that affects the speed is AUTOCOMMI. The default setting is on, and the program does not explicitly call BEGIN to start the transaction, resulting in automatic Commit for each inserted item, which seriously affects speed. You can call begin before executing the SQL. Multiple SQLs form one transaction (even if autocommit is turned on), which will greatly improve performance.
Related recommendations: mysql tutorial
The above is the detailed content of How to set table type in mysql. For more information, please follow other related articles on the PHP Chinese website!