Efficient Recovery of standalone tablespaces in MySQL InnoDB

Source: Internet
Author: User

For innodb independent tablespaces, delete cannot recycle the space occupied by the disk. You can use truncate (the principle is to delete or recreate it first;

Directly alter table .... engine = innodb can be used to sort shards and reclaim some tablespaces. When the data volume is small or the buffer pool is small (less than 30 GB), it is quite good;

When there are many shards or a large buffer pool, we need to face risks-when executing DDL statements on the Innodb Storage engine, the entire system will be hang for a short time, the length of hang is related to the Buffer Pool size. The main reason is that when InnoDB drops the table, it will traverse the buf pool LRU linked list two times in a row and lock the traversal process, resulting in the hang of the system. The LRU linked list will be regularly released by the buf pool mutex for the first time, so the impact on the system hang is small. The second time will be held, which has a greater impact on the system hang. -

-- For relevant articles, refer:

MySQL performance of deleting large tables

Explanation of Innodb buffer

Here I will introduce a safe and efficient method for fragment. pt-online-schema-change

Percona is used for non-blocking online ddl, but only alter table... statement to recycle the tablespace, you can use the principle of this tool: create a temporary table, use a trigger to ensure the data consistency with the original table, and finally replace renmame; if you have used this tool, you may have questions. During the final operation of "online ddl", drop old table; drop trigger; however, you can use -- no-drop-old-table to prevent the old table from being deleted. When there is other time, you can use scripts to delete records in batches, finally, drop the remaining "small table"; this avoids hang from living in the system;

I personally tested the table version 2.2.1 and 60 GB, and collected it to 21 GB in about 2 hours;

Recommended reading:

Startup, shutdown, and restoration of the InnoDB Storage Engine

MySQL InnoDB independent tablespace Configuration

Architecture of MySQL Server layer and InnoDB Engine Layer

InnoDB deadlock Case Analysis

MySQL Innodb independent tablespace Configuration

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.