Further discussion: Mysql database MyISAM and InnoDB storage engine comparison _mysql

Source: Internet
Author: User
Tags table definition

MySQL has a variety of storage engines, and MyISAM and InnoDB are two common types. Here are some basic concepts about the two engines (not an in-depth introduction).
MyISAM is the default storage engine for MySQL, which supports Full-text search based on the traditional ISAM type, but is not transaction-safe and does not support foreign keys. Each MyISAM table is stored in three files: the frm file holds the table definition, the data file is MyD (MYData), and the index file is myi (Myindex).
InnoDB is a transactional engine that supports rollback, crash recovery, multiple version concurrency control, acid transactions, support row-level locking (innodb table row locks are not absolute, and if MySQL cannot determine the range to scan when executing an SQL statement, the InnoDB table also locks the entire table. such as SQL statements when like operations), and provides no lock read mode consistent with Oracle type. InnoDB stores its tables and indexes in a table space, tablespaces can contain several files.
Main differences:
MyISAM is not a transaction-safe type, and InnoDB is a transaction-safe type.
The granularity of the MyISAM lock is the table level, while the INNODB supports row-level locking.
MyISAM supports full-text type indexing, while InnoDB does not support Full-text indexing.
MyISAM is relatively simple, so the efficiency is better than INNODB, small applications can consider the use of MyISAM.
myisam tables are stored in the form of files, and using MyISAM storage in Cross-platform data transfer saves a lot of hassle.
InnoDB tables are more secure than MyISAM tables, and you can switch non transaction tables to transaction tables (ALTER TABLE tablename TYPE=INNODB) without the data being lost.
Application Scenario:
MyISAM Manage non-transaction tables. It provides high-speed storage and retrieval, as well as full-text search capabilities. If you need to perform a large number of select queries in your application, then MyISAM is a better choice.
InnoDB is used for transactional applications with a number of features, including ACID transaction support. If you need to perform a large number of insert or update operations in your application, you should use InnoDB, which can improve the performance of multiple-user concurrent operations.
Common commands:
(1) View the storage type of the table (three kinds):
Show CREATE TABLE tablename
Show Table status from DBName where Name=tablename
mysqlshow-u user-p password--status dbname tablename
(2) Modify the table's storage engine:
ALTER TABLE TableName TYPE=INNODB
(3) The command line that starts the MySQL database adds the following parameters to make the newly published table use the transaction by default:
--default-table-type=innodb
(4) Temporarily change the default table type:
Set Table_type=innodb
Show variables like ' Table_type '

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.