Located the problem. An old fixme/too.

Not so easy to fix though :-(

The strategy currently used for searches is correct, but sub-optimal.

Searches can be very complex or very simple.

a simple flat query:

x search charset utf-8 text "charsettest" 1

means:

search for substring "charsettest"
AND
search for message id 1

The current strategy is to handle all search-keys separately and combine
the results afterwards. This approach scales - in terms of correctness -
very well even for very complex search trees (a AND b or C or D not E
and F) but leads to very poor performance for simple statements like above.

In the above example this leads to:

search *all* messages in the mailbox for the substring
search for the message with the specified message-id
merge both results.

Which is very suboptimal to say the least.

It would be much better to re-order the search-keys on the same level
where possible (left-hand and right-hand of AND operators). Scan for
cheap searches like sequence sets (like message ids or UIDS), and use
those to speed up the expensive search-keys (like body searches) through
a feed-forward mechanism.

Introducing this for left-hand/right-hand arguments of AND operators
seems safe and if done right, and without side-effects.

Let's see if I can come up with a solution.



-- 
________________________________________________________________
Paul J Stevens        pjstevns @ gmail, twitter, skype, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/[email protected]/+31.85.877.99.97
________________________________________________________________
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to