TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: SQL engine reclaiming space from DELETEs

12 点作者 twa927大约 6 年前
Both PostgreSQL and MySQL are poor in that regard, especially PostgreSQL: after many DELETEs&#x2F;UPDATEs, the disk space is not released to the OS, and the re-use of the space by the DB engine is often not working well due to the fragmentation. The only option is rebuilding&#x2F;DROPping the whole table which requires downtime.<p>I&#x27;m essentially looking for an SQL engine that would be suitable as a storage for a queue server. I would like it to release the freed disk space to the OS immediately, even if this requires making extra I&#x2F;O.<p>I see that MariaDB comes with multiple engines, maybe some of them could work like that?<p>I know that Amazon&#x27;s Aurora is even worse than raw MySQL&#x2F;PostgreSQL.

6 条评论

toomuchtodo大约 6 年前
Juggle tables to meet your use case. Switch queueing to new table, wrap up work in old table, drop old table.<p>Or switch to RabbitMQ if you can (you mentioned queueing, which Rabbit is designed for), which can journal to disk on a per queue basis if necessary.
void141star大约 6 年前
<a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;11&#x2F;sql-vacuum.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;11&#x2F;sql-vacuum.html</a>
评论 #19593314 未加载
docuru大约 6 年前
When delete or update records, the database engine basically marks the space as available, then the next record will be filled in.<p>Because the file system only allows append or update content on a file. To release the disk space, it will need to completely rewrite the whole data file, which will cause much more things to handle and time.<p>So it is not a way to design a database engine
评论 #19596719 未加载
评论 #19596600 未加载
zzo38computer大约 6 年前
In SQLite you can use the VACUUM command to minimize the disk space needed. (And from another comment, it look like PostgreSQL also has a VACUUM command, but I do not use PostgreSQL and do not know much about that)
natmaka大约 6 年前
<a href="https:&#x2F;&#x2F;www.cybertec-postgresql.com&#x2F;en&#x2F;introducing-pg_squeeze-a-postgresql-extension-to-auto-rebuild-bloated-tables&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.cybertec-postgresql.com&#x2F;en&#x2F;introducing-pg_squeez...</a>
sansnomme大约 6 年前
Vacuum?