Storage layout optimization of 8.5.1 optimizing Storage Layout for InnoDB tables

Source: Internet
Author: User

Storage layout optimization of 8.5.1 optimizing Storage Layout for InnoDB tables

Once your data reaches a steady size, or a growing table a few Baisi trillion increases,

Consider using the Optimize table statement to rearrange the tables to compress any wasted space.

The reorganization table requires less disk I/O to perform a full table scan.

This is a clear technique that can improve performance when other technologies such as improving index usage or tuning application code are impractical.

Optimizing table Copy table data and rebuilding indexes, the benefit is to improve the data inside the index, reduce the fragmentation in the table space.

The benefits depend on the data for each table. You may find that there are some notable gains, or that the benefits decrease over time to know your next tuning table.

This operation may be slow if the table is large or if the index is rebuilt without putting the buffer pool.

Running smoothly for the first time after adding a lot of data is slower than running later

In InnoDB, there is a long primary KEY (whether it's a column with a long value, or a few columns that form a long, consistent value) that wastes a lot of disk space.

The primary key value of a record is copied to all the 2nd index records, pointing to the same row.

Create a auto_increment column as the primary key if your primary key is long.

Use the varchar data type instead of char to store a variable length string or for columns that have many null values.

A char (n) column always occupies N strings to store data, although the string is short or its value is null.

Small tables fit in the buffer pool and reduce disk I/O.

When used in compact record format (innodb format), variable-length character sets such as UTF8 or Sjis, CHAR (n) columns occupy space, but still at least N bytes.

Consider using the compressed record format for large tables, or for large amounts of duplicate files or digital data.

Less disk I/O is needed to put data into the buffer pool, or to perform a full table scan.

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.