Re: Getting maximum / minimum field value - slow query

2012-06-13 Thread rafal.gwizd...@gmail.com
What is more, I tried to get the maximum value using stats query
This time the response time was about 30 seconds and server ate 1.5 Gb of
memory when calculating the response. But there were no statistics in
response:

response
lst name=responseHeader
int name=status0/int
int name=QTime27578/int
lst name=params
str name=q*.*/str
str name=statstrue/str
str name=stats.fieldId/str
str name=rows0/str
/lst
/lst
result name=response numFound=0 start=0/
lst name=stats
lst name=stats_fields
null name=Id/
/lst
/lst
/response

What's wrong here?

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Getting-maximum-minimum-field-value-slow-query-tp3989467p3989468.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Getting maximum / minimum field value - slow query

2012-06-13 Thread Jack Krupansky
Try the query without the sort to get the number of rows, then do a second 
query using a start equal to the number of rows. That should get you the 
last row/document.


-- Jack Krupansky

-Original Message- 
From: rafal.gwizd...@gmail.com

Sent: Wednesday, June 13, 2012 3:07 PM
To: solr-user@lucene.apache.org
Subject: Getting maximum / minimum field value - slow query

Hi, I have an index with about 9 millions of documents. Every document has 
an

integer 'Id' field (it's not the SOLR document identifier) and I want to get
the maximum value of that field.
Therefore I'm doing a search with the following parameters
query=*.*, sort=Id desc, rows=1

response
lst name=responseHeader
int name=status0/int
int name=QTime2672/int
lst name=params
str name=q*:*/str
str name=rows1/str
str name=sortId desc/str
/lst
/lst
result name=response numFound=8747779 start=0
doc
str name=UidCRQIncident#45165891/str
/doc
/result
/response

The problem is that it takes quite a long time to get the response (2-10
seconds). Why is it so slow - isn't it a simple index lookup?

Best regards
RG

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Getting-maximum-minimum-field-value-slow-query-tp3989467.html
Sent from the Solr - User mailing list archive at Nabble.com. 



Re: Getting maximum / minimum field value - slow query

2012-06-13 Thread Erik Hatcher
A large start value is probably worse performing than the sort (see SOLR-1726). 
 Once the sort field is cached, it'll be quick from then on.  Put in a warming 
query in solrconfig for new and/or firstSearcher that does this sort and the 
cache will be built in advance of queries at least.

Erik

On Jun 13, 2012, at 16:09 , Jack Krupansky wrote:

 Try the query without the sort to get the number of rows, then do a second 
 query using a start equal to the number of rows. That should get you the 
 last row/document.
 
 -- Jack Krupansky
 
 -Original Message- From: rafal.gwizd...@gmail.com
 Sent: Wednesday, June 13, 2012 3:07 PM
 To: solr-user@lucene.apache.org
 Subject: Getting maximum / minimum field value - slow query
 
 Hi, I have an index with about 9 millions of documents. Every document has an
 integer 'Id' field (it's not the SOLR document identifier) and I want to get
 the maximum value of that field.
 Therefore I'm doing a search with the following parameters
 query=*.*, sort=Id desc, rows=1
 
 response
 lst name=responseHeader
 int name=status0/int
 int name=QTime2672/int
 lst name=params
 str name=q*:*/str
 str name=rows1/str
 str name=sortId desc/str
 /lst
 /lst
 result name=response numFound=8747779 start=0
 doc
 str name=UidCRQIncident#45165891/str
 /doc
 /result
 /response
 
 The problem is that it takes quite a long time to get the response (2-10
 seconds). Why is it so slow - isn't it a simple index lookup?
 
 Best regards
 RG
 
 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Getting-maximum-minimum-field-value-slow-query-tp3989467.html
 Sent from the Solr - User mailing list archive at Nabble.com.