Research on storage characteristics of InnoDB and MyISAM data

Source: Internet
Author: User
Tags mysql version mysql database advantage

InnoDB and MyISAM are two of MySQL's most important data storage engines, both of which can be used to store tables and indexes, InnoDB indexes and tables are stored in the same file, MyISAM indexes and tables are stored in different files, but even multiple indexes coexist in one file.

Many comparisons on the network are based on both transactional processing and locking mechanisms, and so on, it seems that InnoDB has no disadvantages than MyISAM. But the study found that MyISAM has a prominent advantage in data, especially in index storage, and is discussed below.

1. The study concluded

1) InnoDB occupies more disk space than MyISAM, MyISAM storage data can save space 12%, storage index can save 95%;

2 InnoDB the use of free storage space is not excellent.

The study found that MyISAM can save a lot of disk space, especially on the storage of the index, the advantage is huge, this to the large MySQL database data table and index physical design, has a great guiding significance.

2. Subjects of study and data obtained

MySQL version: 5.1.26-rc-community

The study object was created by a table, Mytable3, initially innodb type. There are 540,000 rows of data that are not duplicated (produced with a random function) and two indexes. A total of two experiments were conducted and the data obtained were as follows.

Table Occupancy _MB Index occupancy _MB InnoDB file Occupancy _MB MyISAM file Occupancy _MB
Initial type InnoDB 256 240 914 0
Type changed to MyISAM 222 8 914 230
Type change back to InnoDB 256 240 1034 0

It can be seen from the experimental data that after the table type Alter is MYISAM, the disk space is only 8MB, which is 4% of InnoDB. And as the table type changes back to the Innodb,innodb table space is forced to expand 120MB to 1034MB to support the fetch of the table data.

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.