The difference between InnoDB and MyISAM engine and the application scenario

Source: Internet
Author: User

Transferred from: https://www.cnblogs.com/changna1314/p/6878900.html

1. Difference:

(1) Transaction processing:

MyISAM is a non-transactional security type, while InnoDB is transaction-safe (supports advanced processing such as transaction processing);

(2) Different locking mechanisms:

MyISAM is a table-level lock, while InnoDB is a row-level lock;

(3) Select, UPDATE, INSERT, delete operation:

MyISAM: If performing a large number of select,myisam is a better choice InnoDB: If your data performs a large number of inserts or update, for performance reasons, you should use the InnoDB table

(4) The number of rows in the query table is different:

Myisam:select Count (*) from Table,myisam as long as the number of rows saved is simply read, note that when the COUNT (*) statement containswhere condition, the operation of the two tables is the sameThe exact number of rows in a table is not saved in Innodb:innodb, that is, when you execute select COUNT (*) from table, InnoDB scans the entire table to calculate how many rows (5) Foreign key support: Mysiam table does not support foreign keys, and InnoDB supports

2. Why MyISAM is faster than InnoDB's query.

InnoDB when doing select, to maintain more than the MyISAM engine much more;
1) data block, InnoDB to cache, MyISAM only cache the index block, which also has the reduction of swap-out;
2) InnoDB addressing to map to the block, and then to the line, MYISAM record is directly the offset of the file, positioning is faster than InnoDB
3) InnoDB also need to maintain MVCC consistent; Although your scene is not, he still needs to check and maintain MVCC (multi-version Concurrency control) Multiple version concurrency control 3. Application Scenarios

MyISAM Suitable for: (1) do a lot of count calculation, (2) Insert infrequently, query very frequently; (3) No transaction.

InnoDB Suitable for: (1) High reliability requirements, or request transactions, (2) Table updates and queries are quite frequent, and the opportunity to lock the row is relatively large situation.

The difference between InnoDB and MyISAM engine and the application scenario

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.