简体   繁体   English

mysql表TRUNCATE后是否需要OPTIMIZE/ANALYZE?

[英]Is OPTIMIZE / ANALYZE required after mysql table TRUNCATE?

In mysql database, I have about 20 tables (data size is very small - most of the tables have about 1,000 to 20,000 records, only one table has 200,000 records).在 mysql 数据库中,我有大约 20 个表(数据量非常小 - 大多数表有大约 1,000 到 20,000 条记录,只有一个表有 200,000 条记录)。 These tables are being truncated and reloaded fully every day.这些表每天都被截断并重新加载。

Does truncate data every day cause database pages fragmentation?每天截断数据会导致数据库页面碎片化吗?

Should i run analyze and optimize table on them?我应该对它们运行分析和优化表吗? if so then how often?如果是,那么多久一次?

Please advise!请指教!

Thank you!谢谢!

When a table is deleted or truncated, InnoDB will leave the empty space, and use it for subsequent insertion of new row versions.当表被删除或截断时,InnoDB 将留下空白空间,并将其用于后续插入新行版本。

Truncating table does not make the mysql file smaller 截断表不会使 mysql 文件变小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM