# remove orphaned rows in files table
# references in packagefiles, notes, scripts, possibly others
+zpm shell $ZPMDB 'delete from files where hash in (select hash from filerefs where refcount = 0);'
+
# remove old logs, given by date
# remove acked notes
# remove command history by date
# compactify the database file
+osize=$(zpm stat -f '%s' $ZPMDB)
+zpm log -v -i -a 'gc compacting' -t $ZPMDB
+zpm shell $ZPMDB vacuum
+nsize=$(zpm stat -f '%s' $ZPMDB)
+printf 'original size %s\n' $osize
+printf 'new size %s\n' $nsize