TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: SQL engine reclaiming space from DELETEs

12 pointsby twa927about 6 years ago
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 comments

toomuchtodoabout 6 years ago
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.
void141starabout 6 years ago
<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 未加载
docuruabout 6 years ago
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 未加载
zzo38computerabout 6 years ago
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)
natmakaabout 6 years ago
<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>
sansnommeabout 6 years ago
Vacuum?