在mysql中删除数据库后回收磁盘空间
我创建了一些非常大的数据库,后来又删除了一些。我注意到我的磁盘空间没有恢复到我预期的程度。例如,我添加的最后一个数据库实际上用完了所有可用空间并中止,因此我删除了该架构。在此之前我有 12.4 GB 可用空间,现在我只有 7.52 GB 可用空间。
这是怎么回事?如何取回我的 ~5 GB?
I've created some very large databases and have since dropped a few. I've noticed my disk space has not recovered as much as I had expected. For instance, the last database I added actually used up all of my free space and aborted, so I dropped that schema. Before this I had 12.4 GB free, now I only have 7.52 GB free.
What's going on here? How do I get my ~5 GB back?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 http://dev.mysql.com/ doc/refman/5.1/en/innodb-data-log-reconfiguration.html:
Innodb 在数据文件本身内创建一个文件系统(“表空间”)。当数据被删除时,它永远不会“收缩”数据文件,因为文件内数据的重组可能代价高昂(不能保证删除的数据是在末尾,甚至是连续的)。通过如上所述重新创建数据库,它使文件与所有数据所需的大小相同,但不会更大。
From http://dev.mysql.com/doc/refman/5.1/en/innodb-data-log-reconfiguration.html:
Innodb creates a filesystem (the "tablespace") within the data files themselves. It never "shrinks" the data files when data is removed, since the reorganization of the data within the file could be costly (there's no guarantee that the data removed was at the end, or even contiguous). By recreating the database as described above, it makes the file as large as necessary for all the data, but no larger.