start is a window into the sorted, matched documents.

So, whether the second query matches a lot less documents, and hence has less to sort, depends once again on where X lies in the distribution of documents. If X if the first term in the field, the second query would match all documents (except for the first since you used "{" rather than "["). But, the query itself might be slower than a *:* query depending on exactly how Lucene evaluates range queries.

-- Jack Krupansky

-----Original Message----- From: Furkan KAMACI
Sent: Sunday, July 28, 2013 5:34 PM
To: solr-user@lucene.apache.org
Subject: Re: Query Performance

Actually I have to rewrite my question:

Query 1:

q=*:*&rows=row_count&sort=id asc&start=X

and

Query2:

q={X TO *}&rows=row_count&sort=id asc&start=0



2013/7/29 Jack Krupansky <j...@basetechnology.com>

The second query excludes documents matched by [* TO X], while the first
query matches all documents.

Relative performance will depend on relative match count and the sort time
on the matched documents. Sorting will likely be the dominant factor - for
equal number of documents. So, it depends on whether starting with X
excludes or includes the majority of documents, relative to whatever
row_count might be.

Generally, you should only sort a small number of documents/results.

Or, consider DocValues since they are designed for sorting.

-- Jack Krupansky

-----Original Message----- From: Furkan KAMACI
Sent: Sunday, July 28, 2013 5:06 PM
To: solr-user@lucene.apache.org
Subject: Query Performance


What is the difference between:

q=*:*&rows=row_count&sort=id asc

and

q={X TO *}&rows=row_count&sort=id asc

Does the first one trys to get all the documents but cut the result or they
are same or...? What happens at underlying process of Solr for that two
queries?


Reply via email to