[Xapian-discuss] Speed of range queries

Olly Betts olly at survex.com
Tue Oct 23 17:14:26 BST 2012


On Tue, Oct 23, 2012 at 12:34:55PM +0200, Dmitry Karasik wrote:
> I'm having a problem with range searches on 1.2.12, can't put a finger on it,
> possibly you can help me with a clue. The problem is that this query
> 
> Xapian::Query((VALUE_RANGE 70 stringA stringB AND KEYvalue:(pos=1)))
> 
> takes 0.6 seconds, whereas this one
> 
> Xapian::Query((KEYvalue:(pos=1) AND VALUE_RANGE 70 stringA stringB))
> 
> takes 20 seconds. I'm in the process of isolating the problem, so that I can
> demonstrate it, but meanwhile I'd like to ask if you could give any advice
> about where to look, tuning/debugging/whatever. Currently I'm fighting the
> problem by explicit rearranging of the query so that the range request goes
> first, but that's a hack and I don't understand why it works like that. Any
> help will be appreciated!

The order shouldn't make a difference - internally the subqueries of a
tree of AND-like operators are gathered up and rearranged into a shape
which is likely to work most efficiently.

So if that's working properly, the only thing I can think is that the
two subqueries have the same estimated term frequency.  Does term
KEYvalue match a lot of documents?

Cheers,
    Olly



More information about the Xapian-discuss mailing list