query on a subset of messages ?

Sebastien Binet binet at cern.ch
Mon Jul 9 09:45:44 PDT 2012


Jamie,

Jameson Graef Rollins <jrollins at finestructure.net> writes:

> On Mon, Jul 09 2012, Sebastien Binet <binet at cern.ch> wrote:
>> I was trying to reduce the I/O stress during my usual email
>> fetching+tagging by writing a little program using the go bindings to
>> notmuch.
>>
>> ie:
>> db, status := notmuch.OpenDatabase(db_path,
>>     		notmuch.DATABASE_MODE_READ_WRITE)
>> query := db.CreateQuery("(tag:new AND tag:inbox)")
>> msgs := query.SearchMessages()
>> for _,msg := range msgs {
>>   tag_msg(msg, tagqueries)
>> }
>>
>>
>> where tagqueries is a subquery of the form:
>> [
>>     {
>>         "Cmd": "+to-me",
>>         "Query": "(to:sebastien.binet at cern.ch and not tag:to-me)"
>>     },
>>     {
>>         "Cmd": "+sci-notmuch",
>>         "Query": "from:notmuch at notmuchmail.org or to:notmuch at notmuchmail.org or subject:notmuch"
>>     }
>> ]
>
>
> Hi, Sebastian.  It's really hard for me to believe that this is much
> faster than simply making the two tagging calls in full:
>
> notmuch tag +to-me -- tag:new and tag:inbox and (to:sebastien.binet at cern.ch and not tag:to-me)
> notmuch tag +sci-notmuch -- tag:new and tag:inbox and from:notmuch at notmuchmail.org or to:notmuch at notmuchmail.org or subject:notmuch"
>
> After the first call the cache will be fresh, so the overhead should be
> minimal.  It looks to me you're looking in to this as a post-new hook.
> I do pretty much the same thing, and with the above properly constructed
> searches the tagging is super fast.

well, of course I don't have just those two:

$ grep -He "^tag_new " emacs/notmuch-lib/notmuch-tag.sh | wc -l
54

also:
$ du -hs mail-notmuch/.notmuch 
2.9G	mail-notmuch/.notmuch

that said, most of the I/O wait seem to come from 'notmuch new' (after
having dropped all fs caches.)

ok, post-new hook it is then :)

(but there is probably something to do to speed-up a 'notmuch new' after
having dropped all fs caches... ?)

-s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120709/f8f7106d/attachment.pgp>


More information about the notmuch mailing list