Re: query on a subset of messages ?
authorJameson Graef Rollins <jrollins@finestructure.net>
Mon, 9 Jul 2012 15:55:29 +0000 (08:55 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:04 +0000 (09:48 -0800)
45/12ee2f136bd0b87c65e876cfc1565025314bcc [new file with mode: 0644]

diff --git a/45/12ee2f136bd0b87c65e876cfc1565025314bcc b/45/12ee2f136bd0b87c65e876cfc1565025314bcc
new file mode 100644 (file)
index 0000000..e0f1ce9
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1311A431FBD\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 08:55:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.29\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id xJIPSg+O6NNx for <notmuch@notmuchmail.org>;\r
+       Mon,  9 Jul 2012 08:55:46 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id BFCE7431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 08:55:46 -0700 (PDT)\r
+Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by earth-doxen-postvirus (Postfix) with ESMTP id 5B34266E00D1;\r
+       Mon,  9 Jul 2012 08:55:44 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+       (Authenticated sender: jrollins)\r
+       by earth-doxen-submit (Postfix) with ESMTP id 5FA9166E00AE;\r
+       Mon,  9 Jul 2012 08:55:32 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id ECC6C378; Mon,  9 Jul 2012 08:55:31 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Sebastien Binet <binet@cern.ch>,\r
+       Notmuch developer list <notmuch@notmuchmail.org>\r
+Subject: Re: query on a subset of messages ?\r
+In-Reply-To: <871ukl5oj7.fsf@cern.ch>\r
+References: <871ukl5oj7.fsf@cern.ch>\r
+User-Agent: Notmuch/0.13.2+54~ga0426dc (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 09 Jul 2012 08:55:29 -0700\r
+Message-ID: <87ehol2aku.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha256; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 09 Jul 2012 15:55:49 -0000\r
+\r
+--=-=-=\r
+\r
+On Mon, Jul 09 2012, Sebastien Binet <binet@cern.ch> wrote:\r
+> I was trying to reduce the I/O stress during my usual email\r
+> fetching+tagging by writing a little program using the go bindings to\r
+> notmuch.\r
+>\r
+> ie:\r
+> db, status := notmuch.OpenDatabase(db_path,\r
+>              notmuch.DATABASE_MODE_READ_WRITE)\r
+> query := db.CreateQuery("(tag:new AND tag:inbox)")\r
+> msgs := query.SearchMessages()\r
+> for _,msg := range msgs {\r
+>   tag_msg(msg, tagqueries)\r
+> }\r
+>\r
+>\r
+> where tagqueries is a subquery of the form:\r
+> [\r
+>     {\r
+>         "Cmd": "+to-me",\r
+>         "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)"\r
+>     },\r
+>     {\r
+>         "Cmd": "+sci-notmuch",\r
+>         "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmail.org or subject:notmuch"\r
+>     }\r
+> ]\r
+\r
+\r
+Hi, Sebastian.  It's really hard for me to believe that this is much\r
+faster than simply making the two tagging calls in full:\r
+\r
+notmuch tag +to-me -- tag:new and tag:inbox and (to:sebastien.binet@cern.ch and not tag:to-me)\r
+notmuch tag +sci-notmuch -- tag:new and tag:inbox and from:notmuch@notmuchmail.org or to:notmuch@notmuchmail.org or subject:notmuch"\r
+\r
+After the first call the cache will be fresh, so the overhead should be\r
+minimal.  It looks to me you're looking in to this as a post-new hook.\r
+I do pretty much the same thing, and with the above properly constructed\r
+searches the tagging is super fast.\r
+\r
+Have you tried profiling the two options?  Is it really high I/O stress\r
+on your system?  If so, maybe there's another issue that can be\r
+addressed.\r
+\r
+As an aside I should point out that a lot of people want to see the\r
+"to:me" search term.  But I think the right place to achieve that is in\r
+the query parser.\r
+\r
+jamie.\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.12 (GNU/Linux)\r
+\r
+iQIcBAEBCAAGBQJP+v7xAAoJEO00zqvie6q8DUYP/iaZK9Y0Ve92jlIPiKyLkvYf\r
+7xy6IcRLeph/VnHtbIIRskGeZrmNTjIIZjGHiwf35twaAm3Sfb6JedMheEv5ZUld\r
+c/qUUA5eR2otJTe910aNAijOlHoeVRe0sG/S1wv0WIYBADlpnWU4pph5TbQQdcyv\r
+/YdhhxKKlCPRDhojjzYcco46RkzietCO3AL3DulbJWqWVA3jC2dFDiu7RtuQCoXo\r
+Lqr4eavU0/sYsGjoPWmJyF5Xrna57jLtPwJ+WlSeXTEBiz62rB8AsqRUv5WQu/Gr\r
+DVZQebRG05I+yMteBr0UKko/Vk4IkePmO+/MdHM2sGkYA60AwIoxvhhgpLVaO1Tv\r
+Y2NUmPcUFYSL5HOlfMBvhNF0dhW0HmyWISCGSNkal9px3nSybYp84xlA6gsH0uqg\r
+H3ri3oP08orej94vpw9rXCqjL68YNS9NpNKdLXSn9o50U6ILBgjaSzVKXEOXxAGW\r
+tRzcOIW0Vz0ryY1Hb2U/ryhTjEVTUzPqHQx16sMOIGnL4qvyt4YLvpRszrCQH4dW\r
+HQ3XaeXMjz7MFqFV73u43AwJ7ln0fGjIAZ8FzhWvY6ZyOrT3te5vZy7MicEUs3zp\r
+655EGIZ1wUvn9JY5UvEGED1s+rd4LNii8YBGzRCx83xCe9PphdVOpsbUnxs1hT7o\r
+JbbyLteArCoFiwskE+MK\r
+=yswv\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r