]> git.notmuchmail.org Git - notmuch/commit
lib: directly traverse postlists in _n_message_delete
authorDavid Bremner <david@tethera.net>
Fri, 16 Apr 2021 12:00:39 +0000 (09:00 -0300)
committerDavid Bremner <david@tethera.net>
Sun, 18 Apr 2021 12:50:36 +0000 (09:50 -0300)
commit9ad19e4454ff98342a6c0ec5a7e44c8c516e6fcd
tree4455d57921e0aea0ee9a4ba75ec2dd73b4a8fdaa
parent8a64f725dfb5d29f971aaf9d12e7e620e8c5a2e2
lib: directly traverse postlists in _n_message_delete

This is intended to fix the slow behaviour of "notmuch new" (and possibly
"notmuch reindex") when large numbers of files are deleted.

The underlying issue [1] seems to be the Xapian glass backend spending
a large amount of time in db.has_positions when running queries with
large-ish amounts of unflushed changes.

This commit removes two uses of Xapian queries [2], and replaces them with
an approximation of what Xapian would do after optimizing the
queries. This avoids the calls to has_positions (which are in any case
un-needed because we are only using boolean terms here).

[1] Thanks to "andres" on IRC for narrowing down the performance
bottleneck.

[2] Thanks to Olly Betts of Xapian fame for talking me a through a fix
that does not require people to update Xapian.
lib/message.cc