How to clean up Alibaba Cloud MySQL space

How to clean up Alibaba Cloud MySQL space

Today I received a disk warning notification from Alibaba Cloud. I checked and found that 80G of the 100G space had been used. If I decide to delete the data before January 1, 2018, I will find that the available disk space has not decreased after deletion, but has increased rapidly. This made me very anxious, and the database was locked soon.

I quickly searched Baidu and found out that after deleting, the disk would not be reduced, and I had to execute OPTIMIZE TABLE +表名. Later, I found a savior, but the command failed. It turned out that there was insufficient space. The database was locked and this command could not be executed. I was at a loss and decided to pause the server first. Just when it was paused, a miracle happened. There was more than 5G of available space, so I could execute OPTIMIZE TABLE to optimize the table. However, after 3 minutes of execution, the command returned an error. I saw that there was insufficient space again and the table was locked again.

The final decision was to export a table and transfer it to a sql file. It took 40 minutes to complete the export. Then I deleted the table. The server suddenly had 50G more available space. So I ran the sql file again to restore the data, which took a full 150 minutes. After the execution, 70G of disk space was used. Then OPTIMIZE TABLE +表名was executed. Because one of the tables was too large, it took nearly 40 minutes to execute. During this period, the disk usage rate once soared to 100%, but fortunately it just passed.

After deleting data, the MySQL space will not be reduced. You need to execute OPTIMIZE TABLE . OPTIMIZE TABLE will generate a large number of temporary files. If the original table is large, it will take up a lot of space. Therefore, when executing this command, make sure there is enough disk space. Otherwise, executing other operations may cause insufficient disk space, lock the database, and cause execution failure.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • Several specific methods of Mysql space cleaning

<<:  Navicat cannot create function solution sharing

>>:  Native JS to implement click number game

Recommend

JS implements sliding up and down on the mobile terminal one screen at a time

This article shares with you the specific code of...

Teach you a trick to achieve text comparison in Linux

Preface In the process of writing code, we will i...

Detailed explanation of TypeScript's basic types

Table of contents Boolean Type Number Types Strin...

Share the 15 best HTML/CSS design and development frameworks

Professional web design is complex and time-consu...

MySQL 8.0.13 download and installation tutorial with pictures and text

MySQL is the most commonly used database. You mus...

Installation of Docker CE on Ubuntu

This article is used to record the installation o...

Understanding JSON (JavaScript Object Notation) in one article

Table of contents JSON appears Json structure Jso...

Detailed steps to install Sogou input method on Ubuntu 20.04

1. Install Fcitx input framework Related dependen...

Use Vue3 for data binding and display list data

Table of contents 1. Comparison with Vue2 1. New ...

Summary of 10 common HBase operation and maintenance tools

Abstract: HBase comes with many operation and mai...

In-depth explanation of Set and WeakSet collections in ES6

Table of contents Set is a special collection who...

Vue+ElementUI implements paging function-mysql data

Table of contents 1. Problem 2. Solution 2.1 Pagi...