Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql deletes unused table data

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are several situations where MySQL deletes data and whether disk space is freed:

1. Drop table table_name immediately frees up disk space, whether it's Innodb or MyISAM.

2. Truncate table table_name immediately frees up disk space, whether it's Innodb or MyISAM. Truncate table is actually a bit like drop table and then creat, except that the create table process is optimized, such as table structure files, and so on. So the speed should be close to the speed of drop table.

3. Delete from table_name deletes all data from the table. For MyISAM, disk space will be released immediately (it should be treated specially and reasonably), while InnoDB will not free disk space.

4. For conditional deletion of delete from table_name where xxx, neither innodb nor MyISAM will free disk space.

5. Using optimize table table_name after delete operation will release disk space immediately. Whether it's innodb or myisam. So to achieve the goal of freeing up disk space, delete performs optimize table operations later.

6. Although the delete from table does not release disk space in the future, it can still be used the next time the data is inserted.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report