Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the recommendations for the OPTIMIZE TABLE operation of MySQL

Shulou Source: shulou.com Published: 2022-05-31 13:58:48 10月27日 Update

This article mainly explains "what are the suggestions for the OPTIMIZE TABLE operation of MySQL". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the suggestions for MySQL's OPTIMIZE TABLE operation.

1.MySQL officials recommend that defragmentation should not be done frequently (hourly or daily). According to the actual situation, it only needs to be sorted out once a week or once a month, and can be written as a scheduled task.

2.OPTIMIZE TABLE only works on MyISAM,BDB and InnoDB tables, especially on MyISAM tables. In addition, not all tables need to be defragmented, and generally only tables that contain the above variable-length text data types need to be defragmented.

3. While OPTIMIZE TABLE is running, MySQL locks the table.

4. By default, using OPTIMIZE TABLE directly on the data table of the InnoDB engine may display a prompt for "Table does not support optimize, doing recreate + analyze instead". At this time, we can

Restart MySQL with the mysqld-- skip-new or mysqld-- safe-mode command so that other engines can support OPTIMIZE TABLE.

At this point, I believe you have a deeper understanding of "what are the suggestions for the OPTIMIZE TABLE operation of MySQL?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Suggestion function content actual engine situation data fragment learning practical obvious deeper task information interest command official practical hour easy to operate Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux MariaDB Redmi OPPO Reno