compacting the notmuch database through systemd

Subject: compacting the notmuch database through systemd

Date: Sun, 01 Dec 2019 15:52:19 -0500



From: Antoine Beaupré


Thanks to Bremner, I just realized that notmuch-compact(1) is a thing,
and that thing allows me to compress my notmuch databases by about 50%.

So I whipped together two systemd units (attached) that will run that
command every month on my notmuch database. Just drop them in
`~/.config/systemd/user/` and run:

    systemctl --user daemon-reload
    systemctl --user enable notmuch-compact.timer
    systemctl --user start notmuch-compact.timer

... and you're done.

Maybe those could be shipped with the Debian package somehow? Not sure
how that works, but I think that's how gpg-agent gets started now, if
you want any inspiration...

It would be great if notmuch-new ran this on its own, when it
thought that this was "important", somehow like git-gc sometimes runs on
its own.

Of course, I suspect the 50% saving will not happen every month, but
hopefully this will keep my database size from exploding in the

Finally, Bremner said that "it could make some operations slower to
compact the database, but I haven't notced that effect". That is strange
because the manpage says that compact "can both reduce the space
required by the database and improve lookup performance". ;) Hopefully,
the documentation is true and the rumors are false and the sky is not
falling and I want my mommy.


PS: any humor or comedy in this email is purely accidental and shouldn't
be construed as a feeble attempt at making you smile.

I prefer the tumult of liberty to the quiet of servitude.
                        - Thomas Jefferson
signature.asc (application/pgp-signature)
notmuch mailing list