From 6b6e971fb40de32f42dfea7f9de09f45054dfe31 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Mon, 9 Jul 2012 18:45:44 +0200 Subject: [PATCH] Re: query on a subset of messages ? --- 2a/78ad0916900c5a766dec3c62f13d9108ec0e1e | 136 ++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 2a/78ad0916900c5a766dec3c62f13d9108ec0e1e diff --git a/2a/78ad0916900c5a766dec3c62f13d9108ec0e1e b/2a/78ad0916900c5a766dec3c62f13d9108ec0e1e new file mode 100644 index 000000000..042e88a3c --- /dev/null +++ b/2a/78ad0916900c5a766dec3c62f13d9108ec0e1e @@ -0,0 +1,136 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 5C541431FBD + for ; Mon, 9 Jul 2012 09:45:54 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -5 +X-Spam-Level: +X-Spam-Status: No, score=-5 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_HI=-5] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id GaTrP1WgRnmh for ; + Mon, 9 Jul 2012 09:45:53 -0700 (PDT) +Received: from CERNMX30.cern.ch (cernmx30.cern.ch [137.138.144.177]) + (using TLSv1 with cipher AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 59168431FAE + for ; Mon, 9 Jul 2012 09:45:53 -0700 (PDT) +Received: from CERNFE22.cern.ch (137.138.144.151) by cernmxgwlb2.cern.ch + (137.138.144.177) with Microsoft SMTP Server (TLS) id 14.2.283.3; + Mon, 9 Jul 2012 18:45:50 +0200 +Received: from localhost (134.158.88.68) by smtp.cern.ch (137.138.144.172) + with Microsoft SMTP Server (TLS) id 14.2.298.4; Mon, 9 Jul 2012 18:45:50 + +0200 +From: Sebastien Binet +To: Jameson Graef Rollins , Notmuch developer list + +Subject: Re: query on a subset of messages ? +In-Reply-To: <87ehol2aku.fsf@servo.finestructure.net> +References: <871ukl5oj7.fsf@cern.ch> <87ehol2aku.fsf@servo.finestructure.net> +User-Agent: Notmuch/0.13.2+60~g7ecf77d (http://notmuchmail.org) Emacs/24.1.1 + (x86_64-unknown-linux-gnu) +Date: Mon, 9 Jul 2012 18:45:44 +0200 +Message-ID: <87wr2c3mtj.fsf@cern.ch> +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; + protocol="application/pgp-signature" +X-Originating-IP: [134.158.88.68] +Keywords: CERN SpamKiller Note: -50 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 09 Jul 2012 16:45:54 -0000 + +--=-=-= +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Jamie, + +Jameson Graef Rollins writes: + +> On Mon, Jul 09 2012, Sebastien Binet 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 :=3D notmuch.OpenDatabase(db_path, +>> notmuch.DATABASE_MODE_READ_WRITE) +>> query :=3D db.CreateQuery("(tag:new AND tag:inbox)") +>> msgs :=3D query.SearchMessages() +>> for _,msg :=3D range msgs { +>> tag_msg(msg, tagqueries) +>> } +>> +>> +>> where tagqueries is a subquery of the form: +>> [ +>> { +>> "Cmd": "+to-me", +>> "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)" +>> }, +>> { +>> "Cmd": "+sci-notmuch", +>> "Query": "from:notmuch@notmuchmail.org or to:notmuch@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@cern.= +ch and not tag:to-me) +> notmuch tag +sci-notmuch -- tag:new and tag:inbox and from:notmuch@notmuc= +hmail.org or to:notmuch@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=20 +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... ?) + +=2Ds + +--=-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.19 (GNU/Linux) + +iEYEARECAAYFAk/7Cr4ACgkQPj4AVbsZCCYJhwCbBQdX5QsFjL2g43C3sDdUseNO +6sgAn09SDXMqJoAQgbHoXKMvEObt60yM +=Ey0V +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2