Am Sa., 17. Juni 2023 um 23:49 Uhr schrieb Andy Smith <a...@strugglers.net>:
>
> Hi,
>
> I'm using v0.31.4 on Debian 11. I have ~3.9 million messages in my
> archive and the notmuch database currently takes up 85GiB (though
> actually "only" 51GiB due to btrfs zstd:1 compression).

Wow ;)

> I did remove a few hundred thousand messages from my archive but the
> space used by the database did not go down at all.
>
> If I ran "notmuch compact" should I expect any space to be
> reclaimed?
>
> The manual page says that this builds a new copy of the database and
> then switches them over. Does that imply that I will need nearly the
> same amount of space again to perform the compact, until it finishes
> and the old database is discarded?

Yes.

> The manual page says that the new database is built "in a temporary
> directory". Where is that directory exactly? Is it inside the
> current notmuch database directory or is it in $TMPDIR? I ask

Your notmuch db has a xpian subdir, by default named `xapian`. The
compact is done in a new dir `xapian.compact` which is a sibling dir
to `xapian`.

> because it looks like I'll need to make sure that there about 50GiB
> of space available wherever that is.
>
> I'm aware that this procedure is going to take a really really long
> time. If my machine should crash, or the notmuch process runs out of
> memory or something, will my database be left in a functional state?

You can tell `notmuch compact` to move the existing db to a backup dir
(on the same file system) after a successful compaction.

So, if you don't want to take the risk of `notmuch compact` wrongly
considering the process to be successful, just specify a backup dir.
Either the compaction fails, in which case the original db is
untouched. (In case of a hard crash a file lock might be stale, but
that should be it.) Or it succeeds and the old db is in the backup
dir.

Disclaimer: Back up manually to a different fs before ... or just take
a btrfs snapshot.

> If I have to reindex it, that is going to take even longer, so I
> have to think about how much I want what is probably a very marginal
> amount of space back!

On my comparatively small db, gains are typically substantial
(postlist, position), even though I compact from time to time.

Expect 4 tables to be compactified (if you want to start a trial run, say).

Cheers
Michael
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to