in reply to db_del of BerkeleyDB

The generic approach to make a database file smaller is to rewrite the file by copying all rows into a new file.

Usually, databases don't release free space back to the file system but just mark it as "available for data" internally. It is often much faster to maintain this internal bookkeeping instead of rewriting the file each time a record in the middle of the file gets deleted.