Common engines for MySQL

Source: Internet
Author: User

In the MySQL database, the most commonly used engines are 2: InnoDB and Myiasm. This article will focus on the two engines, and how to choose the engine, and finally, what are the data structures used by these 2 engines?

First introduce the InnoDB engine.

The InnoDB engine provides support for database acid transactions. It also provides row-level and foreign-key constraints. Its design goal is to deal with large data capacity of the database system. It itself is actually a complete system based on the MySQL backend. When MySQL runs, InnoDB creates buffer pools in memory for buffering data and indexes. However, the engine does not support full-text search. At the same time, startup is slower, and it is not saving the number of rows in the table. When the Select COUNT (*) from table instruction is made, the full table needs to be scanned.

So when you need to use a database transaction, the engine is the first choice. Because of the small size of the lock, the write operation does not lock the full table. Therefore, the use of high-concurrency scenarios will improve efficiency.

Next, say the Myiasm engine. It is the default engine for MySQL, but does not provide support for transactions, row-level locks, and foreign keys. Therefore, when you execute the INSERT INSERT and UPDATE statement, you need to lock the table when you perform a write operation. Therefore, the efficiency will be reduced. Unlike InnoDB, however, the Myiasm engine is the number of rows in the table, so when a select count (*) From table statement is made, you can directly read the saved values without having to scan the entire table.

Therefore, if the table reads much more than the write operation, and does not require the support of the transaction. You can use MYIASM as the database engine first.

We're talking about the choice of the two engines. In fact, it has been mentioned above. Here I have added two points:

1, large-capacity data sets tend to choose InnoDB. Because it supports transaction processing and failure recovery. InnoDB can use the data log for data recovery. The primary key query is also relatively fast in InnoDB.

2, high-volume INSERT statements (here is the INSERT statement) are performed faster in the Myiasm engine, but the UPDATE statement performs faster in InnoDB, especially when the concurrency is large.

Finally, what is the data structure of the indexes used by the two engines? The answer is a B + tree.

For the Myiasm engine, the content stored in the data structure of the B + tree is actually the address value of the actual data. That is, its index is separate from the actual data, but the index is used to point to the actual data. The pattern for this index is called a nonclustered index.

The data structure of the index of the InnoDB engine is also a B + tree, except that the data structures are stored in actual figures, and such indexes are called clustered indexes.

Reference: http://blog.csdn.net/lulei1217/article/details/50954232

Common engines for MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.