mysql transaction processing storage engine

First, what is a transaction
In the world of database systems, a transaction refers to treating multiple database operations as a whole (block). Database systems ensure that operations are either performed correctly or not at all, even in the middle of a transaction in the event of a power outage, computer crash, or other catastrophic event. This way, it will not happen that a sum of money is sent from a bank account, but the other party does not receive the money because of some kind of problem with the system.
The transaction mechanism also allows the programmer to safely and timely abort the execution of a set of commands (and restore the database to the state it was in before the set of commands started). With the transaction mechanism, the problems that programmers need to consider and solve in the software development process will be greatly reduced.
MySQL's support for transactions has a long history, but many people do not understand this fact. Be aware that MySQL can save tables in several formats. The MySQL database system saves data tables in MyISAM format by default, which does not support transactions. But there are several formats that support transactions. The most popular among them is InnoDB format.

Second , the difference between MyISAM and InnoDB storage engines
MyISAM belongs to non-transaction-safe type, while innodb and bdb belong to transaction-safe type. In terms of use, including creating tables, Is there any difference in operations such as insert, select, etc.? However, the MyISAM engine is relatively fast and simple, while InnoDB supports foreign keys, and its speed is relatively slow.
The MyISAM type of table emphasizes performance. It performs several times faster than the InnoDB type, but does not provide transaction support, while InnoDB provides transaction support and advanced database functions such as foreign keys. In this way, different storage types can be used according to the different uses of the data table. In addition, MyISAM type binary data files can be migrated between different operating systems. That is, it can be directly copied from the Windows system to the Linux system for use. So I usually use myisam, because this time I didn't use it very deeply. If this type is converted from MyISAM to InnoDB, there will be no problem, but the full-text index will fail.
Use two options: If your data performs a lot of INSERTs or UPDATEs, you should use InnoDB tables for performance reasons. MyISAM is a better choice if doing a lot of SELECTs. If you need to use transaction processing, but the original data table uses MyISAM, you need to change it to bdb or innodb, so that the program based on MyISAM does not need to be changed after the type is changed to innodb.

Guess you like

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