On 6.2.2013, at 1.02, Michael M Slusarz slusarz@curecanti.org wrote:
a UID SORT RETURN (ALL COUNT) (DATE) UTF-8 SUBJECT "foo"
is always about 10 percent slower than this split query (I've done this 4-5 times, and the numbers are similar):
a UID SEARCH RETURN (SAVE) CHARSET UTF-8 SUBJECT "foo" b UID SORT RETURN (ALL COUNT) (DATE) UTF-8 UID $
(The particular query I used matched 5 messages out of the 21,000+)
I think the main difference is that the first command fetches also Date: header from dovecot.index.cache. Did you check if the slowness was because of additional userspace CPU usage (instead of disk IO)?
See if the attached patch makes a difference?
One possible solution would be to do the prefetching when search program is "all", but not otherwise. But if most of the messages match the search query then this is slower..