MySQL storage engine MyISAM and InnoDB differences

Source: Internet
Author: User

The two most commonly used engines in the Mysql database are Innordb and MyISAM. InnoDB is the default storage engine for MySQL.

The difference between the two:


1. Aspects of transaction processing
MyISAM: The emphasis is on performance, which is faster than the InnoDB type, but does not provide transactional support.
InnoDB: provides transactional support.


2. Foreign key
MyISAM: Foreign keys are not supported,

InnoDB: Supports foreign keys.


3. Lock
MyISAM: Only table-level locks are supported,

InnoDB: Row-level and table-level locks are supported, row-level locks are default, row locks are significantly improves the performance of multiple user concurrency operations. InnoDB is more suitable for more insert and update operations,
MyISAM, however, is suitable for frequently queried situations. In addition, the row lock of the InnoDB table is not absolute, and if MySQL cannot determine the range to scan when executing an SQL statement, the InnoDB table also locks the full table .
For example: Update table set num=1 where name like "%aaa%".


4. Full-Text Indexing
MyISAM: Supports full-text indexing,

InnoDB: Full-text indexing is not supported. InnoDB Support for full-text indexing starts with the mysql5.6 version.


5. Table PRIMARY Key
MyISAM: Allows a table with no primary key to exist.
InnoDB: If no primary key is set, a 6-byte primary key is automatically generated (the user is not visible).


6. The exact number of rows in the table
myisam:select Count (*) from Table,myisam simply read out the number of rows saved. Because MyISAM has a built-in counter, COUNT (*) reads it directly from the counter.
InnoDB: The exact number of rows of the table is not saved, that is, when the select count (*) from table is executed, InnoDB to scan through the entire table to calculate how many rows.

MySQL storage engine MyISAM and InnoDB differences

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.