[notmuch] Some Xapian tips and thoughts on rebuilding

Kan-Ru Chen kanru at kanru.info
Mon Jan 11 17:46:14 PST 2010

On Sun, 10 Jan 2010 09:43:38 -0800, Carl Worth <cworth at cworth.org> wrote:
> Compacting your database
> ------------------------
> One final tip. I recently started experimenting with a Xapian feature
> for compacting a database. This is available only via a command-line
> program, (named xapian-compact in the 1.0 releases and
> xapian-compact-1.1 in the current Xapian from svn). This functionality
> is not yet available in the Xapian library interface or else I would
> probably make notmuch call it after building the database.
> If you want to experiment with xapian-compact, you'll want to call it
> with a command something like the following:
>      xapian-compact-1.1 --no-renumber ~/mail/.notmuch/xapian ~/mail/.notmuch/xapian-compact
> The --no-renumber argument is essential with a notmuch database, since
> (as of database format version 1), notmuch stores Xapian document IDs
> internally within terms. If you forget this, you'll find that all of
> your searches will return results that are unable to locate any of the
> filenames corresponding to your mail.

After compacting my database, the size shrunk significantly, but the
number of messages also changed. Beware that you might lose messages
after compacting if you are trying this.

run on xapian-svn r13824

> After running the above command, you could then move your existing
> .notmuch/xapian away and move .notmuch/xapian-compact in its place to
> test, and then discard the original .notmuch/xapian if you're happy with
> the result.
> For me, this compaction took my 5.0GB down to 3.1GB. So my database is
> now less than half the size of what I started with with flint, (and can
> conceivable be cached entirely within memory on my machine!), which is
> quite delightful.

Kan-Ru Chen | http://kanru.info

Q: Why are my replies five sentences or less?
A: http://five.sentenc.es/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100112/31f4ff9d/attachment.pgp>

More information about the notmuch mailing list