Re: [PATCH] lib: reword comment about XFOLDER: prefix
[notmuch-archives.git] / cc / 1d8c3a5355e4a33022ff94d48c86b3487049f9
1 Return-Path: <amdragon@mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 4B71E431FBD\r
6         for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 09:30:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id PzMxaJqX0H-e for <notmuch@notmuchmail.org>;\r
16         Mon,  9 Jul 2012 09:30:07 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 8DB73431FAE\r
20         for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 09:30:07 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7f306d0000008b4-82-4ffb070ee00b\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id F4.9D.02228.E070BFF4; Mon,  9 Jul 2012 12:30:06 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q69GU5d9023574; \r
27         Mon, 9 Jul 2012 12:30:05 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q69GU0KR019822\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 9 Jul 2012 12:30:01 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1SoGqW-0001Zy-II; Mon, 09 Jul 2012 12:30:00 -0400\r
37 Date: Mon, 9 Jul 2012 12:30:00 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Sebastien Binet <binet@cern.ch>\r
40 Subject: Re: query on a subset of messages ?\r
41 Message-ID: <20120709163000.GG18195@mit.edu>\r
42 References: <871ukl5oj7.fsf@cern.ch>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 Content-Disposition: inline\r
46 In-Reply-To: <871ukl5oj7.fsf@cern.ch>\r
47 User-Agent: Mutt/1.5.21 (2010-09-15)\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IRYrdT1+Vj/+1v0HuPx2Li81CL6zdnMjsw\r
50         eTw6N5XR49mqW8wBTFFcNimpOZllqUX6dglcGXM3H2Ir+MNX0fnnDXsD41HuLkZODgkBE4n9\r
51         S7+zQ9hiEhfurWfrYuTiEBLYxyix/cc3RghnPaPEw40LWSCcE0wSjd/mAjkcQM4SRonHNSDd\r
52         LAIqEm//L2MEsdkENCS27V8OZosIKEscP7WGDcRmBtq29P0VFhBbWEBH4u/Ni2BxXiB736/P\r
53         YFcIAc3pbznLDBEXlDg58wkLRK+WxI1/L5lA1jILSEss/8cBEuYUUJW49usbWKsoUOuUk9vY\r
54         JjAKzULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0TfRyM0v0UlNKNzGCQppT\r
55         kn8H47eDSocYBTgYlXh4N7H89hdiTSwrrsw9xCjJwaQkynuRESjEl5SfUpmRWJwRX1Sak1p8\r
56         iFGCg1lJhHfR11/+QrwpiZVVqUX5MClpDhYlcd6rKTf9hQTSE0tSs1NTC1KLYLIyHBxKErx9\r
57         bEBDBYtS01Mr0jJzShDSTBycIMN5gIZHgNTwFhck5hZnpkPkTzEqSonzOoAkBEASGaV5cL2w\r
58         lPOKURzoFWHeHJAqHmC6gut+BTSYCWhwew/I1cUliQgpqQZGls0XBQ/dM7plm37P85xXn+Fv\r
59         sZ0v3jK/Wnal9FDB9med3VeWxVod3L/DPK9//vUGj9xdO+VuGf3rWMDV5vOn3D37bvrsv58F\r
60         H/zgyem+rMQdv6/P8+nXS49nBFY/ffFm96yHTPfVdDVPpAaIfL6++JiM1PsfV63Ynud8YOG/\r
61         0PBpzdfOPV253kosxRmJhlrMRcWJAKzczs0UAwAA\r
62 Cc: Notmuch developer list <notmuch@notmuchmail.org>\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Mon, 09 Jul 2012 16:30:08 -0000\r
76 \r
77 Quoth Sebastien Binet on Jul 09 at 10:25 am:\r
78\r
79 > hi there,\r
80\r
81 > I was trying to reduce the I/O stress during my usual email\r
82 > fetching+tagging by writing a little program using the go bindings to\r
83 > notmuch.\r
84\r
85 > ie:\r
86 > db, status := notmuch.OpenDatabase(db_path,\r
87 >               notmuch.DATABASE_MODE_READ_WRITE)\r
88 > query := db.CreateQuery("(tag:new AND tag:inbox)")\r
89 > msgs := query.SearchMessages()\r
90 > for _,msg := range msgs {\r
91 >   tag_msg(msg, tagqueries)\r
92 > }\r
93\r
94\r
95 > where tagqueries is a subquery of the form:\r
96 > [\r
97 >     {\r
98 >         "Cmd": "+to-me",\r
99 >         "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)"\r
100 >     },\r
101 >     {\r
102 >         "Cmd": "+sci-notmuch",\r
103 >         "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmail.org or subject:notmuch"\r
104 >     }\r
105 > ]\r
106\r
107\r
108 > the idea being that I only need to crawl through the db only once and\r
109 > then iteratively apply tags on those messages (instead of repeatedly\r
110 > running "notmuch tag ..." for each and every of those many\r
111 > 'tag-queries')\r
112\r
113 > I couldn't find any C-API to do such a thing using the notmuch library.\r
114 > did I overlook something ?\r
115\r
116 > Is it something useful to add ?\r
117\r
118 > -s\r
119 \r
120 Have you tried a more direct translation of the multiple notmuch tag\r
121 commands into Go, where you don't worry about subsetting the queries?\r
122 Unless you're tagging a huge number of messages, the cost of notmuch\r
123 tag is almost certainly the fsync that it does when it closes the\r
124 database (which every call to notmuch tag must do).  However, in Go,\r
125 you can keep the database open across all of the tagging operations\r
126 and then close and fsync it just once.\r
127 \r
128 Note that there is an important optimization in notmuch tag that you\r
129 might have to replicate.  It manipulates the original query to exclude\r
130 messages that already have the desired tags, so that they get skipped\r
131 very efficiently at the earliest stage possible.\r