Home > Database > Mysql Tutorial > body text

How to set table type in mysql

王林
Release: 2020-10-19 10:58:31
Original
2234 people have browsed it

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.

How to set table type in mysql

Modify the sql statement of the mysql table type:

(Recommended tutorial: mysql video tutorial)

alter table 表名 type = MyISAM;
alter table 表名 type = InnoDB;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!