Ask HN: SQL engine reclaiming space from DELETEs
Both PostgreSQL and MySQL are poor in that regard, especially PostgreSQL: after many DELETEs/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/DROPping the whole table which requires downtime.
I'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/O.
I see that MariaDB comes with multiple engines, maybe some of them could work like that?
I know that Amazon's Aurora is even worse than raw MySQL/PostgreSQL.
18 comments
[ 3.2 ms ] story [ 53.0 ms ] threadOn another topic, do you require using a SQL database for your queue?
In theory, yes. In practice, I've seen a lot of bloat being preserved despite using aggressive autovacuum settings. I'm guessing this is due to fragmentation?
> On another topic, do you require using a SQL database for your queue?
I'd need some way to browse the queue and select items for processing using arbitrary queries.
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.
So it is not a way to design a database engine
There is also MyRocks based on RocksDB fork of LevelDB, but LevelDB is piece of garbage, not sure about how much RocksDB fork fixes it though.
[1] https://www.percona.com/doc/percona-server/5.6/tokudb/tokudb...
Where did you read/hear it?
https://www.percona.com/doc/percona-server/5.6/release-notes...
List of which TokuDB version is integrated in which MariaDB version:
https://mariadb.com/kb/en/meta/tokudb-versions/
Still please don't expect big shrinks with TokuDB when having big variance of active data as it's not its first priority (first prio is to be fast and/or use little space).
So, it's definitely a good way to design a databases storage engine. But there isn't one open source as far as I know. There are some better than default choices though.
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.